英文:
A machine learning model that classifies dogs
问题
你好。
在部署到Streamlit时出现了问题。我按照视频中的步骤做了一样的事情,但是它显示有错误。
我编写了正确的代码,我使用了venv
,但出于某种原因它不起作用。
查看图片说明
我的GitHub个人资料显示了完整的问题。
英文:
#question
Hello.
There was a problem deploying to streamlit. I did the same as in the video but it says something wrong.
I wrote the code correctly, I used venv
. but for some reason it is not working.
enter image description here
My GitHub profile shows the problem in full.
答案1
得分: 0
我认为您之所以出现此错误,是因为Streamlit服务器没有GPU实例,所以请尝试在CPU而不是GPU(CUDA)上加载您的模型
使用这个:
device = torch.device("cpu")
英文:
I think you are getting this error because the server of Streamlit does not have GPU instances so try to load your model in CPU rather than GPU(CUDA)
use this:
device = torch.device("cpu")
答案2
得分: 0
在Kaggle或Google Colab笔记本中运行此代码。然后运行以下命令:!nvidia-smi
。
如果显示了CUDA,它将显示CUDA版本。并使用device = torch.device("cpu")
。
在训练模型时,使用model_0 = modelname().to("cuda")
。
英文:
Run the code in kaggle or google colab notebooks. Then run this !nvidia-smi
find you have cuda, it shows cuda version. and use device = torch.device("cpu")
.
When you training the model use model_0 = modelname().to("cuda")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论