tuotuoxp / cpp-torch

cpp-torch is a C++ library, implemented as a wrapper around Torch libraries.
Apache License 2.0
49 stars 17 forks source link

Loading models trained in PyTorch #18

Open aytop opened 6 years ago

aytop commented 6 years ago

Hello, I trained my model in python using PyTorch and now I want to make inference in cpptorch. I am not quite sure how to load my model. I tried saving my model using torch.save_state_dic() and then loading the file using code you provided but i got this error: /home/aytop/Downloads/cpp-torch/src/loader.cpp:203: std::shared_ptr object_loader::read_object(std::istream&): Assertion `0' failed. Aborted (core dumped) Any advice?

yytdfc commented 6 years ago

This repo is c api for Torch7. PyTorch is the python implement instead of Lua. You need Caffe2 to deploy your PyTorch trained model.