Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load the 'resnet18_baseline_att_224x224_A_epoch_249_trt.pth' model anymore #881

Open
lweingart opened this issue Sep 10, 2023 · 0 comments

Comments

@lweingart
Copy link

Hi guys,

I had a jetson AGX Xavier on which I developed an action recognition app using your torch2trt and trt_pose, and it worked well.
This was in January 2021.

Today, I have a new Jetson AGX Orin and I try to make my app running on it.
The issue is that in two years, libraries have evolved all around and nothing works anymore.

I cloned the latest version of both torch2trt and trt_pose, but this is where it leads me to.
I get this error now:

/home/jetson/.local/lib/python3.8/site-packages/sklearn/utils/linear_assignment_.py:17: DeprecationWarning: The linear_assignment_ module is deprecated in 0.21 and will be removed from 0.23. Use scipy.optimize.linear_sum_assignment instead.
  warnings.warn(
[09/10/2023-16:04:05] [TRT] [E] 1: [stdArchiveReader.cpp::StdArchiveReader::37] Error Code 1: Serialization (Serialization assertion safeVersionRead == safeSerializationVersion failed.Version tag does not match. Note: Current Version: 0, Serialized Engine Version: 97)
[09/10/2023-16:04:05] [TRT] [E] 4: [runtime.cpp::deserializeCudaEngine::65] Error Code 4: Internal Error (Engine deserialization failed.)
Traceback (most recent call last):
  File "app_playground.py", line 42, in <module>
    model_trt.load_state_dict(torch.load(OPTIMIZED_MODEL))
  File "/home/jetson/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1987, in load_state_dict
    load(self, state_dict)
  File "/home/jetson/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1969, in load
    module._load_from_state_dict(
  File "/home/jetson/.local/lib/python3.8/site-packages/torch2trt-0.4.0-py3.8-linux-aarch64.egg/torch2trt/torch2trt.py", line 591, in _load_from_state_dict
    self.context = self.engine.create_execution_context()
AttributeError: 'NoneType' object has no attribute 'create_execution_context'

OPTIMIZED_MODEL being the path to the resnet18_baseline_att_224x224_A_epoch_249_trt.pth file.

This appears to be a version issue, but I'm not sure of the version of what.

I also tried to install the torch2trt version of early January 2021 by checking out a commit after naming the 0.2.0 version in a virtual environment (as other of my applications are using the current torch2trt), but when in a virtual environment, I get the following error when running python setup.py install:

running install
/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
Traceback (most recent call last):
  File "setup.py", line 38, in <module>
    setup(
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/__init__.py", line 108, in setup
    return distutils.core.setup(**attrs)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/command/install.py", line 74, in run
    self.do_egg_install()
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.ensure_finalized()  # finalize before bdist_egg munges install cmd
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 311, in finalize_options
    self.local_index = Environment(self.shadow_path + sys.path)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1044, in __init__
    self.scan(search_path)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1077, in scan
    self.add(dist)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1096, in add
    dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2640, in hashcmp
    self.parsed_version,
  File "/home/jetson/.virtualenvs/foo/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2694, in parsed_version
    raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '0.23ubuntu1' (package: distro-info)

Would you by chance an idea to point me in the right direction and help me sort this mess out?

Thank you very much for your help in advance

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant