Repository navigation
Pin torchcodec to match downgraded torch in qwen3_5 / nemotron_nano templates - #259
Merged
Merged
Conversation
…emplates Colab preinstalls torchcodec 0.10 against torch 2.10. Both installation_qwen3_5_content (forces torch==2.8.0) and installation_nemotron_nano_content (forces torch==2.7.1) downgrade torch without touching torchcodec, so the leftover 0.10 binding hits a torch CUDA ABI mismatch (undefined symbol _ZN3c104cuda29c10_cuda_check_implementationEiPKcS2_jb) the moment transformers transitively imports torchcodec on "from unsloth import FastVisionModel". Per pytorch/torchcodec compatibility table: torch 2.7 -> torchcodec 0.6 torch 2.8 -> torchcodec 0.7 Pin torchcodec inside the torch-downgrade branch of each affected template and propagate to the qwen3_5 family (6 notebooks), nemotron_nano family (4 notebooks) and granite4 family (4 notebooks). torchcodec base has zero unconditional runtime deps (same shape as torchao), so --no-deps is purely defensive and does not affect torch. Generated artifacts updated via update_all_notebooks.py.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates several Jupyter notebooks and Python scripts to explicitly install compatible versions of torchcodec (0.6.0 for torch 2.7.1 and 0.7.0 for torch 2.8.0). This change prevents ABI mismatches in Google Colab environments where a pre-installed newer version of torchcodec would otherwise break transformers imports after a torch downgrade. The update_all_notebooks.py script was also updated to reflect these changes. I have no feedback to provide.
danielhanchen
added a commit
that referenced
this pull request
Apr 29, 2026
…o install cells (#260) The two-line ABI-mismatch explanation that #259 added inside the install templates ends up rendered into every regenerated install cell. The pin itself is self-documenting, so drop the comment and let update_all_notebooks.py regenerate cleaner cells across the qwen3_5, nemotron_nano and granite4 families plus their python_scripts mirrors.
4 tasks
danielhanchen
added a commit
that referenced
this pull request
Apr 29, 2026
#261) Two leftover bugs after #259 / #260: 1. installation_nemotron_nano_content pins torch==2.7.1 but #259 set torchcodec==0.6.0. Per pytorch/torchcodec's compatibility table 0.6 targets torch 2.8, not 2.7; the right pin for torch 2.7 is torchcodec==0.5 (also covered by 0.4 / 0.3). The 0.6 wheel still ABI-mismatches against torch 2.7.1 the same way 0.10 did, so the nemotron and granite4 notebooks would still hit the libtorchcodec undefined-symbol error on Colab. Switch to torchcodec==0.5 (cp312 manylinux wheel exists). 2. installation_qwen3_5_content, installation_nemotron_nano_content and installation_gpt_oss_content all install bare "tokenizers" (no constraint), but the transformers versions they pair with declare a hard tokenizers<=0.23.0,>=0.22.0: transformers 4.56.2: tokenizers<=0.23.0,>=0.22.0 transformers 5.2.0: tokenizers<=0.23.0,>=0.22.0 PyPI's current latest tokenizers is 0.23.1, which is outside that range. Bare "tokenizers" pulls 0.23.1 into a transformers install that was never tested against it. The live notebooks already carry the constraint string "tokenizers>=0.22.0,<=0.23.0"; the templates were the drifted side. Sync templates to match. Generated artifacts updated via update_all_notebooks.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Qwen3_5_(4B)_Vision.ipynb(and the rest of the qwen3_5 / nemotron_nano / granite4 families) crashes on Colab duringfrom unsloth import FastVisionModelwith a torchcodec ABI mismatch.torchcodec 0.10againsttorch 2.10. Bothinstallation_qwen3_5_content(force-installstorch==2.8.0) andinstallation_nemotron_nano_content(force-installstorch==2.7.1) downgrade torch without touching torchcodec, so the leftover 0.10 binding tries to load and hits an undefined torch CUDA symbol the moment transformers transitively imports torchcodec.pytorch/torchcodec's compatibility table (torch 2.7->torchcodec 0.6,torch 2.8->torchcodec 0.7).Repro
Open
Qwen3_5_(4B)_Vision.ipynbon a fresh Colab runtime, run the install cell, then run the next cell. Import fails with:That symbol is a torch 2.10 CUDA C++ API entry that no longer exists in torch 2.8. The libtorchcodec binding for FFmpeg 4 (the FFmpeg version Colab ships, libavcodec.so.58 / libavutil.so.56) is the one that almost loads, but it was compiled against torch 2.10's
c10_cudaand so resolves an ABI symbol that was removed.Fix
Add inside the torch-downgrade branch of each template:
(
==0.6.0for the nemotron_nano template at torch 2.7.1.)--no-depsis defensive: torchcodec base has no unconditional runtime dependencies (only[dev]extras), so this won't pull or push torch around.Templates updated in
update_all_notebooks.pyinstallation_qwen3_5_content:!uv pip install -qqq --no-deps \"torchcodec==0.7.0\"inside the torch 2.8 branch.installation_nemotron_nano_content:!uv pip install -qqq --no-deps \"torchcodec==0.6.0\"inside the torch 2.7.1 branch.Notebooks regenerated via the updater
qwen3_5 family (uses
installation_qwen3_5_content):Qwen3_5_(0_8B)_Vision,Qwen3_5_(2B)_Vision,Qwen3_5_(4B)_Vision,Qwen3_5_(4B)_Vision_GRPO,Qwen3_5_MoE,Qwen_3_5_27B_A100(80GB)nemotron_nano family (uses
installation_nemotron_nano_content, also reused by Granite4 per the dispatcher):Nemotron-3-Nano-30B-A3B_A100,Nemotron-Nano-3-30B-A3B_A100,Granite4.0,Granite4.0_350M, plus theirKaggle-mirrors29 files total: template + 14
nb/+ 14python_scripts/mirrors.Why other torch-pinning templates are not changed
installation_gpt_oss_contentuses\"torch>=2.8.0\"rather than an==pin, so on Colab uv leaves the preinstalled torch 2.10 in place and Colab's torchcodec 0.10 still matches.installation_contentandinstallation_kaggle_contentdo not touch torch at all.Test plan
Qwen3_5_(4B)_Vision.ipynbruns the install cell, thenfrom unsloth import FastVisionModelsucceeds.import torchcodec; torchcodec.__version__reports0.7.0(qwen3_5) or0.6.0(nemotron_nano / granite4) after the install cell.