Skip to content

torchcodec: cover torch 2.11 in the compatibility guard and pin per torch minor - #7474

Merged
danielhanchen merged 133 commits into
mainfrom
fix/torchcodec-torch211
Sep 8, 2026
Merged

danielhanchen merged 133 commits into
mainfrom
fix/torchcodec-torch211

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Split. This PR reached 5,503 insertions, most of which were not its own work: #10376
was stacked on this branch and squash-merged into it rather than into main, so its 3,277-line
shell-parsing rewrite landed inside this diff. That half now lives in #10414, which also
carries the compatibility contract (the torch 2.11 row and the 0.12+ ABI-stable rule in both
mirrors) because 49 of its 95 tests observe the pip replay through R-INST-004, and
test_torchcodec_matrix_matches_notebook_validator asserts the two tables are equal, so they
cannot move apart without a red commit in between. 23 further tests here exercised only the
validator and moved with it.

#10414 must land first. Once it does and this rebases, what remains is 1,618 insertions:
the installer selector, the wheel-availability tables, index and mirror pinning, NPP, the
provenance hint, the packaging extras and the security audit. This branch no longer touches
scripts/notebook_validator.py at all.

The bug

A fresh NVIDIA install on main ends up with a torchcodec that does not match its torch, and the guard built to catch that stays quiet.

  1. install.sh:3190 sets TORCH_CONSTRAINT="torch>=2.4,<2.12.0" for the CUDA branch. download.pytorch.org/whl/cu128 tops out at torch-2.11.0+cu128, so the install resolves torch 2.11.0.
  2. studio/backend/requirements/extras-no-deps.txt:5 pinned torchcodec==0.10.0.
  3. Upstream's matrix pairs torchcodec 0.10 with torch 2.10 and 0.11 with torch 2.11. torchcodec publishes no Requires-Dist: torch (its metadata lists only dev extras), so pip has nothing to resolve against and the mismatch installs cleanly.
  4. unsloth/import_fixes.py::_TORCH_TORCHCODEC_MINORS had no "2.11" row. The checker does allowed = _TORCH_TORCHCODEC_MINORS.get(torch_minor) and then if allowed is None or codec_minor in allowed: return None, so on torch 2.11 the lookup missed and the function returned None. The guard was silent on exactly the version where the mismatch now happens.

The user-visible result is a torchcodec whose native libs fail to load against torch 2.11. disable_torchcodec_if_broken catches the dlopen failure and quietly disables audio decoding, with no hint about why.

The fix

  • unsloth/import_fixes.py: add "2.11": {"0.11"}, and replace the hardcoded torch_minor == "2.10" branch in install_hint with a _TORCH_TORCHCODEC_EXTRAS lookup so the 2.11 hint points at the new extra.
  • scripts/notebook_validator.py: mirror the row (the two tables are asserted equal by test_torchcodec_matrix_matches_notebook_validator).
  • pyproject.toml: add audio-torch211 = ["torchcodec>=0.11.0,<0.12.0 ; python_version >= '3.10'"], alongside the existing audio-torch210 / audio-torch290 / audio-torch280.
  • studio/backend/requirements/extras-no-deps.txt + studio/install_python_stack.py: drop the flat pin and select the spec from the venv's torch minor. A flat pin cannot serve both torch lines (install.sh:2207 still carries a torch>=2.4,<2.11.0 default for some routes while :3190 allows 2.11 for CUDA), and pip environment markers cannot see the installed torch version. _select_torchcodec_spec mirrors the existing _select_torchao_spec pattern.

Why 0.11 for torch 2.11

Both from upstream's matrix and from the live indexes:

index newest torchcodec newest torch
cu128 0.11.1 2.11.0
cu126 0.15.0 2.13.0
cu130 0.15.0 2.13.0
PyPI 0.15.0 2.13.0

0.11 is the release upstream pairs with torch 2.11 exactly, and it is the newest one on the cu128 index that install.sh resolves torch 2.11.0 from: torchcodec 0.12 dropped CUDA 12.8. Pinning wider would resolve differently per index and reintroduce the split, and a 0.12+ wheel pulled from PyPI onto a +cu128 torch is a CUDA 13 build.

Not flagging combinations upstream supports

torchcodec 0.12 onwards is ABI stable against torch >= 2.11 (its build sets TORCH_TARGET_VERSION to 2.11), so that half of the matrix is open ended and cannot be expressed as a finite set of minors. Adding only the "2.11": {"0.11"} row would have made both checkers flag torch 2.11 with torchcodec 0.12 through 0.15, which upstream supports, and rule_inst_004_torchcodec_torch is an error-severity rule. Both checkers now short circuit on torch >= 2.11 and torchcodec >= 0.12 before the table lookup. For the same reason _select_torchcodec_spec sends torch 2.12+ to an open torchcodec>=0.12.0 floor rather than clamping onto the 2.11-only <0.12.0 line, which is unsatisfiable on the cu132 index.

Resulting behaviour:

torch torchcodec before after
2.11 0.10 silent reported
2.11 0.11 silent ok
2.11 0.15 silent ok
2.10 0.10 ok ok
2.10 0.15 reported reported

Ordering

The new install step runs after the final torch repair (step 13), not next to the other extras. That repair force reinstalls torch from the pinned CUDA index and can move it onto another minor, so a torchcodec chosen before it would go stale again, which is the original bug.

