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
I was trying to apply a LSTM model to my game in unity. LSTMModel = new LSTMModel(6, 512, 8); LSTMModel.load("Assets/Scripts/Brain/model_state_dict.pth");
It first raised a error that ArgumentException: Mismatched state_dict sizes: expected 14, but found 80 entries. Then I printed out the size of this model in vs code using python, and the size of the model was 14. It is the same size in C#.
I had no choice but to set the parameter inside the function <torch.load> to false LSTMModel.load("Assets/Scripts/Brain/model_state_dict.pth",false);
Unfortunately, it raised another error that ExternalException: Unsupported TypeMeta in ATen: nullptr (uninitialized) (please report this error).
I'm grateful for any replies.
unity version:2021.3.43f1c1
TorchSharp: 0.105
The text was updated successfully, but these errors were encountered:
From the given context; it seems like a problem regarding loading a model or model itself.
Could you please try to reproduce the issue with PyTorch and share your code for loading in Python?
Also, may I ask about your Operating System?
Thank you for replying! I have solved this problem. It is my fault that using this function torch.save(model.state_dict(), 'model.pth')
to save my model in python. Model saved in this way can not be loaded by using the function 'torch.load()' in C#.
Instead, I save my model by net = torch.jit.trace(model,torch.randn(1,1,6,dtype=torch.float32)) torch.jit.save(net,"./model.pth")
and load it by jit.ScriptModule net; net = jit.load("Assets/Scripts/Brain/Brain.pth");
It works!
However, it still exists some problem in my project.
"Unloading broken assembly Assets/Packages/SkiaSharp.2.88.6/interactive-extensions/dotnet/SkiaSharp.DotNet.Interactive.dll, this assembly can cause crashes in the runtime
"
Because this error does not influence my project temporarily, I turn a blind eye to it.
My Operating System is windows.
TorchSharp version is 0.101.6
I was trying to apply a LSTM model to my game in unity.
LSTMModel = new LSTMModel(6, 512, 8); LSTMModel.load("Assets/Scripts/Brain/model_state_dict.pth");
It first raised a error that ArgumentException: Mismatched state_dict sizes: expected 14, but found 80 entries. Then I printed out the size of this model in vs code using python, and the size of the model was 14. It is the same size in C#.
I had no choice but to set the parameter inside the function <torch.load> to false
LSTMModel.load("Assets/Scripts/Brain/model_state_dict.pth",false);
Unfortunately, it raised another error that ExternalException: Unsupported TypeMeta in ATen: nullptr (uninitialized) (please report this error).
I'm grateful for any replies.
unity version:2021.3.43f1c1
TorchSharp: 0.105
The text was updated successfully, but these errors were encountered: