transformers
dbea1093 - Fix Glm4MoeIntegrationTest: split into 3 tests, switch to GLM-4.5-Air (#48820)

Commit
34 days ago
Fix Glm4MoeIntegrationTest: split into 3 tests, switch to GLM-4.5-Air (#48820) * Fix Glm4MoeIntegrationTest: device_map=auto, bfloat16, MemoryCleanupMixin - Switch from device_map=torch_device to device_map="auto" so the model spreads across available GPU + CPU RAM instead of cramming onto one GPU - Reduce max_new_tokens from 40 to 3 to avoid OOM during generation - Comment out value assertions while we establish a working baseline - Adopt MemoryCleanupMixin get_model() classmethod pattern (shared model across tests, automatic teardown via mixin) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Switch to 4-bit quantization: bfloat16 (716 GiB) OOMs both runners Loading GLM-4.5 in bfloat16 with device_map=auto requires ~716 GiB (358B params × 2 bytes) which exceeds the 395 GiB available (373 GiB RAM + 22 GiB GPU), crashing both test runners. 4-bit quantization reduces the footprint to ~179 GiB, which fits comfortably within available memory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix Glm4MoeIntegrationTest: offload_folder + remove 4bit quantization Replace BitsAndBytesConfig(load_in_4bit) with offload_folder pattern (matching glm4v_moe fix in f24b457b): tempfile.TemporaryDirectory, 70% max_memory cap for multi-GPU headroom, dtype="auto". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Comment out generate calls in Glm4MoeIntegrationTest, keep only loading Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [Temp] Fail check_bad_commit early to skip find-bad-commit job Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Uncomment dynamic generate in Glm4MoeIntegrationTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Switch to GLM-4.5-Air (106B/12B active) and comment out generate for load time check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Split Glm4MoeIntegrationTest into 3 test methods (dynamic/static/compile) - Uses GLM-4.5-Air (106B/12B active, ~206 GB) - 10 tokens each, ordered 1/2/3 to ensure compile runs last - EXPECTED_TEXT_COMPLETION = None (TODO: update after CI run) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Reduce to 5 tokens, enable asserts (EXPECTED_TEXT_COMPLETION=None to capture actuals from CI) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix Glm4MoeIntegrationTest: GLM-4.5-Air, 3 separate tests, expected values - Switch to zai-org/GLM-4.5-Air (106B/12B active, ~206 GB) - Split into test_1_dynamic_cache, test_2_static_cache, test_3_compile_static_cache - Skip compile test: offloaded models cannot be compiled with torch.compile - 5 tokens, expected values from CI run Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Move torch import inside is_torch_available() guard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Use dtype=torch.bfloat16 explicitly instead of dtype="auto" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Restore 70% per-GPU max_memory cap to avoid CUDA OOM on multi-GPU runners Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add CPU memory cap via get_cpu_ram_total_gib to avoid disk offload on multi-GPU Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Use 90% of CPU RAM to avoid runner exit code 137 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix ruff formatting in glm4_moe max_memory cpu line Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Use dtype="auto" to preserve native mixed precision from checkpoint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Revert dummy check_bad_commit.py change Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Remove redundant @slow/@require_torch_accelerator from test methods Class-level decorators already cover all methods. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Author
Parents
Loading