Skip to content

Prepare torch 2.12.1 / CUDA 13.2 / triton 3.7.1 / transformers 5.14.1 SFT compatibility - #1983

Open
ShilohYu wants to merge 8 commits into
InternLM:mainfrom
ShilohYu:upgrade/torch2.12.1-cu132-main-prep
Open

Prepare torch 2.12.1 / CUDA 13.2 / triton 3.7.1 / transformers 5.14.1 SFT compatibility#1983
ShilohYu wants to merge 8 commits into
InternLM:mainfrom
ShilohYu:upgrade/torch2.12.1-cu132-main-prep

Conversation

@ShilohYu

Copy link
Copy Markdown

Summary

Prepare XTuner SFT tests and runtime paths for the torch 2.12.1 / CUDA 13.2 stack.

This PR includes dependency/image updates, pytest stability fixes, and several parity fixes found during SFT validation on:

  • torch 2.12.1+cu132
  • CUDA 13.2
  • triton 3.7.1
  • transformers 5.14.1

Main Changes

  • Pin/update dependencies for the torch 2.12.1 / CUDA 13.2 validation stack.
  • Add FFmpeg runtime support for torchcodec video decoding.
  • Remove the old transformers video backend test monkeypatch and rely on torchcodec.
  • Fix Qwen3-VL / Qwen3.5-VL video tokenize oracle compatibility under transformers 5.14.
  • Fix Qwen3.5-VL vision/projector dtype boundaries.
  • Align visual feature injection with HF masked_scatter behavior.
  • Fix Dense GatedDeltaNet HF parity by using cu_seqlens=None for the single non-packed HF path.
  • Fix FP8 + FSDP sharded checkpoint instability by using non-reentrant checkpointing for the affected path.
  • Preserve float8 wrapper precomputed metadata during tensor subclass detach.
  • Fix SP shared expert parity by gathering the global sequence before dense shared expert computation, then splitting back to SP shards.
  • Add pytest/Triton cache isolation and distributed test stability fixes.

Validation

Full SFT validation was run with:

python -m pytest tests --ignore=tests/rl -vv --durations=40

336 passed / 13 skipped / 0 failed

Additional validation:
- Float8 cases passed with AdaptiveGEMM `10411e08` plus CUDA 13.2 typedef patch.

ShilohYu and others added 8 commits July 29, 2026 01:04
Co-authored-by: Cursor <cursoragent@cursor.com>
torch>=2.12 dynamo drops the bound self when a compiled outer forward
calls a method whose class attr is the raw torch.compile object, which
breaks under activation checkpointing. Wrap compiled methods so self is
forwarded explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
The mypy hook checks the entire xtuner.v1 package, so unrelated type
errors were preventing commits of otherwise clean changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Give each rank its own TRITON_CACHE_DIR so concurrent compiles of the
same kernel no longer race on shared cache files (PassManager::run
failed). Mirror production per-submodule FSDP sharding in the toy model
and average the reference gradients (SUM->AVG) so the FSDP test compares
correctly. Seed TestMuonFSDP before build and relax the distributed
tolerance to reflect bf16 Newton-Schulz + reduce-scatter roundoff
(single-GPU still asserts at 1e-6).

Co-authored-by: Cursor <cursoragent@cursor.com>
Bump BASE_IMAGE to NGC pytorch 26.03-py3 (CUDA 13.2.0.046 / cuDNN 9.20 /
NCCL 2.29.7) and torch to 2.12.1 from the cu132 wheel index. Patch
adaptive_gemm's tma_utils.cuh to alias the CUDA 12 PFN_cuTensorMapEncodeTiled
typedef removed in CUDA 13 (guarded by CUDA_VERSION>=13000, self-checked
with grep). Pin tilelang to 0.1.11 to match the validated pt121 stack.

Co-authored-by: Cursor <cursoragent@cursor.com>
Match every pinned version/commit to the glm52-pt121 conda env that the
GLM-5.2 upgrade was validated against:
- flash-attention -> 8a8b2f10 (FA3, matches flash_attn_3 8a8b2f); stop
  building/installing flash_attn 2.x since the env has only flash_attn_3
- GroupedGEMM -> 21c199d (matches grouped_gemm 1.1.4)
- flash-linear-attention -> pin tmp-tensor-cache to commit 72d2a8f
- torchvision==0.27.1, xgrammar==0.2.3, timm==1.0.28

Co-authored-by: Cursor <cursoragent@cursor.com>
Snapshot parametrize namespaces during collection, and give pytest
parent plus each DDP rank isolated Triton/Inductor cache dirs so
full-suite runs no longer hit PassManager corruption.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant