dandelin / ViLT

Code for the ICML 2021 (long talk) paper: "ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision"
Apache License 2.0
1.36k stars 209 forks source link

cannot import name 'Final' from 'typing' #83

Open lijiabad opened 1 year ago

lijiabad commented 1 year ago

when I run demo.py it showed "ImportError: cannot import name 'Final' from 'typing' (/home/jsj616/miniconda3/envs/vilt/lib/python3.7/typing.py)" my environment is ipython 7.34.0 pypi_0 pypi python 3.7.16 h7a1cb2a_0 defaults other configuration is same as the document.I cant figure it out

2223xia commented 1 year ago

you can find the 'beit.py' and 'eva.py', using:'from typing_extensions import Final from typing import Callable, Optional, Tuple, Union' instead of 'from typing import Callable, Final, Optional, Tuple, Union'. But it still showed "WARNING - ViLT - No observers have been added to this run INFO - ViLT - Running command 'main' INFO - ViLT - Started ERROR - ViLT - Failed after 0:00:10! Traceback (most recent calls WITHOUT Sacred internals): File "demo.py", line 36, in main tokenizer = get_pretrained_tokenizer(_config["tokenizer"]) File "E:\ViLT-master\ViLT-master\vilt\datamodules\datamodule_base.py", line 20, in get_pretrained_tokenizer from_pretrained, do_lower_case="uncased" in from_pretrained File "E:\Anaconda\envs\my_vilt\lib\site-packages\transformers\tokenization_utils_base.py", line 1745, in from_pretrained use_auth_token=use_auth_token, File "E:\Anaconda\envs\my_vilt\lib\site-packages\transformers\file_utils.py", line 1056, in cached_path local_files_only=local_files_only, File "E:\Anaconda\envs\my_vilt\lib\site-packages\transformers\file_utils.py", line 1235, in get_from_cache "Connection error, and we cannot find the requested files in the cached path." ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on."

JackieQiang commented 6 months ago

you can find the 'beit.py' and 'eva.py', using:'from typing_extensions import Final from typing import Callable, Optional, Tuple, Union' instead of 'from typing import Callable, Final, Optional, Tuple, Union'. But it still showed "WARNING - ViLT - No observers have been added to this run INFO - ViLT - Running command 'main' INFO - ViLT - Started ERROR - ViLT - Failed after 0:00:10! Traceback (most recent calls WITHOUT Sacred internals): File "demo.py", line 36, in main tokenizer = get_pretrained_tokenizer(_config["tokenizer"]) File "E:\ViLT-master\ViLT-master\vilt\datamodules\datamodule_base.py", line 20, in get_pretrained_tokenizer from_pretrained, do_lower_case="uncased" in from_pretrained File "E:\Anaconda\envs\my_vilt\lib\site-packages\transformers\tokenization_utils_base.py", line 1745, in from_pretrained use_auth_token=use_auth_token, File "E:\Anaconda\envs\my_vilt\lib\site-packages\transformers\file_utils.py", line 1056, in cached_path local_files_only=local_files_only, File "E:\Anaconda\envs\my_vilt\lib\site-packages\transformers\file_utils.py", line 1235, in get_from_cache "Connection error, and we cannot find the requested files in the cached path." ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on."

same problem