Closed erogol closed 8 years ago
Yes ... you can create a lua class, that trains your model, or loads an existing model, and call this from Python. You can pass in new examples from python to the model, to predict on. I would first have a look at simpleexample/pybit.py and simpleexample/luabit.lua for an example of python code that loads a lua class, creates an object from it, and calls methods on it. That lua class could load your model, and pass new examples to your model for prediction.
Actually, I will write an example for this :-)
Thanks :)
Ok, I didnt add prediction, but covers:
51cbc09
https://github.com/hughperkins/pytorch/tree/master/examples/luamodel
Updated so you can pass numpy tensors in directly now 66bb797
added prediction in 9c05864
Also added methods tensorOne.eq(tensorTwo)
, and tensor.sum()
to PyTorch.xxxTensor objects
You'll need to pip install docopt
to use runner.py now
Updated in 0a9e04a to convert the output predictions tensor to numpy array, before calculating number correct
To what extent does this do approximately what you want? (The other approach is to instantiate nn modules directly from the python; depends what you want really)
You can load directly now, without needing to create a lua class, see https://github.com/hughperkins/pytorch/issues/15
I want to use torch trained deep learning model from python. Is it able to do that?