X2Paddle icon indicating copy to clipboard operation
X2Paddle copied to clipboard

调用pytorch2paddle函数找不到转换后的模型

Open hajungong007 opened this issue 1 year ago • 0 comments

调用pytorch2paddle函数在pd_model_trace文件夹中找不到转换后的模型 代码如下:

import torch
import numpy as np
from torchvision.models import AlexNet
from torch.hub import load_state_dict_from_url

input_data = np.random.rand(1, 3, 224, 224).astype("float32")

torch_module = AlexNet()
torch_state_dict = load_state_dict_from_url('https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth')
torch_module.load_state_dict(torch_state_dict)

torch_module.eval()

from x2paddle.convert import pytorch2paddle
pytorch2paddle(torch_module, "pd_model_trace", jit_type="trace", input_examples=[torch.tensor(input_data)], enable_code_optim=False, convert_to_lite=False, lite_valid_places="arm", lite_model_type="naive_buffer")

我的安装环境: x2paddle 1.4.1 paddlelite 2.13rc0 paddlepaddle 2.5.0rc1

hajungong007 avatar Jun 15 '23 08:06 hajungong007