AI4Finance-Foundation / FinGPT

FinGPT: Open-Source Financial Large Language Models! Revolutionize 🔥 We release the trained model on HuggingFace.
https://ai4finance.org
MIT License
13.48k stars 1.88k forks source link

执行 FinGPT v3 Series 的 Try your model 例子报错如下 #72

Open shineyGuang opened 1 year ago

shineyGuang commented 1 year ago

报错信息:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper_CUDA__index_select) 能请您给指点一下么?

maywind23 commented 12 months ago

Just feed all the data and model to the same device(e.g. cuda)

liangtongt commented 11 months ago

将第28行改成下面: device = torch.device("cuda:0") tokens = tokenizer(prompt, return_tensors='pt', padding=True, max_length=512).to(device)