Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

cannot import name 'container_abcs' from 'torch._six' #1

Closed
petteriTeikari opened this issue Nov 18, 2021 · 2 comments
Closed

cannot import name 'container_abcs' from 'torch._six' #1

petteriTeikari opened this issue Nov 18, 2021 · 2 comments

Comments

@petteriTeikari
Copy link
Owner

petteriTeikari commented Nov 18, 2021

Getting the container_abcs error

See e.g. qubvel-org/segmentation_models.pytorch#424

When trying to evaluate pretrained model:

PROJ_PATH=/home/petteri/PycharmProjects/SSL_spectro
DATA_PATH=$PROJ_PATH/testdata_cats_and_dogs

OUT_PATH=$PROJ_PATH/exp_output/esvit_exp/swin/swin_tiny/bl_lr0.0005_gpu16_bs32_dense_multicrop_epoch300
CKPT_PATH=$PROJ_PATH/exp_output/esvit_exp/swin/swin_tiny/bl_lr0.0005_gpu16_bs32_dense_multicrop_epoch300/checkpoint.pth

python -m torch.distributed.launch --nproc_per_node=1 eval_linear.py --data_path $DATA_PATH --output_dir $OUT_PATH/lincls/epoch0300 --pretrained_weights $CKPT_PATH --checkpoint_key teacher --batch_size_per_gpu 256 --arch swin_tiny --cfg experiments/imagenet/swin/swin_tiny_patch4_window7_224.yaml --n_last_blocks 4 --num_labels 2 MODEL.NUM_CLASSES 0
Traceback (most recent call last):
  File "eval_linear.py", line 35, in <module>
    import models.vision_transformer as vits
  File "/home/petteri/PycharmProjects/SSL_spectro/esvit/models/__init__.py", line 9, in <module>
    from .cvt_v4_transformer import *
  File "/home/petteri/PycharmProjects/SSL_spectro/esvit/models/cvt_v4_transformer.py", line 7, in <module>
    from torch._six import container_abcs

ImportError: cannot import name 'container_abcs' from 'torch._six' (/home/petteri/PycharmProjects/SSL_spectro/ssl_spectro_venv/lib/python3.8/site-packages/torch/_six.py)


@petteriTeikari
Copy link
Owner Author

petteriTeikari commented Nov 18, 2021

Updated timm from timm==0.3.2 to timm==0.4.12 and still having the same issue
https://github.com/rwightman/pytorch-image-models/releases/tag/v0.4.12

@petteriTeikari
Copy link
Owner Author

image
NVIDIA/apex#1048 (comment)

# from torch._six import container_abcs
import collections.abc as container_abcs

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

No branches or pull requests

1 participant