诗歌sys_plattform标记不同的Mac平台

发布于 2025-02-10 05:21:33 字数 238 浏览 2 评论 0 原文

我正在尝试使用诗歌安装程序包在Mac上安装Pytorch,我想为不同平台指定不同的轮子文件。

Pytorch的车轮适用于Intel和ARM基Mac。看来我可以使用 Markers =“ sys_platform =='macoSx'” 指定英特尔平台。如何指定基于ARM的系统?

我也想知道 macOSX 标识符是否会选择两个平台?目前,我只能访问基于Intel的Mac进行测试。

I am trying to use the poetry install package for installing pytorch on mac and I want to specify different wheel files for different platforms.

Pytorch has wheels for intel and ARM based macs. It seems I can specify the intel platform using markers="sys_platform == 'macosx'". How can one specify the arm based system?

I also wonder if macosx identifier will select both the platforms? I only have access to intel based mac to do the tests at the moment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅此而已 2025-02-17 05:21:33

在最新诗歌1.3.1上测试的更新

,我现在成功地使用了此信息:

[tool.poetry.dependencies]
python = "3.10.x"
torch = "1.13.1"

诗歌选择了正确的版本。


原始答案

回答您的问题的

markers = "sys_platform == 'darwin' and platform_machine == 'arm64'"
markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'"

是,在这里是最终版本:

[tool.poetry.dependencies]
python = "3.10.x"
torch = [
  {markers = "sys_platform == 'darwin' and platform_machine == 'arm64'", url = "https://files.pythonhosted.org/packages/79/b3/eaea3fc35d0466b9dae1e3f9db08467939347b3aaa53c0fd81953032db33/torch-1.13.0-cp310-none-macosx_11_0_arm64.whl"},
  {markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", url = "https://files.pythonhosted.org/packages/b6/79/ead6840368f294497591af143980372ff956fc4c982c457a8b5610a5a1f3/torch-1.13.0-cp310-none-macosx_10_9_x86_64.whl"},
  {markers = "sys_platform == 'linux'", url="https://files.pythonhosted.org/packages/5c/61/b0303b8810c1300e75e8e665d043f6c2b272a4da60e9cc33416cde8edb76/torch-1.13.0-cp310-cp310-manylinux2014_aarch64.whl"}
]
  • ARM64 适用于带有M1/M2芯片的MacOS。 x86_64 适用于MacOS
    英特尔芯片。
  • 对于Linux,您还可以定义 platform_machine (如果使用)
    多个体系结构(在上面的演示中,它使用 aarch64 车轮)。

中找到所有车轮URL

您可以使用Python命令找到当前的平台和体系结构:

> python
>>> import sys
>>> sys.platform
'darwin'
>>> import platform
>>> platform.machine()
'arm64'

您可以在 sys.platform 的列表。

(希望将来对Pytorch的愿望诗很聪明,这样我们就不需要手动设置它们)

UPDATE

Tested on latest Poetry 1.3.1, I succeed simply using this now:

[tool.poetry.dependencies]
python = "3.10.x"
torch = "1.13.1"

Poetry picked right version.


Original Answer

To answer your question, it would be

markers = "sys_platform == 'darwin' and platform_machine == 'arm64'"
markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'"

Here is final version:

[tool.poetry.dependencies]
python = "3.10.x"
torch = [
  {markers = "sys_platform == 'darwin' and platform_machine == 'arm64'", url = "https://files.pythonhosted.org/packages/79/b3/eaea3fc35d0466b9dae1e3f9db08467939347b3aaa53c0fd81953032db33/torch-1.13.0-cp310-none-macosx_11_0_arm64.whl"},
  {markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", url = "https://files.pythonhosted.org/packages/b6/79/ead6840368f294497591af143980372ff956fc4c982c457a8b5610a5a1f3/torch-1.13.0-cp310-none-macosx_10_9_x86_64.whl"},
  {markers = "sys_platform == 'linux'", url="https://files.pythonhosted.org/packages/5c/61/b0303b8810c1300e75e8e665d043f6c2b272a4da60e9cc33416cde8edb76/torch-1.13.0-cp310-cp310-manylinux2014_aarch64.whl"}
]
  • arm64 is for macOS with M1/M2 chip. x86_64 is for macOS with
    Intel chip.
  • For Linux, you can also define platform_machine if you are using
    multiple architectures (In the demo above, it is using aarch64 wheel).

You can find all wheel URLs at either one of

You can find your current platform and architecture by using Python command:

> python
>>> import sys
>>> sys.platform
'darwin'
>>> import platform
>>> platform.machine()
'arm64'

You can find the list of sys.platform at here.

(Wish Poetry can be smarter for PyTorch in future so that we do not need manually set them)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文