Two smaller follow ons from moving the install: the installer's base_total is bumped for the new step (TestProgressStepCountMatchesTotal catches this), and security-audit.yml now pulls audio-torch211 into the generated dependency set so torchcodec stays audited now that no requirements file declares it.

Tests

New cases in tests/python/test_torchcodec_torch_compat.py. The load bearing one is test_torch211_rejects_torchcodec_010, which asserts the guard is not silent. On unpatched main:

    hint = fixes._torchcodec_version_mismatch_hint()
>   assert hint is not None, "torch 2.11 + torchcodec 0.10 must not go unreported"
E   AssertionError: torch 2.11 + torchcodec 0.10 must not go unreported
E   assert None is not None

After:

torchcodec 0.10.0+cu128 is incompatible with torch 2.11.0+cu128; install a matching
build with `pip install 'torchcodec>=0.11,<0.12.0'` or `pip install 'unsloth[audio-torch211]'`.

Also covered: the ABI stable exemption on both checkers, _select_torchcodec_spec against every torch minor and against the pyproject extras, that torch above 2.11 never lands on the capped 0.11 line, and that extras-no-deps.txt carries no unconditional torchcodec pin.

tests/python/ and tests/studio/install/ show no new failures against origin/main on the same box, and tests/notebooks/ is unchanged. install.sh is untouched.

danielhanchen and others added 2 commits July 26, 2026 16:24
…orch minor

install.sh's CUDA branch allows torch>=2.4,<2.12.0 and the cu12x/cu13x wheel
indexes top out at torch 2.11.0, so a fresh NVIDIA install lands on torch 2.11.
studio/backend/requirements/extras-no-deps.txt pinned torchcodec==0.10.0, which
upstream pairs with torch 2.10 exactly, and torchcodec publishes no
Requires-Dist: torch, so pip cannot notice. The guard that exists to catch this,
_torchcodec_version_mismatch_hint, looks the torch minor up in
_TORCH_TORCHCODEC_MINORS and returns None on a miss, and the table had no "2.11"
row: it was silent on precisely the version where the mismatch now happens.

Add the 2.11 row (mirrored into scripts/notebook_validator.py), add an
audio-torch211 extra pinning the 0.11 line, and select torchcodec at install
time from the venv's torch minor instead of a flat pin. A requirements file
cannot branch on the installed torch version, so _select_torchcodec_spec follows
the existing _select_torchao_spec pattern. It runs after the final torch repair,
which can still move torch onto another minor.

torchcodec 0.11 is the release upstream pairs with torch 2.11 exactly and the
newest one published on the cu128 index install.sh resolves torch 2.11.0 from,
since 0.12 dropped CUDA 12.8. From 0.12 torchcodec is ABI stable against torch
>= 2.11, so that half of the matrix is open ended and cannot be written as a
finite set of minors; both checkers now exempt torchcodec >= 0.12 on torch >=
2.11 rather than flagging a combination upstream supports, and torch 2.12+
installs take the open >=0.12.0 floor instead of the 2.11-only 0.11 line.

Also bump the installer step total for the new step and keep torchcodec inside
the security audit set now that it no longer comes from a requirements file.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

The ABI-stable branch clears torch >= 2.11 paired with torchcodec >= 0.12,
but everything else fell through to the lockstep matrix, which has no row
past torch 2.11. So torch 2.12 or 2.13 with torchcodec 0.10 or 0.11 hit
`allowed is None` and returned no hint at all, even though upstream pins
0.11 to torch 2.11 exactly and 0.10 to torch 2.10 exactly. torchcodec
ships no `Requires-Dist: torch`, so pip cannot catch it either and the
user only sees a raw "Could not load libtorchcodec" at first use.

Split the lookup into three cases: a torch minor below the table stays
silent as before, a torch minor with a row keeps the existing per-minor
pin and audio-torch2xx extra hint, and a torch minor at or past the
ABI-stable floor with no row now points at `torchcodec>=0.12.0`.

Mirror the same three-way split in scripts/notebook_validator.py's
R-INST-004 so the two stay in step, and cover both with tests plus a
regression test that torch below the table still produces no finding.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Jul 27, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 6df6f82557

ℹ️ 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".

# Conflicts:
#	pyproject.toml
#	studio/install_python_stack.py
#	tests/python/test_torchcodec_torch_compat.py
@danielhanchen

Copy link
Copy Markdown
Member Author

Merged main. Three conflicts, and two of them needed a decision rather than a pick, so recording both.

pyproject.toml. This branch adds an audio-torch211 extra; main added a comment above the block explaining that torchcodec publishes no sdist and only manylinux_2_28_x86_64, macosx_*_arm64 and win_amd64 wheels, so Linux aarch64, Windows ARM64 and Intel Mac have nothing to resolve and pip fails the whole install rather than skipping audio. Main gated every existing audio-torch* on the platforms that have a wheel. The new audio-torch211 was written before that and carried only python_version >= '3.10', so taking both sides verbatim would have merged in the one ungated extra and reintroduced exactly the failure the new comment documents. It now carries the same marker as audio-torch210, audio-torch290 and audio-torch280, and all four read as gated.

