将python升级到3.10后Huggingface令牌程序无法加载模
*args, protobuf)436 super().__init__(*args)-- 438 from .utils import sentencepiece_model_pb2 as model_pb2440 m = model_pb2.ModelProto()441 with open(self.original_tokenizer.vocab_file, rstrip=False) if isinstance(mask_token, in PreTrainedTokenizerBase._from_pretrained(cls, 复制 ---------------------------------------------------------------------------AttributeErrorTraceback (most recent call last)Cell In [3], *init_inputs, in PreTrainedTokenizerBase.from_pretrained(cls。
sep_token, bos_token, pretrained_model_name_or_path, **kwargs)638 else:639if tokenizer_class_py is not None:File ~/.local/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:1777。
in AutoTokenizer.from_pretrained(cls。
**kwargs)File ~/.local/lib/python3.10/site-packages/transformers/convert_slow_tokenizer.py:1162, lstrip=True,160sep_token=sep_token, **kwargs)139 def __init__(140self,157tokenizer_file=tokenizer_file, eos_token, in XLMRobertaTokenizerFast.__init__(self, pad_token, 1779pretrained_model_name_or_path, local_files_only, **kwargs) 1930 # Instantiate tokenizer. 1931 try:- 1932tokenizer = cls(*init_inputs,141vocab_file=None, *init_inputs, 1782use_auth_token=use_auth_token, tokenizer_class_fast = TOKENIZER_MAPPING[type(config)]636 if tokenizer_class_fast and (use_fast or tokenizer_class_py is None):-- 637return tokenizer_class_fast.from_pretrained(pretrained_model_name_or_path, *args)434 requires_backends(self, in PreTrainedTokenizerFast.__init__(self。
**kwargs) 1774else: 1775logger.info(floading file {file_path} from cache at {resolved_vocab_files[file_id]})- 1777 return cls._from_pretrained( 1778resolved_vocab_files。
**kwargs)635 tokenizer_class_py,162unk_token=unk_token, but normally only used by message factories.62 GeneratedProtocolMessageType = message_impl.GeneratedProtocolMessageTypeFile /usr/lib/python3/dist-packages/google/protobuf/internal/python_message.py:6966 import copyreg as copyreg68 # We use as to avoid name collisions with variables.--- 69 from google.protobuf.internal import containers70 from google.protobuf.internal import decoder71 from google.protobuf.internal import encoderFile /usr/lib/python3/dist-packages/google/protobuf/internal/containers.py:182177 collections.MutableMapping.register(MutableMapping)179 else:180 # In Python 3 we can just use MutableMapping directly, 1780init_configuration, rb) as f:File ~/.local/lib/python3.10/site-packages/transformers/utils/sentencepiece_model_pb2.py:2018 from google.protobuf import descriptor as _descriptor19 from google.protobuf import message as _message--- 20 from google.protobuf import reflection as _reflection21 from google.protobuf import symbol_database as _symbol_database24 # @@protoc_insertion_point(imports)File /usr/lib/python3/dist-packages/google/protobuf/reflection.py:5856 from google.protobuf.pyext import cpp_message as message_impl57 else:--- 58 from google.protobuf.internal import python_message as message_impl60 # The type of all Message classes.61 # Part of the public interface。
resolved_vocab_files, _commit_hash,163pad_token=pad_token,158bos_token=bos_token, 1784local_files_only=local_files_only, 1785_commit_hash=commit_hash, 1787 )File ~/.local/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:1932。
*inputs, pretrained_model_name_or_path,166)168self.vocab_file = vocab_file169self.can_save_slow_tokenizer = False if not self.vocab_file else TrueFile ~/.local/lib/python3.10/site-packages/transformers/tokenization_utils_fast.py:114, in convert_slow_tokenizer(transformer_tokenizer) 1154raise ValueError( 1155fAn instance of tokenizer class {tokenizer_class_name} cannot be converted in a Fast tokenizer instance. 1156 No converter was found. Currently available slow-fast convertors: 1157f {list(SLOW_TO_FAST_CONVERTERS.keys())} 1158) 1160 converter_class = SLOW_TO_FAST_CONVERTERS[tokenizer_class_name]- 1162 return converter_class(transformer_tokenizer).converted()File ~/.local/lib/python3.10/site-packages/transformers/convert_slow_tokenizer.py:438, unk_token,。
*inputs, 1786**kwargs, because it defines181 # __slots__.-- 182 MutableMapping = collections.MutableMapping185 class BaseContainer(object):187 Base container class.AttributeError: module collections has no attribute MutableMapping ,164mask_token=mask_token, (...)151 ):152# Mask token behave like a normal word,159eos_token=eos_token, str) else mask_token-- 155super().__init__(156vocab_file, line 21 # Tokenizer---- 2 tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)File ~/.local/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py:637, i.e. include the space before it153mask_token = AddedToken(mask_token, init_configuration, tokenizer_file, 1783cache_dir=cache_dir,161cls_token=cls_token。
cache_dir, in SpmConverter.__init__(self, **kwargs)111fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)112 elif slow_tokenizer is not None:113# We need to convert a slow tokenizer to build the backend-- 114fast_tokenizer = convert_slow_tokenizer(slow_tokenizer)115 elif self.slow_tokenizer_class is not None:116# We need to create and convert a slow tokenizer to build the backend117slow_tokenizer = self.slow_tokenizer_class(*args。
165**kwargs, mask_token, cls_token。
1781*init_inputs, use_auth_token, vocab_file。
pretrained_model_name_or_path, **init_kwargs) 1933 except OSError: 1934raise OSError( 1935Unable to load vocabulary from file. 1936Please check that the provided vocabulary is accessible and not corrupted. 1937)File ~/.local/lib/python3.10/site-packages/transformers/models/xlm_roberta/tokenization_xlm_roberta_fast.py:155。
评论列表