Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

version-compat latest lanes: install requests, stop shadowing torchcodec (#12769)

Daniel Han0095a66b8804
diff --git a/.github/workflows/version-compat-ci.yml b/.github/workflows/version-compat-ci.yml
index ee9fb7026da..2751c26aaef 100644
--- a/.github/workflows/version-compat-ci.yml
+++ b/.github/workflows/version-compat-ci.yml
@@ -226,7 +226,7 @@ jobs:
# ABI-coupled to torch, so the pair is chosen per lane. huggingface_hub unpinned: 4.x wants <1.0, 5.x >=1.5.0.
pip install ${{ matrix.pkg_pins }} \
sentencepiece protobuf safetensors numpy 'pytest>=8' \
- tqdm packaging psutil Pillow
+ tqdm packaging psutil Pillow requests
# Editable-install both repos so the test imports the
# checkouts (not whatever stale PyPI version pip resolved).
pip install --no-deps -e "$RUNNER_TEMP/unsloth-zoo"
@@ -358,7 +358,7 @@ jobs:
# TRL last so it pulls the transformers/peft it requires.
pip install ${{ matrix.pkg_pins }} \
sentencepiece protobuf safetensors numpy 'pytest>=8' \
- tqdm packaging psutil Pillow
+ tqdm packaging psutil Pillow requests
pip install ${{ matrix.trl_pin }}
pip install --no-deps -e "$RUNNER_TEMP/unsloth-zoo"
pip install --no-deps -e ./unsloth
diff --git a/tests/version_compat/test_trl_grpo_fake_run.py b/tests/version_compat/test_trl_grpo_fake_run.py
index 146db1e0982..965da811d29 100644
--- a/tests/version_compat/test_trl_grpo_fake_run.py
+++ b/tests/version_compat/test_trl_grpo_fake_run.py
@@ -54,7 +54,20 @@ def _stub_module(name: str, attrs: dict | None = None) -> None:
sys.modules[name] = m
-_stub_module("torchcodec")
+# Stand-in for torchcodec only when it is not installed, and shaped like the package: datasets
+# (5.x) does `from torchcodec.decoders import AudioDecoder, VideoDecoder` whenever its find_spec
+# probe saw torchcodec and the name is in sys.modules. A bare module answered that probe and then
+# failed the submodule import ("'torchcodec' is not a package") in every later test that built a
+# Dataset, and it also shadowed a real, working torchcodec in the lanes that install one.
+if "torchcodec" not in sys.modules and importlib.util.find_spec("torchcodec") is None:
+
+ class _NoDecoder:
+ pass
+
+ _stub_module("torchcodec")
+ sys.modules["torchcodec"].__path__ = []
+ _stub_module("torchcodec.decoders", {"AudioDecoder": _NoDecoder, "VideoDecoder": _NoDecoder})
+ sys.modules["torchcodec"].decoders = sys.modules["torchcodec.decoders"]
def _trl_version():