"MPTForCausalLM not supported" error when using pipeline, but not when using from_pretrained
invoking generator = transformers.pipeline(task="text-generation", model="mosaicml/mpt-7b", trust_remote_code=True)
ends with this exception:
You are using config.init_device='cpu', but you can also use config.init_device="meta" with Composer + FSDP for fast initialization.
Loading checkpoint shards: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 2/2 [00:05<00:00, 2.73s/it]
Xformers is not installed correctly. If you want to use memory_efficient_attention to accelerate training use the following command to install Xformers
pip install xformers.
The model 'MPTForCausalLM' is not supported for text-generation. Supported models are ['BartForCausalLM', 'BertLMHeadModel', 'BertGenerationDecoder', 'BigBirdForCausalLM', 'BigBirdPegasusForCausalLM', 'BioGptForCausalLM', 'BlenderbotForCausalLM', 'BlenderbotSmallForCausalLM', 'BloomForCausalLM', 'CamembertForCausalLM', 'CodeGenForCausalLM', 'CpmAntForCausalLM', 'CTRLLMHeadModel', 'Data2VecTextForCausalLM', 'ElectraForCausalLM', 'ErnieForCausalLM', 'GitForCausalLM', 'GPT2LMHeadModel', 'GPT2LMHeadModel', 'GPTBigCodeForCausalLM', 'GPTNeoForCausalLM', 'GPTNeoXForCausalLM', 'GPTNeoXJapaneseForCausalLM', 'GPTJForCausalLM', 'LlamaForCausalLM', 'MarianForCausalLM', 'MBartForCausalLM', 'MegaForCausalLM', 'MegatronBertForCausalLM', 'MvpForCausalLM', 'OpenLlamaForCausalLM', 'OpenAIGPTLMHeadModel', 'OPTForCausalLM', 'PegasusForCausalLM', 'PLBartForCausalLM', 'ProphetNetForCausalLM', 'QDQBertLMHeadModel', 'ReformerModelWithLMHead', 'RemBertForCausalLM', 'RobertaForCausalLM', 'RobertaPreLayerNormForCausalLM', 'RoCBertForCausalLM', 'RoFormerForCausalLM', 'RwkvForCausalLM', 'Speech2Text2ForCausalLM', 'TransfoXLLMHeadModel', 'TrOCRForCausalLM', 'XGLMForCausalLM', 'XLMWithLMHeadModel', 'XLMProphetNetForCausalLM', 'XLMRobertaForCausalLM', 'XLMRobertaXLForCausalLM', 'XLNetLMHeadModel', 'XmodForCausalLM'].
However, loading using:
model = transformers.AutoModelForCausalLM.from_pretrained(
'mosaicml/mpt-7b',
trust_remote_code=True
)
works fine.
How can I load this model in a pipeline
?
response from HF staff:
-- the auto_map attribute in the config.json file is not properly set https://github.com/huggingface/transformers/issues/24471#issuecomment-1606549042
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examples
folder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
generator = transformers.pipeline(task="text-generation", model="mosaicml/mpt-7b", trust_remote_code=True)
Expected behavior
The pipeline would load OK, just as .from_pretrained works
System Info
Python 3.8.10 (default, Nov 14 2022, 12:59:47)
transformers.version is '4.30.2'
lambda labs 1xA100
Still facing the same issue!
I have the same issue. I'm trying to log the model and register the model in Databricks.
Have you tried the pipeline usage example at the bottom of our model card (https://huggingface.co/mosaicml/mpt-7b)? It is working for me, even though it does print out the message about mpt not being a supported model.
Does anyone know how to hide the warning message 'The model 'MPTForCausalLM' is not supported for text-generation.' ?
Still getting this error as well! transformers==4.33.1, mlflow==2.7.1
This is just a warning and should not cause issues.