Baichuan-13B
Baichuan-13B copied to clipboard
probability tensor contains either `inf`, `nan` or element < 0
有人碰到这个错吗?换了几个torch的版本也不行,应该跟版本环境没关系,求大佬们指点~~~
你有什么改动吗?
没有任何改动,直接运行cli_demo 或者 web_demo,都会报这个错
+1,直接copy huggingface的代码:https://huggingface.co/baichuan-inc/Baichuan-13B-Chat,报错一模一样
import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.generation.utils import GenerationConfig tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Chat", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True) model.generation_config = GenerationConfig.from_pretrained("baichuan-inc/Baichuan-13B-Chat") messages = [] messages.append({"role": "user", "content": "世界上第二高的山峰是哪座"}) response = model.chat(tokenizer, messages) print(response)
我这里也出现这样的问题
是不是有4块卡时才这样
解决了,多块GPU时,需要 os.environ['CUDA_VISIBLE_DEVICES'] = "0" 其它的编号都不行