Error unhashable type: 'dict with AutoProcessor.from_pretrained

#1
by Isabala - opened

Hello everybody,

I'm facing an issue when I try to load the pretrained processor "AutoProcessor.from_pretrained". I downloaded all files locally on my computer and I'm trying to use the code as suggested by huggingface:

from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
my_path = 'D:/data/whisper_model'

model = AutoModelForSpeechSeq2Seq.from_pretrained(my_path)
processor = AutoProcessor.from_pretrained(my_path)

The model works well but the processor give me an error:

6 process = AutoProcessor.from_pretrained(path_model)
7 model =AutoModelForSpeechSeq2Seq.from_pretrained(path_model)

File D:\programs\Anaconda3\envs\venv_speech\lib\site-packages\transformers\models\auto\processing_auto.py:292, in AutoProcessor.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
288 return processor_class.from_pretrained(
289 pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
290 )
291 elif processor_class is not None:
--> 292 return processor_class.from_pretrained(
293 pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
294 )
295 # Last try: we use the PROCESSOR_MAPPING.
296 elif type(config) in PROCESSOR_MAPPING:

File D:\programs\Anaconda3\envs\venv_speech\lib\site-packages\transformers\processing_utils.py:228, in ProcessorMixin.from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, **kwargs)
225 if token is not None:
226 kwargs["token"] = token
--> 228 args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)
229 return cls(*args)

File D:\programs\Anaconda3\envs\venv_speech\lib\site-packages\transformers\processing_utils.py:272, in ProcessorMixin._get_arguments_from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
269 else:
270 attribute_class = getattr(transformers_module, class_name)
--> 272 args.append(attribute_class.from_pretrained(pretrained_model_name_or_path, **kwargs))
273 return args

File D:\programs\Anaconda3\envs\venv_speech\lib\site-packages\transformers\tokenization_utils_base.py:2024, in PreTrainedTokenizerBase.from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, *init_inputs, **kwargs)
2021 else:
2022 logger.info(f"loading file {file_path} from cache at {resolved_vocab_files[file_id]}")
-> 2024 return cls._from_pretrained(
2025 resolved_vocab_files,
2026 pretrained_model_name_or_path,
2027 init_configuration,
2028 *init_inputs,
2029 token=token,
2030 cache_dir=cache_dir,
2031 local_files_only=local_files_only,
2032 _commit_hash=commit_hash,
2033 _is_local=is_local,
2034 **kwargs,
2035 )

File D:\programs\Anaconda3\envs\venv_speech\lib\site-packages\transformers\tokenization_utils_base.py:2249, in PreTrainedTokenizerBase._from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, token, cache_dir, local_files_only, _commit_hash, _is_local, *init_inputs, **kwargs)
2247 if added_tokens_map != {} and init_kwargs[key] is not None:
2248 if key != "additional_special_tokens":
-> 2249 init_kwargs[key] = added_tokens_map.get(init_kwargs[key], init_kwargs[key])
2251 init_kwargs["added_tokens_decoder"] = added_tokens_decoder
2252 # convert {'__type': 'AddedToken', 'content': '', 'lstrip': False, 'normalized': True, ...} to AddedTokens

TypeError: unhashable type: 'dict'

Hi @Isabala , I don't have a Windows system. Have you succeeded in loading other models with this code?

Sign up or log in to comment