英文:
"The model 'MPTForCausalLM' is not supported for text-generation"- The following warning is coming when trying to use MPT-7B instruct
问题
I am using a VM of GCP(e2-highmem-4 (Efficient Instance, 4 vCPUs, 32 GB RAM)) to load the model and use it. Here is the code I have written-
import torch
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import transformers
config = transformers.AutoConfig.from_pretrained(
'mosaicml/mpt-7b-instruct',
trust_remote_code=True,
)
# config.attn_config['attn_impl'] = 'flash'
model = transformers.AutoModelForCausalLM.from_pretrained(
'mosaicml/mpt-7b-instruct',
config=config,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
cache_dir="./cache"
)
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b", cache_dir="./cache")
text_gen = pipeline("text-generation", model=model, tokenizer=tokenizer)
text_gen(text_inputs="what is 2+2?")
Now the code is taking way too long to generate the text. Am I doing something wrong? or is there any way to make things faster?
Also, when creating the pipeline, I am getting the following warning-
The model 'MPTForCausalLM' is not supported for text-generation
I tried generating text by using it but it was stuck for a long time.
英文:
I am using a VM of GCP(e2-highmem-4 (Efficient Instance, 4 vCPUs, 32 GB RAM)) to load the model and use it. Here is the code I have written-
import torch
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import transformers
config = transformers.AutoConfig.from_pretrained(
'mosaicml/mpt-7b-instruct',
trust_remote_code=True,
)
# config.attn_config['attn_impl'] = 'flash'
model = transformers.AutoModelForCausalLM.from_pretrained(
'mosaicml/mpt-7b-instruct',
config=config,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
cache_dir="./cache"
)
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b", cache_dir="./cache")
text_gen = pipeline("text-generation", model=model, tokenizer=tokenizer)
text_gen(text_inputs="what is 2+2?")
Now the code is taking way too long to generate the text. Am I doing something wrong? or is there any way to make things faster?
Also, when creating the pipeline, I am getting the following warning-\
The model 'MPTForCausalLM' is not supported for text-generation
I tried generating text by using it but it was stuck for a long time.
答案1
得分: 1
你可以尝试使用GPU实例,因为尝试在CPU上使用像这样的大型LLMS几乎是没有希望的。
不管怎样,我也遇到了“模型 'MPTForCausalLM' 不支持文本生成”的问题,这就是我来到这个帖子的原因。尽管有警告,文本生成对我来说确实有效。
英文:
You might want to try a GPU instances, because trying to use bigger LLMS like this with CPUs is pretty much a lost cause now.
Anyhow, I also got that "The model 'MPTForCausalLM' is not supported for text-generation" Which is why I ended up in this thread. Text Generation did work for me despite the warning.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论