The error code is as follows:
# Error code! model = model.load_state_dict(state_dict_var) out = model(input)
There are some problems on the Internet because the saved model uses state_ DCIT() to load, or vice versa.
The error here is different from the above because xxx.load_state_Dict() does not require a return value to receive.
Amend to read as follows:
# Correct code! model.load_state_dict(state_dict_var) out = model(input)
I hope it will help more people.
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- urllib.error.URLError: ＜urlopen error [Errno -3] Temporary failure in name resolution＞
- [Solved] HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model
- [Solved] Pytorch-transformers Error: AttributeError: ‘str‘ object has no attribute ‘shape‘
- [Solved] AttributeError: Manager isn‘t available; ‘auth.User‘ has been swapped for ‘
- Python errors: valueerror: if using all scalar values, you must pass an index (four solutions)
- The lenet model trained by Python failed to predict its own handwritten pictures
- Gensim Error: AttributeError: The vocab attribute was removed from KeyedVector in Gensim 4.0.0.
- [How to Solve] Python TypeError: ‘int‘ object is not subscriptable
- Keras import a custom metric model error: unknown metric function: Please ensure this object is passed to`custom_object‘
- [Solved] AttributeError: module ‘pandas‘ has no attribute ‘rolling_count‘
- [Solved] Original error was: No module named ‘numpy.core._multiarray_umath‘
- Pyyaml tutorial introduction to pyyaml library and YML writing and reading
- Python RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
- [ONNXRuntimeError] : 10 : INVALID_Graph loading model error
- To solve the problem that the loss of verification set of resnet50 pre-training model remains unchanged
- [Solved] TypeError: Object of type ‘bytes’ is not JSON serializable
- python: File Processing and Input and Output
- Tensorflow: Common Usage of tf.get_variable_scope()