MotionGPT3
MotionGPT3 copied to clipboard
python app.py: ImportError: cannot import name 'GPTLosses' from 'motGPT.losses.motgpt'
Running python app.py fails:
python app.py ✔ 6s mgpt3
/home/dominik/miniconda3/envs/mgpt3/lib/python3.11/site-packages/lightning_fabric/__init__.py:36: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
__import__("pkg_resources").declare_namespace(__name__)
Global seed set to 1234
Traceback (most recent call last):
File "/home/dominik/Documents/repos/MotionGPT3/app.py", line 36, in <module>
model = build_model(cfg, datamodule).eval()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dominik/Documents/repos/MotionGPT3/motGPT/models/build_model.py", line 8, in build_model
return instantiate_from_config(model_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dominik/Documents/repos/MotionGPT3/motGPT/config.py", line 42, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dominik/Documents/repos/MotionGPT3/motGPT/config.py", line 33, in get_obj_from_str
return getattr(importlib.import_module(module, package=None), cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dominik/miniconda3/envs/mgpt3/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/dominik/Documents/repos/MotionGPT3/motGPT/models/motgpt_webui.py", line 8, in <module>
from motGPT.losses.motgpt import GPTLosses
ImportError: cannot import name 'GPTLosses' from 'motGPT.losses.motgpt' (/home/dominik/Documents/repos/MotionGPT3/motGPT/losses/motgpt.py)
I have the same problem.
Fix it in the latest commit.
To fix it with the smallest change, replace the two GPTLosses instances in motgpt_webui.py with MotLosses.