有没有办法可以在 Azure 部署上安装 pip 库中没有的 pytorch 版本?

问题描述 投票:0回答:1

我有一个一度使用 pytorch 的 Flask 应用程序。 然而,我似乎无法成功部署它,因为 pytorch 版本只能从 URL 进行 pip 安装

我在此处找到的唯一启用了 Cuda 的 pytorch 版本似乎可以与我的 python 版本 3.12 配合使用:https://stackoverflow.com/a/77597368/24421235 并下载: pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118

这意味着我的应用程序在本地工作完全正常,但是当尝试使用requirements.txt部署我的Web应用程序时,azure尝试安装的版本不存在

attempting local pip install of the version shown by pip requirements still gives error

有办法解决这个问题吗?

github 仓库 https://github.com/jamiemitch121/Flask_Image_Creation_Site

python azure pip pytorch requirements.txt
1个回答
0
投票

应该不需要使用 cuda 11.8 和 python 3.12 的预发布夜间版本,至少在 https://download.pytorch.org/whl/cu118 中似乎有适用于 python 3.12 的安装候选版本。您可以直接在requirements.txt中指定索引url来搜索包。

您可以像这样制作您的requirements.txt:

--index-url https://download.pytorch.org/whl/cu118
--extra-index-url=https://pypi.org/simple
torch
torchvision
torchaudio
<other packages>
© www.soinside.com 2019 - 2024. All rights reserved.