studio/install_python_stack.py, the progress-bar denominator. The merge base was base_total = 11 if IS_WINDOWS else 12, counting one lettered step (the anyio repair check, 8b). Main added the diffusers pin as 11b and bumped to 12 if IS_WINDOWS else 13; this branch added torchcodec as 13b and bumped to the same 12 if IS_WINDOWS else 13. Because both sides wrote the identical line, git auto-merged it and flagged only the comments above it, so a mechanical resolution keeps a total that counts one of the two new steps. Both _progress("diffusers pin") and the torchcodec step are present in the merged file, so the total is 13 if IS_WINDOWS else 14.

The third, tests/python/test_torchcodec_torch_compat.py, was add/add with an empty merge base and both sides are kept. No duplicate top-level definitions in the result, and pyproject.toml parses.

tests/python/test_install_python_stack.py, tests/test_installer_profile_hardening.py, tests/python/test_torchcodec_torch_compat.py and tests/python/test_flash_attn_install_python_stack.py: 163 passed.

@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: 3e79d61fb7

ℹ️ 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".

# torchcodec is no longer pinned in extras-no-deps.txt (the installer
# picks the line matching the venv's torch minor), so pull the newest
# audio extra in to keep torchcodec inside the audited set.
audio = d["project"]["optional-dependencies"]["audio-torch211"]

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 Audit the ABI-stable torchcodec line

When Studio updates an environment running torch 2.12 or newer, the new selector installs torchcodec>=0.12.0, but both workflow input builders add only audio-torch211, whose declaration is capped at torchcodec<0.12.0. Consequently pip-audit and scan_packages.py resolve and inspect the 0.11 line rather than any version from the ABI-stable line that this change explicitly supports and installs. Add a separate, non-conflicting audit input for torchcodec>=0.12.0 so that path remains covered.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not taking this one. The torchcodec>=0.12.0 arm of _select_torchcodec_spec is
unreachable on every route the installer takes: _CUDA_TORCH_PKG_SPEC and
_CPU_TORCH_PKG_SPEC are torch>=2.4,<2.12.0, _TORCH_FLAVOR_REPAIR_PKG_SPEC is
torch>=2.4,<2.11.0, and install.sh's TORCH_CONSTRAINT is torch>=2.4,<2.12.0. The
selector never sees a torch minor that reaches that row. It exists so a future torch does
not clamp onto the 2.11-only <0.12.0 line, not because anything installs from it today.

A second input would also have to be a separate generated file rather than an extra spec:
torchcodec>=0.11.0,<0.12.0 and torchcodec>=0.12.0 in one requirements set is
unsatisfiable, so pip-audit would fail to resolve instead of auditing both. Worth adding
when a torch 2.12 route actually ships.

danielhanchen and others added 2 commits August 16, 2026 21:09
Two conflicts, both resolved by keeping each side's intent.

studio/backend/requirements/extras-no-deps.txt: main pinned the audio extras
to exact versions; this branch removed the flat torchcodec pin because the
wheel is torch-ABI specific and a requirements file cannot branch on the
installed torch minor. Kept main's exact pins for every other entry and kept
the torchcodec line removed, with the comment that points at
_select_torchcodec_spec.

studio/install_python_stack.py: both sides added at the same anchor. Main
replaced the standalone torch probe with a memoized _probe_torch_runtime and
kept _probe_installed_torch_version as a thin wrapper over it; this branch
added the torchcodec spec table and _select_torchcodec_spec just above. Kept
both blocks. Step 13b keeps calling _probe_installed_torch_version, so it now
shares main's single probe instead of spawning its own.

base_total stays at 13/14: main did not add or drop a progress step, and the
three torchcodec sites are mutually exclusive, so exactly one extra step runs.

tests/studio/install/test_diffusers_pin.py: the ordering check scanned the raw
install_python_stack.py source for requirements filenames, so the torchcodec
step's comment explaining why the spec cannot live in extras-no-deps.txt read
as an install after the diffusers pin and failed the test. The check is about
where `uv pip install -r` runs, so it now scans with comments blanked out and
offsets preserved. A real later install still trips it.

@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: b96c786738

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread unsloth/import_fixes.py Outdated
Comment on lines +2377 to +2381
if (
torch_release >= _TORCHCODEC_ABI_STABLE_TORCH
and codec_release >= _TORCHCODEC_ABI_STABLE_CODEC
):
return None # ABI-stable pairing, not locked to one torch minor

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 Reject CUDA 13 codecs for cu128 torch

When a user has torch==2.11+cu128 and manually installs torchcodec>=0.12, this return treats the pair as compatible solely because of the stable PyTorch ABI. However, studio/install_python_stack.py explicitly keeps 2.11 on torchcodec 0.11 because 0.12 dropped CUDA 12.8 and its PyPI wheel targets CUDA 13. If that wheel consequently fails to load, disable_torchcodec_if_broken() silently disables it because mismatch_hint is None, leaving the user without the matching-build remediation. Account for the CUDA/local build when applying this early return.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not taking this one, the premise does not hold. torchcodec publishes no +cuXXX build on
PyPI, and the 0.12 and 0.13 wheels there link no CUDA library at all. On
torchcodec-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl:

$ readelf -d torchcodec/libtorchcodec_core7.so | grep NEEDED
 libtorch.so  libc10.so  libavutil.so.59  libavcodec.so.61  libavformat.so.61
 libavdevice.so.61  libavfilter.so.10  libswscale.so.8  libswresample.so.5
 libtorch_cpu.so  libstdc++.so.6  libm.so.6  libgcc_s.so.1  libc.so.6

