Unable to load model, error
KeyError Traceback (most recent call last)
/tmp/ipykernel_1050494/2718782402.py in
2 tokenizer = AutoTokenizer.from_pretrained(checkpoint,use_auth_token=True)
3 # to save memory consider using fp16 or bf16 by specifying torch.dtype=torch.float16 for example
----> 4 model = AutoModelForCausalLM.from_pretrained(checkpoint,use_auth_token=True).to(device)
~/anaconda3/envs/verilog_gpt/lib/python3.9/site-packages/transformers/models/auto/auto_factory.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
421 kwargs["_from_auto"] = True
422 if not isinstance(config, PretrainedConfig):
--> 423 config, kwargs = AutoConfig.from_pretrained(
424 pretrained_model_name_or_path, return_unused_kwargs=True, trust_remote_code=trust_remote_code, **kwargs
425 )
~/anaconda3/envs/verilog_gpt/lib/python3.9/site-packages/transformers/models/auto/configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
743 return config_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
744 elif "model_type" in config_dict:
--> 745 config_class = CONFIG_MAPPING[config_dict["model_type"]]
746 return config_class.from_dict(config_dict, **kwargs)
747 else:
~/anaconda3/envs/verilog_gpt/lib/python3.9/site-packages/transformers/models/auto/configuration_auto.py in getitem(self, key)
450 return self._extra_content[key]
451 if key not in self._mapping:
--> 452 raise KeyError(key)
453 value = self._mapping[key]
454 module_name = model_type_to_module_name(key)
KeyError: 'gpt_bigcode'
I am receiving the same error.
8 tokenizer = AutoTokenizer.from_pretrained(checkpoint)
----> 9 model = AutoModelForCausalLM.from_pretrained(checkpoint)#.to(device)
File ~/mambaforge/envs/llm/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:441, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
438 if kwargs_copy.get("torch_dtype", None) == "auto":
439 _ = kwargs_copy.pop("torch_dtype")
--> 441 config, kwargs = AutoConfig.from_pretrained(
442 pretrained_model_name_or_path,
443 return_unused_kwargs=True,
444 trust_remote_code=trust_remote_code,
445 **hub_kwargs,
446 **kwargs_copy,
447 )
448 if hasattr(config, "auto_map") and cls.__name__ in config.auto_map:
449 if not trust_remote_code:
File ~/mambaforge/envs/llm/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:911, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
909 return config_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
910 elif "model_type" in config_dict:
--> 911 config_class = CONFIG_MAPPING[config_dict["model_type"]]
912 return config_class.from_dict(config_dict, **unused_kwargs)
913 else:
914 # Fallback: use pattern matching on the string.
915 # We go from longer names to shorter names to catch roberta before bert (for instance)
File ~/mambaforge/envs/llm/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:617, in _LazyConfigMapping.__getitem__(self, key)
615 return self._extra_content[key]
616 if key not in self._mapping:
--> 617 raise KeyError(key)
618 value = self._mapping[key]
619 module_name = model_type_to_module_name(key)
KeyError: 'gpt_bigcode'
Install the latest version of transformers
(should be 4.28.1): https://huggingface.co/docs/transformers/installation
e.g. conda install -c huggingface transformers
installs 4.28.1 instead of 4.24.0 with conda install transformers
I have the latest version (transformers-4.29.0.dev0) of transformer installed from source
pip install git+https://github.com/huggingface/transformers
Its loading now, there was a conflicting lower version of transformer on my machine
It's loading now, there was a conflicting lower version of the transformer on my machine.
It's loading now, there was a conflicting lower version of the transformer on my machine.