You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error in cpp_jit_load(path) :
Unknown type name '__torch__.torch.classes.torchtext.SentencePiece':
Serialized File "code/__torch__/asapp/valley/autosuggest/autosuggest_new/inference.py", line 5
__buffers__ = []
training : bool
tokenizer : __torch__.torch.classes.torchtext.SentencePiece
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
whitespace_id : int
context_len : int
I can replicate this error in Python by not loading torchtext, e.g. this provides the same error:
importtorchmodel=torch.jit.load("RecursiveScriptModule_model.zip") # Fails with same error
Instead I need to load the dependencies in Python, e.g.
I would like to add the same dependencies when loading in R. Since I know the C++ dependencies, can I pass them to R? Do I need to make some R package that provides the C++ dependencies? How do I register that?
The text was updated successfully, but these errors were encountered:
Making it easier to load external c++ extensions is something we want to work soon. I have done a small exploration with torchvision here: mlverse/torchvision#54 (comment)
Basically you need to dyn.load() the extension binary and everything should just work, no need for custom registrations and things like this.
I have a model trained internally with two extensions:
torchtext
: UsingSentencePiece
.sru
: A C++ implementation of a custom RNN unit.I can try to load the model in R with:
However, that provides an error:
I can replicate this error in Python by not loading
torchtext
, e.g. this provides the same error:Instead I need to load the dependencies in Python, e.g.
I can also load this in C++. In the
CMakeLists.txt
file, I have:I would like to add the same dependencies when loading in R. Since I know the C++ dependencies, can I pass them to R? Do I need to make some R package that provides the C++ dependencies? How do I register that?
The text was updated successfully, but these errors were encountered: