admin管理员组文章数量:1123950
I am trying to run this GitHub repository locally. However, when I try to run their test command (with their test images), I run into this error:
AttributeError: Can't get attribute 'MulticlassRegression' on <module 'models' from './micronuclAI/src/model/models.py'>'. The phrase MulticlassRegression only exists in the files ./micronuclAI_model/micronuclai.pt and ./src/model/__pycache__/models.cpython-311.pyc.
traceback
Traceback (most recent call last):
File ".../micronuclAI/./src/model/prediction2.py", line 152, in
main(args)
File ".../micronuclAI/./src/model/prediction2.py", line 100, in main
model = torch.load(args.model, map_location=args.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "user/.local/lib/python3.11/site-packages/torch/serialization.py", line 1025, in load
return _load(opened_zipfile,
^^^^^^^^^^^^^^^^^^^^^
File "user/.local/lib/python3.11/site-packages/torch/serialization.py", line 1446, in _load
result = unpickler.load()
^^^^^^^^^^^^^^^^
File "user/.local/lib/python3.11/site-packages/torch/serialization.py", line 1439, in find_class
return super().find_class(mod_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Can't get attribute 'MulticlassRegression' on <module 'models' from './micronuclAI/src/model/models.py'>
UPDATE
I found that renaming the micronuclAI class to MulticlassRegression. The authors probably renamed the class at the end, after creating the .pt file.
The authors fixed this error separately, but I ran into another issue on their new code, which I have mentioned in the issue on the repository.
本文标签:
版权声明:本文标题:python - Getting AttributeError: Can't get attribute 'MulticlassRegression' on <module 'm 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736605464a1945315.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论