I'm having an issue with the mistral-instruct model


KeyError Traceback (most recent call last)
Cell In[6], line 12
10 model_id = “mistralai/Mistral-7B-Instruct-v0.1”
11 # Load the model configuration
—> 12 config = AutoConfig.from_pretrained(model_id)
13 config.naive_attention_prefill = True
15 bnb_config = BitsAndBytesConfig(
16 load_in_4bit=True,
17 bnb_4bit_use_double_quant=True,
18 bnb_4bit_quant_type=“nf4”,
19 bnb_4bit_compute_dtype=torch.bfloat16
20 )

File /opt/conda/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:1041, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1039 return config_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
1040 elif “model_type” in config_dict:
→ 1041 config_class = CONFIG_MAPPING[config_dict[“model_type”]]
1042 return config_class.from_dict(config_dict, **unused_kwargs)
1043 else:
1044 # Fallback: use pattern matching on the string.
1045 # We go from longer names to shorter names to catch roberta before bert (for instance)

File /opt/conda/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:734, in _LazyConfigMapping.getitem(self, key)
732 return self._extra_content[key]
733 if key not in self._mapping:
→ 734 raise KeyError(key)
735 value = self._mapping[key]
736 module_name = model_type_to_module_name(key)

KeyError: ‘mistral’

1 Like

Installing transformers from source helps -

pip install --upgrade git+https://github.com/huggingface/transformers
1 Like

I have the same error but even installing transformers I get the same error

1 Like

same here, were you able to solve it??

I found this solve the issue:

pip install --upgrade transformers