Common Failure
import Error
Error I: Cannot find the extension library(_C.so)
Solution:
- Make sure that the horizon_plugin_pytorch version corresponds to the cuda version.
- In python3, find the execution path of horizon_plugin_pytorch and check for .so files in that directory. There may be multiple versions of horizon_plugin_pytorch at the same time, so you need to uninstall it and keep only the one you need.
Error II: RuntimeError: Cannot load custom ops. Please rebuild the horizon_plugin_pytorch
Solution: check if the local CUDA environment is OK, such as path, version, etc.
Module doesn't support deepcopy
Some frameworks (e.g., PyTorch Lightning) provide wrappers which do not support deepcopy around the native torch module.
Solution: Implement the __deepcopy__ method for the model.
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment
This error usually occurs when deepcopying a torch.nn.Module. It typically happens when certain intermediate results are stored in the model during the forward pass, and the presence of non-leaf tensors in the model causes the deepcopy error.
Solution: Check if there are any non-leaf tensors in the model or after the forward pass. Before saving these tensors, make sure to perform the detach operation.
Error occurred during export: IndexError: list index out of range.
This error usually occurs because there are qtensor in the model's output.
Solution: Check the model output to ensure that all outputs have been dequantized.
