> Cross-Platform cpu = [ "torch @ ; python_version == '3.12'", "torch @ ; python_version == '3.13'", ] :-/ It reminds me of Microsoft calling their thing "cross platform" because it works on several copies of Windows In all seriousness, I get the impression that pytorch is such a monster PITA to manage because it cares so much about the target hardware. It'd be like a blog post saying "I solved the assembly language…
How I solved PyTorch's cross-platform nightmare
11–20 of 30 posts
Re: How I solved PyTorch's cross-platform nightmare
#12> Setting up a Python project that relies on PyTorch, so that it works across different accelerators and operating systems, is a nightmare. I would like to add some anecdata to this. When I was a PhD student, I already had 12 years of using and administrating Linuxes as my personal OS, and I'd already had my share of package manager and dependency woes. But managing Python, PyTorch, and CUDA dependencies were relativ…
Re: How I solved PyTorch's cross-platform nightmare
#13Re: How I solved PyTorch's cross-platform nightmare
#14`pip install torchruntime`
`torchruntime install torch`
It figures out the correct torch to install on the user's PC, factoring in the OS (Win, Linux, Mac), the GPU vendor (NVIDIA, AMD, Intel) and the GPU model (especially for ROCm, whose configuration varies per generation and ROCm version).
And it tries to support quite a number of older GPUs as well, which are pinned to older versions of torch.
It's used by a few cross-platform torch-based consumer apps, running on quite a number of consumer installations.
Re: How I solved PyTorch's cross-platform nightmare
#15> Cross-Platform cpu = [ "torch @ ; python_version == '3.12'", "torch @ ; python_version == '3.13'", ] :-/ It reminds me of Microsoft calling their thing "cross platform" because it works on several copies of Windows In all seriousness, I get the impression that pytorch is such a monster PITA to manage because it cares so much about the target hardware. It'd be like a blog post saying "I solved the assembly language…
https://github.com/pypa/manylinux is for building cross-platform wheels.
So, you're doubling down on OP's misnomer of "cross platform means whatever platforms I use", eh?
Re: How I solved PyTorch's cross-platform nightmare
#16> Cross-Platform cpu = [ "torch @ ; python_version == '3.12'", "torch @ ; python_version == '3.13'", ] :-/ It reminds me of Microsoft calling their thing "cross platform" because it works on several copies of Windows In all seriousness, I get the impression that pytorch is such a monster PITA to manage because it cares so much about the target hardware. It'd be like a blog post saying "I solved the assembly language…
That is: there's nothing stopping the author from building on the approach he shares to also include Windows/FreeBSD/NetBSD/whatever.
It's his project (FileChat), and I would guess he uses Linux. It's natural that he'd solve this problem for the platforms he uses, and for which wheels are readily available.
Re: How I solved PyTorch's cross-platform nightmare
#17Re: How I solved PyTorch's cross-platform nightmare
#18> Cross-Platform cpu = [ "torch @ ; python_version == '3.12'", "torch @ ; python_version == '3.13'", ] :-/ It reminds me of Microsoft calling their thing "cross platform" because it works on several copies of Windows In all seriousness, I get the impression that pytorch is such a monster PITA to manage because it cares so much about the target hardware. It'd be like a blog post saying "I solved the assembly language…
Torch simply has to work this way because it cares about performance on a combination of multiple systems and dozens of GPUs. The complexity leaks into packaging. If you do not care about performance and would rather have portability, use an alternative like tinygrad that does not optimize for every accelerator under the sun. This need for hardware-specific optimization is also why the assembly language analogy is a…
Or, looked at a different way, Torch has to work this way because Python packaging has too narrow of an understanding of platforms which treats many things that are materially different platforms as the same platform.
Re: How I solved PyTorch's cross-platform nightmare
#19> Setting up a Python project that relies on PyTorch, so that it works across different accelerators and operating systems, is a nightmare. I would like to add some anecdata to this. When I was a PhD student, I already had 12 years of using and administrating Linuxes as my personal OS, and I'd already had my share of package manager and dependency woes. But managing Python, PyTorch, and CUDA dependencies were relativ…
Wake up, lynndotpy
Re: How I solved PyTorch's cross-platform nightmare
#20Earlier quoted context omitted.
https://github.com/pypa/manylinux is for building cross-platform wheels.
> Python wheels that work on any linux (almost) So, you're doubling down on OP's misnomer of "cross platform means whatever platforms I use", eh?
You should be specific about which distributions you have in mind.