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

ImportError #24

Closed
zimingzhong opened this issue Aug 9, 2022 · 2 comments
Closed

ImportError #24

zimingzhong opened this issue Aug 9, 2022 · 2 comments

Comments

@zimingzhong
Copy link

zimingzhong commented Aug 9, 2022

I try to run a zero-shot demo. I compiler and install torch-encoding in gcc7.5.

(lang-seg) [zhongzm@ai_gpu28 lang-seg]$ python -u test_lseg_zs.py --backbone clip_resnet101 --module clipseg_DPT_test_v2 --dataset fss \
> --widehead --no-scaleinv --arch_option 0 --ignore_index 255 --fold 0 --nshot 0 \
> --weights checkpoints/fss_l16.ckpt 
Traceback (most recent call last):
  File "test_lseg_zs.py", line 8, in <module>
    from modules.lseg_module_zs import LSegModuleZS
  File "/public/home/zhongzm/project/lang-seg/modules/lseg_module_zs.py", line 7, in <module>
    from .lsegmentation_module_zs import LSegmentationModuleZS
  File "/public/home/zhongzm/project/lang-seg/modules/lsegmentation_module_zs.py", line 13, in <module>
    from encoding.models import get_segmentation_model
  File "/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/__init__.py", line 13, in <module>
    from . import nn, functions, parallel, utils, models, datasets, transforms
  File "/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/nn/__init__.py", line 12, in <module>
    from .encoding import *
  File "/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/nn/encoding.py", line 18, in <module>
    from ..functions import scaled_l2, aggregate, pairwise_cosine
  File "/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/functions/__init__.py", line 2, in <module>
    from .encoding import *
  File "/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/functions/encoding.py", line 15, in <module>
    from encoding import cpu
ImportError: /public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/cpu.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c106detail14torchCheckFailEPKcS2_jS2_

And I try to reinstall the env then get this error.

 File "/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/functions/encoding.py", line 17, in <module>
    from encoding import gpu
ImportError: cannot import name 'gpu' from partially initialized module 'encoding' (most likely due to a circular import) (/public/home/zhongzm/anaconda3/envs/lang-seg/lib/python3.8/site-packages/encoding/__init__.py)```
@HirojiFukuyama
Copy link

same issue

@Boyiliee
Copy link
Collaborator

Hi, @zimingzhong @HirojiFukuyama ,

A possible reason could be that you've installed an older version of this package. Please try option2 to see if this still exists.

If yes, please check this similar issue or other solutions for the version issue.

Hope this helps!

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

3 participants