cswry / SeeSR

[CVPR2024] SeeSR: Towards Semantics-Aware Real-World Image Super-Resolution
Apache License 2.0
420 stars 27 forks source link

raise EnvironmentError( OSError: Can't load tokenizer for 'bert-base-uncased' #34

Open windcr opened 6 months ago

windcr commented 6 months ago

SeeSR-main/test_seesr.py", line 125, in load_tag_model model = ram(pretrained='preset/models/ram_swin_large_14m.pth',

SeeSR-main/ram/models/ram_lora.py", line 319, in ram model = RAMLora(**kwargs)

SeeSR-main/ram/models/ram_lora.py", line 107, in init self.tokenizer = init_tokenizer()

SeeSR-main/ram/models/utils.py", line 131, in init_tokenizer tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

python3.10/site-packages/transformers/tokenization_utils_base.py", line 1785, in from_pretrained raise EnvironmentError( OSError: Can't load tokenizer for 'bert-base-uncased'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'bert-base-uncased' is the correct path to a directory containing all relevant files for a BertTokenizer tokenizer.

我下载了整个bert-base-uncased目录中的所有文件和ram_swin_large_14m.pth,但一直报这个错!不知道是什么问题

Shengqi77 commented 6 months ago

same problem

Fangzhenxuan commented 5 months ago

same problem

ConanMusk commented 4 months ago

请问您解决了吗 是如何解决的

Renzhihan commented 4 months ago

same problem

cswry commented 4 months ago

Maybe the answer can be found here

Renzhihan commented 4 months ago

@windcr @Shengqi77 @ConanMusk @Fangzhenxuan Hi, we should download the pre-trained model in this link 'https://huggingface.co/spaces/xinyu1205/recognize-anything/blob/main/ram_swin_large_14m.pth', and move it to the path 'preset/models/ram_swin_large_14m.pth'. Then download this link 'https://huggingface.co/google-bert/bert-base-uncased', and replace the path of 'tokenizer = BertTokenizer.from_pretrained('preset/models/bert-base-uncased/')' in line 131 of ram/models/utils.py. It works for me. I hope it can help you.