You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
requirements/test-cpu.txt omits safetensors: documented CPU install aborts pytest collection #2
requirements/test-cpu.txt does not include safetensors, but a test module imports it at top level, so the documented install produces a collection error rather than a skip — no tests run at all.
Reproduction
Fresh clone at v0.2.2 (12ce733), clean venv, Python 3.13:
$ python3 -m pip install -r requirements/test-cpu.txt
$ python3 -m pip install -e .
$ python3 -m pytest -q_______________ ERROR collecting tests/test_glm52_online_grpo.py _______________ImportError while importing test module '.../tests/test_glm52_online_grpo.py'.tests/test_glm52_online_grpo.py:8: in <module> from safetensors.torch import save_fileE ModuleNotFoundError: No module named 'safetensors'!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!1 warning, 1 error in 3.84s
requirements/test-cpu.txt resolves to pytest, PyYAML (via test.txt) and torch==2.7.1+cpu. The CPU torch wheel does not pull in safetensors.
tests/test_glm52_online_grpo.py imports it unguarded at line 8, and again at line 469 (from safetensors import safe_open). Because it is a module-level import, pytest aborts the entire session on collection instead of skipping the one file.
Other optional dependencies are guarded correctly — tests/test_dapo_data_audit.py:167 skips cleanly when pyarrow is unavailable — which suggests this one is an oversight.
Fix
Adding safetensors to requirements/test.txt resolves it; after installing it, the suite collects and runs (1395 passing here). Alternatively, a pytest.importorskip("safetensors") guard would match the pyarrow pattern if the dependency is meant to stay optional.
Minor, related: torch emits UserWarning: Failed to initialize NumPy: No module named 'numpy' under the same install. Harmless for the tests that run, but numpy may be worth pinning alongside.
Activity