torchcodec: cover torch 2.11 in the compatibility guard and pin per torch 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.
This commit is contained in:
parent
0c1c9f71db
commit
ef240d5a61
7 changed files with 352 additions and 13 deletions
|
|
@ -93,7 +93,10 @@ COLAB_ORACLE_BASE_URL = "https://raw.githubusercontent.com/googlecolab/backend-i
|
|||
|
||||
# torch.minor -> set of compatible torchcodec.minor strings.
|
||||
# Source: pytorch/torchcodec compatibility matrix on its README.
|
||||
# Mirrors unsloth/import_fixes.py::_TORCH_TORCHCODEC_MINORS (asserted equal by
|
||||
# tests/python/test_torchcodec_torch_compat.py).
|
||||
TORCH_TORCHCODEC: dict[str, set[str]] = {
|
||||
"2.11": {"0.11"},
|
||||
"2.10": {"0.10"},
|
||||
"2.9": {"0.8", "0.9"},
|
||||
"2.8": {"0.6", "0.7"},
|
||||
|
|
@ -102,6 +105,12 @@ TORCH_TORCHCODEC: dict[str, set[str]] = {
|
|||
"2.5": {"0.1", "0.2"},
|
||||
}
|
||||
|
||||
# torchcodec 0.12+ 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. Mirrors
|
||||
# unsloth/import_fixes.py::_TORCHCODEC_ABI_STABLE_{TORCH,CODEC}.
|
||||
TORCHCODEC_ABI_STABLE_TORCH = "2.11"
|
||||
TORCHCODEC_ABI_STABLE_CODEC = "0.12"
|
||||
|
||||
# When peft >= trigger is on the resolved set, torchao >= floor must also be.
|
||||
PEFT_TORCHAO_FLOOR: list[dict[str, str]] = [
|
||||
{"trigger_peft": "0.19", "torchao_floor": "0.16.0"},
|
||||
|
|
@ -612,6 +621,11 @@ def rule_inst_004_torchcodec_torch(
|
|||
codec_v = res.get("torchcodec")
|
||||
if not torch_v or not codec_v:
|
||||
return findings
|
||||
if (
|
||||
cmp_versions(torch_v, TORCHCODEC_ABI_STABLE_TORCH) >= 0
|
||||
and cmp_versions(codec_v, TORCHCODEC_ABI_STABLE_CODEC) >= 0
|
||||
):
|
||||
return findings # ABI-stable pairing, not locked to one torch minor
|
||||
t_minor = version_minor(torch_v)
|
||||
c_minor = version_minor(codec_v)
|
||||
allowed = TORCH_TORCHCODEC.get(t_minor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue