isl-org / lang-seg

Language-Driven Semantic Segmentation
MIT License
722 stars 91 forks source link

ImportError #24

Closed zimingzhong closed 2 years ago

zimingzhong commented 2 years ago

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 commented 2 years ago

same issue

Boyiliee commented 2 years ago

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!