Text Generation
Transformers
PyTorch
Chinese
bloom
text-generation-inference
Inference Endpoints

请问加载完模型之后,具体怎么传入数据进行推理?

#5
by moon502 - opened

TypeError: The current model class (BloomModel) is not compatible with .generate(), as it doesn't have a language model head. Please use one of the following classes instead: {'BloomForCausalLM'}

使用方式请参见Model card的说明,不是使用BloomModel加载

xyz-nlp changed discussion status to closed

就是使用 transformers库的AutoTokenizer和AutoModel进行加载的,print("开始加载模型")
tokenizer = AutoTokenizer.from_pretrained("/pfs/base_models/XuanYuan2.0", trust_remote_code=True)
model = AutoModel.from_pretrained("/pfs/base_models/XuanYuan2.0",trust_remote_code=True,device_map="auto")
model = model.eval()

请按照Model card的说明来写 input= '<s>Human: ' + query + '\n\nAssistant: ' 不要在前面添加额外的内容

您好,还是不行继续报这个错误The current model class (BloomModel) is not compatible with .generate(), as it doesn't have a language model head. Please use one of the following classes instead: {'BloomForCausalLM'}, 我是采用的8xA100 40G的显卡加载的模型,一部分加载到显存中一部分加载到内存中了

使用方式请参见Model card的说明,不是使用BloomModel加载

BloomModel是没有generate方法的 且40G显卡没有经过测试

已经解决了,之前采用的transformers 版本为 4.28.1最后通过安装transformers ==4.30.0.dev0 成功加载模型 ;采用的AutoModelForCausalLM

Sign up or log in to comment