Jingkang50 / OpenOOD

Benchmarking Generalized Out-of-Distribution Detection
MIT License
858 stars 108 forks source link

It seens that "torchvision=0.9.1" does not have VisionTransformer #201

Closed ZouXinn closed 8 months ago

ZouXinn commented 11 months ago

I create the conda environment according to the "environment.yml" file, and then run the command "sh scripts/basics/mnist/train_mnist.sh". However, an error "ModuleNotFoundError: No module named 'torchvision.models.vision_transformer'" occurs, which origins from the code "from torchvision.models.vision_transformer import VisionTransformer" in line 2 in vit_b_16.py.

I checked the codes in the file torchvision. models and found that there is no VisionTransformer. Then, I search in the official documents for torchvision and found that VisionTransformer is not implemented in the version v0.9.0. It seems that vision transformer first appears in the version v0.12 (I checked it version by version).

So I wonder that is there some issues in the "environment.yml" file ?

zjysteven commented 11 months ago

Again, please follow the README for dependencies. environment.yml was a legacy file in v1.0 (and we should have removed it in v1.5), sorry for the confusion. Meanwhile I believe the README is very helpful for these setup questions where we have provided the up-to-date instructions.

ZouXinn commented 11 months ago

What a stupid mistake I made! Thank you very much!