Download 14B/scripts/test_cpu.py from Elastic-forcing/Elastic-forcing-code: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/Elastic-forcing/Elastic-forcing-code/resolve/main/14B/scripts/test_cpu.py
- Command line
-
hf download hf://Elastic-forcing/Elastic-forcing-code/14B/scripts/test_cpu.py
-
curl -L -o test_cpu.py https://huggingface.co/Elastic-forcing/Elastic-forcing-code/resolve/main/14B/scripts/test_cpu.py
1.43 kB
| #!/usr/bin/env python3 | |
| """Run existing CPU tensor tests without initializing the historical T5 CUDA default.""" | |
| import os | |
| from pathlib import Path | |
| import sys | |
| from unittest.mock import patch | |
| ROOT = Path(__file__).resolve().parents[1] | |
| os.environ['CUDA_VISIBLE_DEVICES'] = '' | |
| os.environ.setdefault('OMP_NUM_THREADS', '2') | |
| os.environ['PYTHONDONTWRITEBYTECODE'] = '1' | |
| sys.dont_write_bytecode = True | |
| sys.path.insert(0, str(ROOT/'code')) | |
| os.chdir(ROOT/'code') | |
| import torch | |
| import pytest | |
| # Only bypass import-time device discovery. No model weights or CUDA tensors load. | |
| # Original sources remain untouched; the patch is removed before executing tests. | |
| with patch('torch.cuda.current_device', return_value=0): | |
| from trainer.distillation import Trainer | |
| from model.wan_kv_mmd import WanKVMMD | |
| raise SystemExit(pytest.main([ | |
| '-q', '-p', 'no:cacheprovider', | |
| 'tests/test_triple_partial_geometry.py', | |
| 'tests/test_readable_config.py', | |
| 'tests/test_evaluated_inference.py', | |
| 'tests/test_active_encoder_offload.py', | |
| 'tests/test_no_dinov3_filtered_bank.py', | |
| 'tests/test_no_dinov3_ablation.py', | |
| 'tests/test_release_schedule.py', | |
| 'tests/test_triple_video_feature_bank.py', | |
| 'tests/test_triple_feature_metadata_contract.py', | |
| 'tests/test_triple_pixel_cotangent_accumulation.py', | |
| 'tests/test_video_nystrom_partial_mmd.py', | |
| 'tests/test_multi_representation_video_nystrom_mmd.py', | |
| ] + sys.argv[1:])) | |