Skip to content

Installers: do not install generic aarch64 CUDA torch on Jetson before CUDA 13 - #14363

Merged
danielhanchen merged 11 commits into
mainfrom
installers-jetson-tegra-torch
Oct 20, 2026
Merged

danielhanchen merged 11 commits into
mainfrom
installers-jetson-tegra-torch

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

On Jetson (Tegra) with JetPack 5 or 6, the aarch64 CUDA wheels on download.pytorch.org and PyPI are SBSA server builds that do not see the GPU, so installs ended with torch.cuda.is_available() == False (#4856). The installers now detect Tegra and, below CUDA 13, take the same CPU index a GPU-less host gets, with a warning that explains the CPU-only limit and NVIDIA's JetPack PyTorch route.

What changes

  • install.sh get_torch_index_url: Tegra is detected via /etc/nv_tegra_release or nvidia,tegra in /proc/device-tree/compatible (the convention in studio/backend/utils/tegra.py). On Tegra with CUDA below 13, or an unreadable version, the CPU index is selected and NVIDIA's Jetson PyTorch route is printed (https://docs.nvidia.com/deeplearning/frameworks/install-pytorch-jetson-platform/). The cu126 default for an unreadable version is unchanged everywhere else.
  • studio/install_python_stack.py _detect_cuda_torch_index_family: the same gate, so studio update no longer replaces a Jetson's torch with the SBSA cu126 wheel. A JetPack torch already in the venv is kept.
  • The CPU wheel note at the end of install.sh keeps the Jetson diagnosis (not "No GPU detected" plus AMD guidance) on the same CUDA-below-13 rule, so a Thor on CUDA 13 is not told it is a Jetson CPU case.
  • The messages say training runs on the CPU, and that a JetPack torch is kept only when it is built for the venv's Python (NVIDIA's own wheels target JetPack's system Python).
  • Studio's _expected_cpu_flavor_was_chosen() treats an automatic cpu record on a Jetson as chosen, so the UI does not offer a GPU repair that would only reinstall cpu.
  • UNSLOTH_TORCH_INDEX_URL / UNSLOTH_TORCH_INDEX_FAMILY still win over everything.

Hosts affected

  • Jetson Orin / Xavier on JetPack 5 and 6: CPU torch plus a warning, instead of a GPU-blind CUDA wheel.
  • Unchanged: Jetson Thor (CUDA 13, JetPack 7, SBSA), GH200, GB200, DGX Spark, every x86 host, and every pinned install.

Tests

  • tests/studio/install/test_jetson_tegra_torch_route_4856.py: extracted install.sh functions against a fake host root (release file, device tree, fake nvidia-smi), plus mocked install_python_stack family and repair cells. Covers JetPack 5/6, Thor, pins, no GPU, GH200, SBSA aarch64 and x86. 15 cells fail on main, all 43 pass here.
  • Cells: install.sh index 15 (10 identical, 5 Tegra below CUDA 13 changed to cpu); Python family 12 (8 identical, 4 changed); repair 4 (3 identical, 1 changed: no SBSA repair on a Jetson).
  • Related installer suites (1803 tests) and tests/sh/test_get_torch_index_url.sh (109 checks): identical results before and after.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T17:30:43.236136Z 3033c1d Manual request
🔒 Security Review ✅ Completed 2026-10-20T14:40:30.700255Z 03e82d9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 03e82d9d99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 03e82d9d99

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Oct 20, 2026
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Oct 20, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: dad1dc83f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Oct 20, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

…fit the venv; a Jetson's cpu record is not offered a GPU repair
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 20, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d54f3a4e74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# repair would land on cpu again.
from utils.tegra import is_tegra

return is_tegra()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate automatic CPU suppression on the CUDA version

On a Tegra host this returns True without checking whether the driver supports CUDA 13, so it also covers Jetson Thor, which the installers intentionally route to cu130. If a Thor installation recorded an unpinned CPU flavor while its GPU was temporarily undetected, classify_torch_build() now exits before recognizing the stale CPU build, and Studio will not offer the GPU repair after the device becomes available. Only treat the automatic CPU record as deliberate when the Tegra host is actually on the pre-CUDA-13 route.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3033c1d: the automatic cpu record now counts as chosen only on a pre-CUDA-13 Jetson, read from the L4T release (JetPack 7 is R38, below that is JetPack 5/6) with the device tree as a fallback (Thor is tegra264). A Thor that recorded cpu while its GPU was undetected still gets the GPU repair. Tests: test_tegra_before_cuda13_reads_the_l4t_release and test_an_automatic_cpu_record_counts_as_chosen_only_on_a_jetson.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 3033c1d040

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Oct 20, 2026
@danielhanchen
danielhanchen merged commit f1f283a into main Oct 20, 2026
@danielhanchen
danielhanchen deleted the installers-jetson-tegra-torch branch October 20, 2026 18:58
josephGuo pushed a commit to josephGuo/unsloth that referenced this pull request Oct 21, 2026
…PU record, JetPack 7 off the CPU note (unslothai#14494)

## Summary
Follow-up to unslothai#14363 and unslothai#14374 from a post-merge regression review.

## What changes
- **An explicit GPU index beats the Jetson CPU record.** On a Jetson
before CUDA 13 with an automatic `cpu` record, an explicit
`UNSLOTH_TORCH_INDEX_FAMILY=cu126` (or a cu126 index URL) was overridden
and Studio hid the CPU-only PyTorch report. The stated index is now
checked before the Jetson exception.
- **Thor without a GPU attached** got the generic-wheels note instead of
"No GPU detected". With no driver CUDA version, `install.sh` now decides
JetPack 7 the way `utils/tegra.py` does (L4T R38+, or `tegra264` with no
release file).
- Host-dependent tests now force "not a Jetson" / "not Rosetta", so they
pass on a real Jetson or Apple Silicon Mac.

## Tests
- Changed tests: 342 passed; 5 fail against main's source (the new
ones). Installer shell checks 109/109 on both.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant