torchcodec: warn when torch outruns the last lockstep row
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.
This commit is contained in:
parent
8ca1764e46
commit
6df6f82557
3 changed files with 81 additions and 9 deletions
|
|
@ -630,7 +630,22 @@ def rule_inst_004_torchcodec_torch(
|
|||
c_minor = version_minor(codec_v)
|
||||
allowed = TORCH_TORCHCODEC.get(t_minor)
|
||||
if allowed is None:
|
||||
return findings # unknown torch minor — don't flag
|
||||
if cmp_versions(torch_v, TORCHCODEC_ABI_STABLE_TORCH) < 0:
|
||||
return findings # torch older than the table — don't flag
|
||||
# Torch at or past the ABI-stable floor with a pre-0.12 torchcodec: the
|
||||
# ABI-stable branch above already returned for 0.12+, so this pin is a
|
||||
# legacy build locked to an older torch minor and cannot load.
|
||||
findings.append(
|
||||
Finding(
|
||||
rule = "R-INST-004",
|
||||
file = file,
|
||||
cell = cell_idx,
|
||||
severity = "error",
|
||||
message = f"torch=={torch_v} (minor {t_minor}) is incompatible with torchcodec=={codec_v} (minor {c_minor}); torchcodec <{TORCHCODEC_ABI_STABLE_CODEC} is built against a single older torch minor",
|
||||
hint = f"pin `torchcodec>={TORCHCODEC_ABI_STABLE_CODEC}.0` (the ABI-stable line, which targets torch >={TORCHCODEC_ABI_STABLE_TORCH})",
|
||||
)
|
||||
)
|
||||
return findings
|
||||
if c_minor not in allowed:
|
||||
findings.append(
|
||||
Finding(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue