Repository navigation
Conversation
|
cc @ydshieh @tarekziade - I'm not sure we want to modify the actual code for this, but maybe there's some way we can fix it in the tests? |
|
I don't think this change will help, this call is a no-op for the worker once The cleanest place to neutralize this is so we could call : at the top of conftest WDYT @ydshieh |
|
@tarekziade Thanks for the valuable feedback. My original solution worked, but it seems it violates architectural purity. I tested your suggestion against my reproducible script/test and it worked well. |
What does this PR do?
This PR fixes a distributed race condition in dynamic_module_utils.py that causes intermittent ModuleNotFoundError: No module named 'transformers_modules' failures when running tests with pytest-xdist, ffaced in #45687 pr ci/cd test
Root Cause
When running in parallel (e.g., -n 8), each worker process has an isolated sys.path.
fix:
I have added a call to init_hf_modules() at the start of get_class_in_module. This ensures every worker process correctly configures its environment before attempting an import, regardless of which worker performed the initial download.
Code Agent Policy
The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. We are currently bottlenecked by our ability to review and respond to them. As a result,
we ask that new users do not submit pure code agent PRs at this time.
You may use code agents in drafting or to help you diagnose issues. We'd also ask autonomous "OpenClaw"-like agents
not to open any PRs or issues for the moment.
PRs that appear to be fully agent-written will probably be closed without review, and we may block users who do this
repeatedly or maliciously.
This is a rapidly-evolving situation that's causing significant shockwaves in the open-source community. As a result,
this policy is likely to be updated regularly in the near future. For more information, please read
CONTRIBUTING.md.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@Rocketknight1
@Cyrilvallez