No libcudart, no libtorch_cuda. Same for 0.10.0, 0.11.1 and 0.13.0. The CUDA 13 link
starts at 0.14.0, which adds libcudart.so.13, libnvrtc.so.13, libtorch_cuda.so and
libc10_cuda.so. So torch 2.11+cu128 with torchcodec 0.12 or 0.13 loads, and the early
return is right for it.

The 0.14+ pairing is a real hole, but it is not one this branch opens. origin/main has
no 2.11 row at all, so _torchcodec_version_mismatch_hint() is silent there too:

torch             codec    main     this branch
2.11.0+cu128      0.14.0   silent   silent
2.11.0+cu128      0.16.0   silent   silent
2.11.0+cu128      0.10.0   silent   reported   <- what this PR fixes

Closing it means encoding which torchcodec release links which CUDA major, and that has
already moved once inside the 0.12 to 0.16 range. It also needs a hand-installed torchcodec:
_select_torchcodec_spec puts a cu128 torch 2.11 on torchcodec>=0.11.0,<0.12.0, so
nothing here installs 0.14+ next to it.

@danielhanchen

Copy link
Copy Markdown
Member Author

Confirmed the table in unsloth/import_fixes.py still stops at 2.10, so torch 2.11 with the pinned torchcodec 0.10 goes unreported and audio decoding just turns itself off. Will get this reviewed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 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 🔄 Running since 2026-09-08T07:03:56.352718Z b6621b3 New commits
ℹ️ 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.

@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: d27b961978

ℹ️ 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".

Comment thread pyproject.toml
Comment on lines +182 to +184
audio-torch211 = [
"torchcodec>=0.11.0,<0.12.0 ; python_version >= '3.10' and (((sys_platform == 'linux' or sys_platform == 'win32') and (platform_machine == 'x86_64' or platform_machine == 'AMD64')) or (sys_platform == 'darwin' and platform_machine == 'arm64'))",
]

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 Include the 2.11 audio extra in the Intel XPU bundle

When users install the existing unsloth[intel-gpu-torch2110] umbrella for torch 2.11.0, its definition at pyproject.toml:1305-1307 pulls only unsloth[intelgputorch2110], so this new extra is never selected and those installations still lack torchcodec/audio support. The corresponding torch 2.10 umbrella already includes unsloth[audio-torch210]; add unsloth[audio-torch211] to the 2.11 umbrella as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not taking this one. audio-torch2xx is wired into the torch 2.10 umbrellas only.
intel-gpu-torch260, -torch270, -torch271, -torch280, -torch290, -torch291,
cu126/cu128/cu130-torch280, -torch290 and -torch291, rocm702-torch280,
rocm72-torch291 and rocm711-torch291 all omit it, including the 2.8 and 2.9 families
where audio-torch280 and audio-torch290 already exist to be pulled in. So
intel-gpu-torch2110 matches every umbrella except the 2.10 ones, and wiring audio into
this one alone would leave the other eight inconsistent in the other direction.

The gap is real, but it is a question about how the bundles compose across all of them,
not part of the guard and per-minor pin here.

