ViLT icon indicating copy to clipboard operation
ViLT copied to clipboard

cannot import name 'Final' from 'typing'

Open lijiabad opened this issue 1 year ago • 2 comments

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

lijiabad avatar May 06 '23 03:05 lijiabad

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."

2223xia avatar May 07 '23 12:05 2223xia

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

JackieQiang avatar Feb 19 '24 14:02 JackieQiang