'HF_ENDPOINT'== 'https://hf-mirror.com'
from transformers import BertTokenizer
model_name = 'bert-large-uncased' # If possible, use "bert-large-uncased"
tokenizer = BertTokenizer.from_pretrained(model_name)#加载特定的预训练模型tokenizer
还是报错---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Cell In[7], line 4
2 from transformers import BertTokenizer
3 model_name = 'bert-large-uncased' # If possible, use "bert-large-uncased"
----> 4 tokenizer = BertTokenizer.from_pretrained(model_name)#加载特定的预训练模型tokenizer
File /opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:2200, in PreTrainedTokenizerBase.from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, trust_remote_code, *init_inputs, **kwargs)
2197 # If one passes a GGUF file path to `gguf_file` there is no need for this check as the tokenizer will be
2198 # loaded directly from the GGUF file.
2199 if all(full_file_name is None for full_file_name in resolved_vocab_files.values()) and not gguf_file:
-> 2200 raise EnvironmentError(
2201 f"Can't load tokenizer for '{pretrained_model_name_or_path}'. If you were trying to load it from "
2202 "'https://huggingface.co/models style="color:rgb(175,0,0)">', make sure you don't have a local directory with the same name. "
2203 f"Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory "
2204 f"containing all relevant files for a {cls.__name__} tokenizer."
2205 )
2207 for file_id, file_path in vocab_files.items():
2208 if file_id not in resolved_vocab_files:
OSError: Can't load tokenizer for 'bert-large-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-large-uncased' is the correct path to a directory containing all relevant files for a BertTokenizer tokenizer.
|