Cannot load model
#1
by
andersgb1
- opened
I can't load the model on a freshly upgraded transformers. Am I doing it wrong?
The first variation looks like this:
>>> from transformers import pipeline
>>> pipe = pipeline("automatic-speech-recognition", model="mhenrichsen/hviske")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/pipelines/__init__.py", line 870, in pipeline
framework, model = infer_framework_load_model(
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/pipelines/base.py", line 282, in infer_framework_load_model
raise ValueError(
ValueError: Could not load model mhenrichsen/hviske with any of the following classes: (<class 'transformers.models.auto.modeling_auto.AutoModelForCTC'>, <class 'transformers.models.auto.modeling_auto.AutoModelForSpeechSeq2Seq'>, <class 'transformers.models.whisper.modeling_whisper.WhisperForConditionalGeneration'>). See the original errors:
while loading with AutoModelForCTC, an error is thrown:
Traceback (most recent call last):
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/pipelines/base.py", line 269, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 569, in from_pretrained
raise ValueError(
ValueError: Unrecognized configuration class <class 'transformers.models.whisper.configuration_whisper.WhisperConfig'> for this kind of AutoModel: AutoModelForCTC.
Model type should be one of Data2VecAudioConfig, HubertConfig, MCTCTConfig, SEWConfig, SEWDConfig, UniSpeechConfig, UniSpeechSatConfig, Wav2Vec2Config, Wav2Vec2ConformerConfig, WavLMConfig.
while loading with AutoModelForSpeechSeq2Seq, an error is thrown:
Traceback (most recent call last):
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/pipelines/base.py", line 269, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 566, in from_pretrained
return model_class.from_pretrained(
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3128, in from_pretrained
resolved_archive_file, sharded_metadata = get_checkpoint_shard_files(
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/utils/hub.py", line 1029, in get_checkpoint_shard_files
index = json.loads(f.read())
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
while loading with WhisperForConditionalGeneration, an error is thrown:
Traceback (most recent call last):
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/pipelines/base.py", line 269, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3128, in from_pretrained
resolved_archive_file, sharded_metadata = get_checkpoint_shard_files(
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/utils/hub.py", line 1029, in get_checkpoint_shard_files
index = json.loads(f.read())
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The second way gives JSON errors for both preprocessor and model:
>>> processor = AutoProcessor.from_pretrained("mhenrichsen/hviske")
Traceback (most recent call last):
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/image_processing_utils.py", line 362, in get_image_processor_dict
image_processor_dict = json.loads(text)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/models/auto/processing_auto.py", line 235, in from_pretrained
config_dict, _ = ImageProcessingMixin.get_image_processor_dict(pretrained_model_name_or_path, **kwargs)
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/image_processing_utils.py", line 365, in get_image_processor_dict
raise EnvironmentError(
OSError: It looks like the config file at '/home/[REDACTED]/.cache/huggingface/hub/models--mhenrichsen--hviske/snapshots/8ba076bccb13f36b6359921be2474d43059ce922/preprocessor_config.json' is not a valid JSON file.
>>> model = AutoModelForSpeechSeq2Seq.from_pretrained("mhenrichsen/hviske")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 566, in from_pretrained
return model_class.from_pretrained(
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3128, in from_pretrained
resolved_archive_file, sharded_metadata = get_checkpoint_shard_files(
File "/home/[REDACTED]/.local/lib/python3.10/site-packages/transformers/utils/hub.py", line 1029, in get_checkpoint_shard_files
index = json.loads(f.read())
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@mhenrichsen nice, thanks - looking forward to trying it out!