如何通过诗歌安装最新的Pytorch预览(夜间)构建
最新的预览构建支持在M1 MacBook Pros上进行了加速培训。目前,此功能仅由最新的预览(夜间)构建支持:
要开始,只需安装最新预览(夜间) 您的Apple Silicon Mac运行MacOS 12.3或更高版本 Python的版本(ARM64)。
根据文档,这就是如何通过 pip
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
但是我正在使用诗歌来管理我的Python项目依赖项。
诗歌似乎并不支持 - pre
选项:
$ poetry add --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
Stack trace:
11 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/console_application.py:123 in run
io = io_factory(
10 ~/.poetry/lib/poetry/console/config/application_config.py:221 in create_io
resolved_command = application.resolve_command(args)
9 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/console_application.py:110 in resolve_command
return self._config.command_resolver.resolve(args, self)
8 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/resolver/default_resolver.py:34 in resolve
return self.create_resolved_command(result)
7 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/resolver/default_resolver.py:166 in create_resolved_command
if not result.is_parsable():
6 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/resolver/resolve_result.py:43 in is_parsable
self._parse()
5 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/resolver/resolve_result.py:49 in _parse
self._parsed_args = self._command.parse(self._raw_args)
4 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/api/command/command.py:113 in parse
return self._config.args_parser.parse(args, self._args_format, lenient)
3 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/args/default_args_parser.py:53 in parse
self._parse(args, _fmt, lenient)
2 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/args/default_args_parser.py:101 in _parse
self._parse_long_option(token, tokens, fmt, lenient)
1 ~/.poetry/lib/poetry/_vendor/py3.9/clikit/args/default_args_parser.py:247 in _parse_long_option
self._add_long_option(name, None, tokens, fmt, lenient)
NoSuchOptionException
The "--pre" option does not exist.
at ~/.poetry/lib/poetry/_vendor/py3.9/clikit/args/default_args_parser.py:300 in _add_long_option
296│ def _add_long_option(
297│ self, name, value, tokens, fmt, lenient
298│ ): # type: (str, Optional[str], List[str], ArgsFormat, bool) -> None
299│ if not fmt.has_option(name):
→ 300│ raise NoSuchOptionException(name)
301│
302│ option = fmt.get_option(name)
303│
304│ if value is False:
如何使用诗歌添加最新的预览(每晚)Pytorch的构建?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的
pip
命令的诗相等:然后:
第一个命令添加了包装的新源URL(默认情况下,只有PYPI),
explicit> explicit
优先级表示如果未在使用诗歌添加
时明确指定源头,则使用PYPI。第二个命令从指定的源添加torch
和torchvision
。但是,由于依赖性解决问题,我无法通过这种平均每晚安装Pytorch。
有第二个解决方案,但是它要求您手动为建筑和环境选择分配的轮子。
首先,请访问并找到近期匹配您的架构和环境的车轮。例如,如果您在Apple Silicon上使用Python 3.10,则将是
torch-2.1.0.dev20230417-CP310-NONE-MACOSX_11_11_0_ARM64.WHL
。注意CP310
,MACOSX
和ARM64
零件。完成第一步后,请重复使用Torchvision。然后,您可以使用
诗歌添加
添加这些依赖项:或直接在
pyproject.toml
中:The Poetry equivalent of your
pip
command would be:And then:
The first command adds a new source URL for packages (by default there is only PyPI) with the
explicit
priority which means that PyPI is used if no source is specified explicitly while usingpoetry add
. The second command addstorch
andtorchvision
from the specified source.However, I was not able to install PyTorch nightly by this mean because of dependency resolution issues.
There is a second solution, but it requires you to manually select the appropriated wheel for your architecture and environment.
First, visit https://download.pytorch.org/whl/nightly/torch/ and find a recent wheel matching your architecture and environment. For instance, if you are using Python 3.10 on apple silicon, this would be
torch-2.1.0.dev20230417-cp310-none-macosx_11_0_arm64.whl
. Notice thecp310
,macosx
andarm64
parts.When you are done with this first step, repeat it for TorchVision. You can then add those dependencies with
poetry add
:or directly in
pyproject.toml
:我通过在 https://docs.conda.io.io.io.io.io.io /en/latest/miniconda.html (M1 64位)
I got it working by installing minicoda for m1 arm at https://docs.conda.io/en/latest/miniconda.html (M1 64 bit)