Skip to content

Commit 076bdd5

Browse files
committed
fix: remove python shim for already removed codec files
Signed-off-by: anubhutiv <anubhutiv@nvidia.com>
1 parent 21a7f29 commit 076bdd5

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

docker/rl/codec-file-removals.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
/opt/nemo_rl_venv/lib/python3.*/site-packages/_soundfile_data/libsndfile_*.so
77
/opt/ray_venvs/*/lib/python3.*/site-packages/_soundfile_data/libsndfile_*.so
88
/opt/uv_cache/archive-v0/*/_soundfile_data/libsndfile_*.so
9+
/opt/nemo_rl_venv/lib/python3.*/site-packages/soundfile.py
10+
/opt/ray_venvs/*/lib/python3.*/site-packages/soundfile.py
11+
/opt/uv_cache/archive-v0/*/soundfile.py

tests/smoke_gpu/test_rl_training.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
"/opt/nemo_rl_venv/lib/python3.*/site-packages/_soundfile_data/libsndfile_*.so",
3737
"/opt/ray_venvs/*/lib/python3.*/site-packages/_soundfile_data/libsndfile_*.so",
3838
"/opt/uv_cache/archive-v0/*/_soundfile_data/libsndfile_*.so",
39+
# The shim is removed with the codec; see docker/rl/codec-file-removals.txt for why
40+
# keeping it is worse than not shipping soundfile at all.
41+
"/opt/nemo_rl_venv/lib/python3.*/site-packages/soundfile.py",
42+
"/opt/ray_venvs/*/lib/python3.*/site-packages/soundfile.py",
43+
"/opt/uv_cache/archive-v0/*/soundfile.py",
3944
)
4045

4146
# Actor FQN -> packages that must import inside that actor's venv.
@@ -230,6 +235,27 @@ def test_soundfile_libsndfile_removed():
230235
assert remaining == [], f"codec cleanup left scanner-visible libsndfile files: {remaining}"
231236

232237

238+
@pytest.mark.smoke_nmp_rl_training
239+
def test_transformers_audio_backend_probe_is_off():
240+
"""Removing the codec must also switch off the probe that guards its import.
241+
242+
``transformers.audio_utils`` does ``if is_soundfile_available(): import soundfile``,
243+
and that probe is ``find_spec("soundfile")`` -- file presence, not loadability. Delete
244+
the codec but keep the module and the probe says yes to a backend that then fails to
245+
dlopen, so ``from transformers import AutoProcessor`` raises. That import is at module
246+
scope in ``nemo_rl.algorithms.grpo``, so the GRPO driver dies before it reads a config.
247+
"""
248+
from transformers.utils.import_utils import is_soundfile_available
249+
250+
assert not is_soundfile_available()
251+
252+
253+
@pytest.mark.smoke_nmp_rl_training
254+
def test_grpo_driver_module_imports():
255+
"""The exact import the GRPO driver performs first, and the one the codec strip broke."""
256+
from nemo_rl.algorithms.grpo import MasterConfig # noqa: F401
257+
258+
233259
@pytest.mark.smoke_nmp_rl_training
234260
def test_no_git_directories_shipped():
235261
"""The published image must not carry repository history.

0 commit comments

Comments
 (0)