fix(ci): keep the transformers<5.0 pin through the package install - #9862
fix(ci): keep the transformers<5.0 pin through the package install#9862he-yufeng wants to merge 3 commits into
Conversation
The pin line runs before pip install ., but a pip invocation keeps no constraints across runs. The package install re-resolves trl (floor transformers>=4.56.2) against framework.txt's <5.15.0 and jumps to transformers 5.14.1, after which the suite dies importing transformers.models.gemma3 (currently red on every PR, e.g. modelscope#9854). Carrying the pin into the package install keeps the resolver on the 4.x line the tests are written for; verified it selects 4.57.6 with trl 0.29.1 in the same run. Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
|
I traced the full failing run and found a second resolver mutation that this patch does not cover. In run 31179195838, the initial pin correctly installs Transformers 4.57.6. Later, The same sequence appears in the five currently red PR runs (#9850, #9852, #9859, #9870, #9871). Therefore carrying |
Suites that load modelscope remote code install the model's own pinned requirements into the shared test environment (StructBERT in test_merged_linear.py pulls transformers==4.48.3), so later suites like test_gemma3_template run against a transformers layout they do not support. Snapshot the transformers/peft/huggingface-hub versions after env setup and reinstall them when a finished suite changed them; no-op for suites that leave the env alone. Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
|
@RerankerGuo Good catch, that StructBERT install explains the rest of the red runs. I went with the restore option in 5d534f7. Preventing the model's requirements install would break test_merged_linear itself, since the remote code needs its pinned set to load. Isolating every suite in its own venv would work but is a much bigger change to the runner. Restoring after the suite keeps both sides intact: StructBERT runs on 4.48.3 inside its own suite, and the next suite starts on the supported set again. What the patch does in tests/run.py:
Your traced sequence is covered: test_merged_linear gets its 4.48.3 during its own run, then the restore puts 4.57.6 back before test_gemma3_template starts. huggingface-hub is in the snapshot list too, though reinstalling transformers 4.57.6 would pull it back above the required floor either way. Verified locally with py_compile plus a standalone run of the record/restore logic (records versions, no-op without drift, reinstalls the pinned version with drift). I cannot reproduce the modelscope remote-code install on this machine, so the real check is this PR's CI run. |
The restore hook added in 5d534f7 only runs between worker processes, but with the default --parallel 1 all remaining suites of an env share one chunk process, so a suite that pip-installs its model's own requirements still poisons the suites after it in that chunk (test_dataset then fails importing AssistantVocabTranslatorCache/QuantizedCacheConfig, missing in transformers 4.48.3). Run each per-file sub-suite in turn and restore between them; single-suite workers are unaffected. Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
|
Follow-up on the run of the restore commit: it still went red, and the log shows exactly why. The two errors are The gap was in my first patch's coverage, not in the approach. With the CI default Verified locally: py_compile plus a unittest-semantics check that the gathered suite iterates per-file. The CI run on this head is the real proof again. |
The pin line in the CUDA path runs before
pip install ., but pip keeps no constraints across invocations. The package install then re-resolves trl (floortransformers>=4.56.2) against framework.txt's<5.15.0and jumps to transformers 5.14.1, after which the suite dies importingtransformers.models.gemma3. Every PR is red on this right now (confirmed on mine and on #9854, same error in the same step).Carrying the pin into the package install keeps the resolver on the 4.x line the suite is written for. Verified with the actual resolver:
trl==0.29.1+transformers<5.0in one run selects transformers 4.57.6, which satisfies trl's floor and keeps gemma3 importable.The NPU path already carries the pin inside its own command and is untouched. Whether framework.txt itself should drop
<5.15.0for users is a bigger support-range question I left alone here.