"""
if not torch_version:
return _TORCHCODEC_DEFAULT_SPEC
release = str(torch_version).split("+", 1)[0] # drop +cu128/+rocm7.2/+cpu

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the CUDA flavor when selecting torchcodec

On a CUDA 13 Studio install, the final torch repair can resolve torch==2.11.0+cu130 because _CUDA_TORCH_PKG_SPEC allows 2.11, but this discards +cu130 and selects the 0.11 line solely from the minor. The surrounding compatibility rationale identifies 0.11 as the CUDA 12.8 line and 0.12+ as the CUDA 13 build, so this automatically installs a CUDA-mismatched native library and audio decoding is subsequently disabled. Branch on the local CUDA tag, as _select_torchao_spec already does, so cu130 torch 2.11 selects the ABI-stable CUDA 13 line.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not taking this one: the wheel this describes is not the one that gets installed. The
torchcodec step runs pip_install("Installing torchcodec", "--no-deps", "--no-cache-dir", _codec_spec) with no --index-url, and _install_env_for_cmd returns None for a
command that pins no index, so it resolves from PyPI. PyPI carries no +cu128 or +cu130
torchcodec, since PEP 440 local versions are not accepted there; those builds exist only
on download.pytorch.org, which this step never reads.

The PyPI 0.11.1 wheel links no CUDA library:

$ readelf -d torchcodec/libtorchcodec_core7.so | grep NEEDED
 libtorch.so  libc10.so  libavutil.so.59  libavcodec.so.61  libavformat.so.61
 libavdevice.so.61  libavfilter.so.10  libswscale.so.8  libswresample.so.5
 libtorch_cpu.so  libstdc++.so.6  libm.so.6  libgcc_s.so.1  libc.so.6

There is nothing in it to mismatch against a +cu130 torch, and the same holds for the
rocm, xpu and cpu builds. That is the difference from _select_torchao_spec: torchao's
cpp extensions do link libcudart, which is why that one has to branch on the CUDA major.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 31, 2026
@unslothai unslothai deleted a comment from danielhanchen Aug 31, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 31, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 31, 2026
@unslothai unslothai deleted a comment from danielhanchen Aug 31, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 8757f1d7c5

ℹ️ 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 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: e72196ab9a

ℹ️ 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".

Comment thread studio/install_python_stack.py Outdated
Comment on lines +7232 to +7233
_codec_torch_ver = _probe_installed_torch_version()
_codec_spec = _select_torchcodec_spec(_codec_torch_ver)

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 Recheck the codec pairing on the update fast path

When an otherwise-current managed venv is moved from torch 2.11 to 2.10 without changing its torch flavor—for example, a user pins an older torch release from the same CUDA family—the install manifest still verifies because it records core-package and requirements state, not the torch minor or torchcodec version. Both setup fast paths can therefore skip install_python_stack() entirely, so this new selector never runs and the 0.11 codec left by the prior install remains beside torch 2.10 even though torchcodec declares no dependency that would expose the mismatch. Record enough compatibility state in the manifest or add a fast-path mismatch probe that forces this step.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not taking this one. The manifest records expected_torch_tag, the flavor, so a same-flavor
minor move does not invalidate it and the fast path does skip the step. But that is true of
every version-sensitive selector on that path, _select_torchao_spec included, and reaching
the state needs a hand-installed torch inside the managed venv. Recording compatibility
state in the manifest is a change to its schema and to both fast paths, and it would have to
cover torchao, xFormers and triton to be coherent rather than singling torchcodec out.

The pairing is also not silent, which is what this PR is for. torch 2.10 next to torchcodec
0.11 reaches the guard at import:

torchcodec 0.11.0 is incompatible with torch 2.10.0+cu128; install a matching build with
`pip install 'torchcodec>=0.10,<0.11.0'` or `pip install 'unsloth[audio-torch210]'`.

test_torch210_rejects_torchcodec_011 holds that. Before this PR the reverse case, a
hand-upgrade to torch 2.11 leaving 0.10 in place, had no row at all and reported nothing.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen and others added 2 commits September 6, 2026 22:56
- The per-command scanner replayed the right side of `||`, which runs only
  when the left FAILS. The rules read a cell as the shell runs it on a
  working host, so `install codec==0.10 || install codec==0.12` now ends on
  0.10. `&&` and `;` both still run.

- Attribution used substring membership, so `pip install torch && pip
  uninstall -y torchaudio` put torch in the uninstall span and read it as
  removed. Each span is tokenised now.

- The provenance remedy suggested a bare `torchcodec`. The accelerator
  indexes carry the whole line, so on torch 2.9 that installs 0.11 and
  trades a wrong-accelerator build for a wrong-version one. It now pins the
  window the table allows, or the ABI-stable floor past the table.

- torchcodec's CUDA build dlopens libnppicc and libnppc, and NPP is not in
  torch's dependency set, so the --no-deps install from a cuNNN index
  reported success and then failed to import. docker/Dockerfile pairs
  nvidia-npp-cu12 with the same wheel; the installer now does too, with the
  major taken from the index leaf so cu13x asks for cu13. Fail-soft, like
  the codec install itself.

Each of the four new tests is red at the parent commit.
@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: f78c3ce05b

ℹ️ 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".

Comment thread scripts/notebook_validator.py Outdated
Comment on lines +749 to +751
for requirement in _requirements:
if ";" in requirement:
continue

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 Distinguish shell separators from requirement markers

When a quoted requirement is immediately followed by a shell semicolon, shlex leaves the separator attached to the token, so this check mistakes it for a PEP 508 marker and discards the install. For example, !pip install "torchcodec>=0.12"; pip install torch==2.12.0 is modeled as torch 2.12 with the original 0.11 codec and produces a false R-INST-004 error, although the shell actually installs an ABI-compatible 0.12+ codec first. Strip shell punctuation or identify actual marker expressions rather than skipping every token containing ;.

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.

Not reproducing at the head. The premise is that shlex leaves the separator attached, and that was true before #10376 landed on this branch: _split_chained now cuts on an unquoted ; before any token reaches shlex, so the separator is gone by then.

Checked six shapes against 4dc370824, all with a resident torch 2.11.0 / torchcodec 0.11.0 Colab oracle:

pip install "torchcodec>=0.12"; pip install torch==2.12.0
pip install "torchcodec>=0.12" ; pip install torch==2.12.0
pip install "torchcodec>=0.12";pip install torch==2.12.0
pip install torchcodec>=0.12;pip install torch==2.12.0
(pip install "torchcodec>=0.12"; pip install torch==2.12.0)
{ pip install "torchcodec>=0.12"; pip install torch==2.12.0; }

Every one gives codec 0.12 and torch 2.12.0, and R-INST-004 emits nothing. The one shape where a ; really is inside the token, pip install "torchcodec>=0.12; python_version>='3.9'", is a genuine PEP 508 marker, evaluates true on 3.12, and is applied rather than skipped.

If you have a shape that still discards the install I will take it, but I am not changing the marker check on this evidence.

…way bash does (#10376)

* notebook_validator: read shell prefixes, backticks and case arms the way bash does

Split out of #7474. That PR is a torchcodec/torch 2.11 pin; this parser rewrite
rode along with it and has since driven every one of its nine review rounds
while sharing no code with the pin. Separating them makes each reviewable and
revertable on its own.

Carries the rewrite as it stood at 75a808c plus fixes for the three P1
defects from the 2026-09-02 round, which were still open. Each one let
R-INST-001 miss a `git+` install that bash really would run, and in each case
the neighbouring form was already caught, which is what makes them defects
rather than gaps.

A prefix operand can be spelled like the command. `env -u pip pip install
git+...` unsets the variable `pip` and runs the second one, but the executable
was located by searching for the first pip-looking word, which selected the
operand and produced `pip pip install ...` -- rejected by PIP_LINE_RE, so
nothing was collected at all. Prefixes now consume their own options and
operands positionally, per a small per-prefix table of the flags that take a
separate argument, so the executable is whatever word survives.

Backticks were not tracked as substitutions. `_split_chained` knew about
quotes and `(`/`{` but never a backtick, so the `;` in
``echo `pip install git+...; echo ok` `` split the line and handed
`_substitution_bodies` an unmatched fragment it cannot read. The `$( )` form
was handled correctly throughout, which isolates it. There is now a backtick
state folded into `in_sub()`, checked before the quote branch because
backticks expand inside double quotes.

`zip(out, commands)` was not one-to-one. `commands` dropped pieces that
unwrapped to empty while `out` kept them, so every later pair slid by one and
`zip` stopped at the shorter list. A `case` emits an empty piece per `;;` and
its `esac` unwraps to "", so a two-arm `case` left `out` at 5 against
`commands` at 2 and the arm holding the substitution was never scanned. Empty
pieces are now carried through the pairing and filtered after it.

One adjacent defect the same trace exposed: `_unwrap_shell_group` ended with
`rstrip(")}")`, which also ate the `)` closing a `$( )` when no `(` had been
stripped. Only a grouping bracket is stripped now; a lone `}` from a group
that spanned a separator still is, which `_final_bracket_closes_substitution`
tells apart.

Five tests, all red against the parser at 75a808c and green here, each
paired with the control form that already passed. tests/notebooks is 119
passed / 2 skipped; ruff clean.

The `"2.11": {"0.11"}` torchcodec row appears here too, because
`rule_inst_004_torchcodec_torch` lives in this file and its update depends on
`_effective_version` and `_marker_environment` from this rewrite. #7474 adds
the same row on its side to keep
`test_torchcodec_matrix_matches_notebook_validator` green, so that one line
will conflict trivially, with identical content, whichever merges second.

* Move the parser's own tests across with it

The git+ allowlist, install-cell discovery and pip-skip cases exercise the
rewritten parser rather than the torchcodec pin, so they belong here too, along
with the _one_cell_notebook helper they share. #7474 keeps only the 24 that are
actually about torchcodec, import_fixes and install_python_stack.

tests/notebooks: 131 passed, 2 skipped.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Keep parameter expansions literal, land a cap-only install, refresh both oracles

Three from the first Codex round on this branch. All three reproduce, and the
first is the one that matters most: it is a false positive, so it rejects a
clean notebook rather than missing a dirty one.

${X:-a||pip install git+...} is one word to bash. `${` was pushed onto the
groupings stack as a plain brace group, so the `||` inside the fallback word
was read as a control operator and _split_chained manufactured a conditional
pip command that never runs. R-INST-001 then failed the notebook over an echo.
`${` is now tracked the way `$(` already was. A $( ) inside an expansion does
run and is still read; a real { } group still splits on its own separators.

pip install "x<=V" on an absent package installs V. _effective_version treated
a cap-only requirement as leaving the package absent, so uninstall followed by
a capped reinstall came back None and R-INST-004 said nothing about exactly the
downgrade it exists to catch. A cap now names the landing version, since pip
takes the highest release the requirement allows. An exclusive ceiling still
names nothing, because which release sits below it depends on the index.

os-info stopped being human-only when this rewrite gave _marker_environment
its Python version, but notebooks-ci.yml still refreshed pip-freeze alone. On
a Colab Python rotation that judges a fresh package set against the previous
image's Python. The pre-lint step now refreshes both with --all, which writes
nothing unless it fetched every oracle, so the fallback is the committed pair
and is at least self-consistent. The comment above COLAB_STRICT_ORACLE claimed
os-info feeds no rule; it does now, and says so.

Three tests, red at the parent, green here. tests/notebooks: 134 passed, 2
skipped. ruff clean, workflow YAML parses.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Drop the duplicate ABI constants left by the restack

My conflict resolution when rebasing onto #7474 kept both sides of the constants
block, so TORCHCODEC_ABI_STABLE_TORCH and _CODEC were each defined twice. The
values are identical, so the later pair wins and nothing misbehaves -- which is
exactly why the test suite stayed green and only the duplicate-definition lint
caught it. Deleted the second copy.

Also escaped the backslash in the escaped-separator test's literal. `"\;"` is
not a valid Python escape, so it raised a SyntaxWarning; `"\;"` is the same
string with the intent stated.

* Treat a top-level extra marker as false, and a pip mention as not an install

Two review findings, both false positives on R-INST-004 / R-INST-003, which are
error severity and so fail notebook CI on clean notebooks.

`extra` is only bound while resolving a selected extra's dependency metadata. A
requirement handed straight to pip has the known empty value, so `extra == "foo"`
is definitively false and pip drops the requirement. Confirmed against pip:

    $ pip install --dry-run --no-deps "certifi; extra == 'foo'"
    Ignoring certifi: markers 'extra == "foo"' don't match your environment

Omitting it from the marker environment made _requirement_applies conservatively
replay such requirements, so `pip install "torch==2.12.0; extra == 'foo'"` was
judged against the Colab baseline and reported a mismatch.

A cell can also look like an install and run none: `!echo "pip install foo"`
matches the install-cell regex but executes no pip. The compat rules then
resolved nothing and compared the oracle against itself, so R-INST-003 reported
Colab's own peft/torchao pair as an error in the notebook. A notebook with no
install cell at all was always skipped; the lookalike now behaves the same. The
cell stays discovered, so the per-cell forbid-pattern rules still inspect it.

* Drop the narrow codec-range helper this PR's replay supersedes

#7474 fixes R-INST-004's range handling with _effective_requested_version, which
re-reads the cell text and takes the highest floor it finds. This PR replaces
that with _effective_version, a full replay that walks the invocations in order
and tracks whether the version it lands on is exactly known.

The rebase kept both, so the replay ran and the narrower helper then overwrote
its answer, losing invocation order: `torchcodec>=0.12` followed by
`torchcodec==0.11.1` resolved back to 0.12 and the real mismatch went unreported.
Three of this PR's own tests caught it. Removed the superseded helper and its
bounds parser; _effective_version covers every case they did, which the
torchcodec compat suite asserts.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Run notebooks CI when the marker oracle rotates

_marker_environment reads the image's Python out of colab_os_info.gpu.txt, which
makes that snapshot rule-bearing: an OS-only refresh changes which requirements
the validator replays. The pull_request path filter listed only the pip freeze,
so such a PR skipped the lint and smoke jobs its change affects. Added the OS
snapshot beside it.

* Pair the marker oracle with the pip snapshot it is judging

Both halves of one mismatch, introduced when _marker_environment started reading
the image's Python out of colab_os_info.gpu.txt.

The path was hard-coded to scripts/data, so `lint --colab-pin` pointing at a
snapshot captured anywhere else evaluated markers against this repo's committed
os-info: a different image's interpreter than the packages being judged. The
oracle directory now follows the pin.

The scheduled job had the same split from the other side. It refreshed only
colab_pip_freeze.gpu.txt and then linted, so after a Colab Python rotation it
judged freshly refreshed packages with the previous image's interpreter,
skipping requirements that apply or replaying ones that do not. The PR-time step
already refreshes both with --all --snapshot-dir; the cron now matches it.

* Match the repo's kwarg spacing in the new oracle test

pre-commit's ruff-format-with-kwargs hook writes `encoding = "utf-8"`; the test
I added used the tight form, which is what turned the hook red.

* Parse python -m pip, gate compat replay on unconditional installs

Three fixes:

- PIP_LINE_RE now accepts pip's own recommended `python -m pip` form. The
  cell regex already selected such a cell, so the invocation list came back
  empty and R-INST-001 missed a prohibited `git+` install outright. The
  unused _PIP_WORD_RE that recognised the prefix but was wired to nothing
  goes away with it.

- The whole-notebook compatibility rules now run only when the merged cell
  has an UNCONDITIONAL pip invocation. `!command -v uv || pip install foo`
  parses to a conditional one, so the rules replayed nothing and compared
  the Colab oracle against itself, reporting the base image's own
  peft/torchao pair against an unrelated notebook. R-INST-001 still sees the
  conditional path: it runs per cell, before this gate.

- os-info drift in its Python line now fails `colab-diff --strict`.
  _marker_environment reads that line, so it is rule-bearing, but with only
  the pip freeze named strict a Colab interpreter bump behind an unchanged
  package set left the cron green and the committed version stale. The rest
  of os-info, and all of apt-list, stay advisory.

Each of the three new tests is red at the parent commit.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Recognise expanded interpreter forms, and gate exception coverage on a real pip run

- PIP_LINE_RE only accepted a literal `python*` executable, so
  `!{sys.executable} -m pip install ...` and `!/usr/bin/python3 -m pip ...`
  matched _PIP_CELL_RE, yielded no invocation, and slipped past R-INST-001
  and every compatibility replay. The interpreter alternatives are now kept
  in step with docker/unsloth_nb_pip_magic.py, which rewrites the same
  spellings at runtime.

  _unwrap_shell_group also stripped a leading `{` unconditionally, leaving
  `sys.executable}` as the executable. `{` opens a shell group only as its
  own token, so it is stripped only when whitespace follows; a real
  `{ pip install x; }` group still unwraps.

- rule_l12_exceptions_coverage consumed the raw cells install_cells returns,
  with no parsed-invocation gate. A documentation-only line such as
  `!echo "pip install peft"` therefore drew a blocking R-EXC-001 for a
  policy clause the notebook has no install to carry. cmd_lint already gates
  on an invocation; this path now does too.

Also carries the base branch's PEP 440 zero-padding fix for cmp_versions and
its pinned-mirror fix for the torchcodec index, with tests against this
branch's API. Each new test is red at the parent commit.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Parse python -m uv pip, and give the cron lint the packaging it needs

- The interpreter alternative only accepted `-m pip`, but
  unsloth_nb_pip_magic rewrites `(pip|uv)` after the module flag and uv's
  pip-compatible interface is spelled `uv pip <action>`. So
  `!python -m uv pip install git+...` matched _PIP_CELL_RE, yielded no
  invocation, and R-INST-001 missed a prohibited source the notebook runs.
  The tool is now decided by matching `uv pip` as a word pair, so an
  interpreter path containing "uv" is still plain pip.

- The static-with-pypi job installed only pip, and _requirement_applies
  falls back to "applies" when it cannot import Marker. The daily lint was
  therefore replaying every environment-marked requirement, including the
  ones Colab's pip skips, which is the question the refreshed Python-version
  oracle exists to answer. packaging is now declared there.

Also merges the base branch and carries its torch-replay, provenance and
Windows-shell tests against this branch's API.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Name the encoding on the workflow reads in the new tests

tests/test_source_read_encoding.py forbids reading a checked-in file with
the platform default encoding, since it breaks on Windows the moment that
file gains a non-ASCII byte. The four notebooks-ci.yml reads added by this
PR were missing it.

* Tighten the comments added by this PR

Compress the explanatory blocks to their load-bearing content: 331 added
comment lines down to 287 across the files this PR owns. No behaviour
change; the full suite still passes.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 03892bfa61

ℹ️ 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[bot]

This comment was marked as resolved.

…g it

An unloadable wheel usually raises while torchcodec/__init__ imports its decoders, and Python
drops a module whose initialisation raised, so importing it again in the hint just repeated the
exception and returned None. The accelerator mismatch went undiagnosed in exactly the case the
hint exists to name. The installer's metadata carries the version and needs no native library;
an import is still the fallback for a layout the metadata cannot describe.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 0f154994ff

ℹ️ 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".

# Conflicts:
#	.github/workflows/notebooks-ci.yml
#	scripts/notebook_validator.py
#	tests/notebooks/test_notebook_validator_shell_parsing.py
#	tests/python/test_torchcodec_torch_compat.py
#	unsloth/import_fixes.py
@danielhanchen

Copy link
Copy Markdown
Member Author

Merged main now that #10414 has landed, and the diff is down to what this PR actually owns.

insertions deletions files
before 5,030 122 11
after 1,674 79 8

The validator work that used to ride along here is in main, so scripts/notebook_validator.py, tests/notebooks/ and .github/workflows/notebooks-ci.yml leave this diff entirely. What remains is the torchcodec pin itself:

 unsloth/import_fixes.py                              168 +-   runtime guard and remedies
 studio/install_python_stack.py                       332 +-   installer selection
 tests/python/test_torchcodec_torch_compat.py       1,103 +-   the matrix and its consistency tests
 pyproject.toml / extras-no-deps.txt / security-audit  79 +-   packaging
 tests/studio/install/{test_diffusers_pin,test_windows_torch_flavor_invariant}.py  71 +-

Merge resolution

Five files conflicted. notebook_validator.py, the shell-parsing suite and notebooks-ci.yml took main wholesale, after checking main is a strict superset there (same TORCH_TORCHCODEC table, every function this branch had plus the ones the review rounds added). test_torchcodec_torch_compat.py took this branch, whose 53 tests include all 14 of main's as supersets, with main's SPDX header restored. import_fixes.py needed a real decision: main's version of _torchcodec_version_mismatch_hint had gained the prerelease-aware ABI comparison (_at_least, so 2.11.0rc1 no longer reads as being at the 2.11 floor) while this branch's had the --index-url pin on the ABI-floor remedy. Kept both; test_the_runtime_hint_pins_the_index_it_tells_you_to_install_from was the test that caught the naive resolution dropping the index.

Verification

  • tests/python/test_torchcodec_torch_compat.py + tests/notebooks: 358 passed, 2 skipped.
  • tests/studio/install + tests/python in full: 6,123 passed, 5 failed, all five reproduced on plain origin/main in a separate worktree.
  • AMD differential on the gfx1151 host, base 6a0966ac4 vs head baeea4857 vs merge 386bf6b7e: NO_REGRESSION. base 3,366 passed / 19 failed, head and merge 3,406 passed / 19 failed, and the two failure sets are identical, so the 19 are the host's pre-existing ones (test_managed_dir_*, the TestProgressStepCountMatchesTotal family, the ipv6 warning pair) and the 40 extra passes are this branch's new tests.

What that run does not answer: it is the installer's decision functions and the guard's helpers, which import no torch, so it exercises no ROCm stack. The wheel-level question, whether a ROCm torch plus a torchcodec wheel loads on that host, is not something this can reach, since torchcodec publishes no ROCm build.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: baeea48579

ℹ️ 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 and others added 2 commits September 8, 2026 07:03
The module asserted the same shape ten times over for the runtime guard, parsed the
audio extras' markers twice, and repeated the wheel-gate scaffolding across four
platform tests. Every fact it checked is kept, now as case tables:

- one parametrized guard test over 19 (torch, torchcodec) pairs, replacing ten
  near-identical bodies
- one gate table for the audio extras covering both the platform and the Python
  ceiling, plus a check that a newly added extra cannot slip through untested
- one anchor table for the wheel gate's documented transitions
- an autouse fixture clearing the index environment, so a developer's own
  UNSLOTH_TORCH_INDEX_URL cannot decide what the suite asserts

Also drops test_select_torchcodec_spec_matches_compat_matrix, which loops the guard
matrix that test_compat_matrix_matches_the_published_upstream_table already pins to
the literal the stronger installer test below it loops.

1,261 lines to 1,132, 76 tests. Verified by breaking each collapsed behaviour in turn
(the ABI floor, the ABI codec floor, the aarch64 marker, the Python ceiling, the
macOS 14 floor, the 0.1 Python window, and adding an ungated extra) and confirming
the tables still fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants