Skip to content

Conversation

August-murr
Copy link
Contributor

What does this PR do?

Fixes #40496

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@Rocketknight1

@Rocketknight1
Copy link
Member

Hi @August-murr, can you add a test that breaks on older versions, that we can use to verify that this works and is fixing the problem?

@August-murr
Copy link
Contributor Author

@Rocketknight1
I created a test model, which is a tiny-qwen used by trl, with dots in the name and relative imports at August4293/test-model_v1.0 to reproduce the bug. Is hosting under my personal account a concern?

Also, Copilot suggested adding @slow since the test downloads from Hub. Should I add it?

Copy link
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now! I'm going to compact the docstring, just so it isn't 10X longer than the function itself, and also copy the repo to hf-internal-testing, because it's quite risky to have a remote_code test that's owned by an external user.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto

@Rocketknight1 Rocketknight1 enabled auto-merge (squash) September 10, 2025 14:33
@Rocketknight1 Rocketknight1 merged commit abbed70 into huggingface:main Sep 10, 2025
23 checks passed
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/transformers that referenced this pull request Oct 2, 2025
* Fix module loading for models with dots in names

* quality check

* added test

* wrong import

* Trigger CI rerun after making test model public

* Update src/transformers/dynamic_module_utils.py

* Update tests/utils/test_dynamic_module_utils.py

* Update tests/utils/test_dynamic_module_utils.py

* Move test

* make fixup

---------

Co-authored-by: Matt <[email protected]>
Co-authored-by: Matt <[email protected]>
yuchenxie4645 pushed a commit to yuchenxie4645/transformers that referenced this pull request Oct 4, 2025
* Fix module loading for models with dots in names

* quality check

* added test

* wrong import

* Trigger CI rerun after making test model public

* Update src/transformers/dynamic_module_utils.py

* Update tests/utils/test_dynamic_module_utils.py

* Update tests/utils/test_dynamic_module_utils.py

* Move test

* make fixup

---------

Co-authored-by: Matt <[email protected]>
Co-authored-by: Matt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutoModel.from_pretrained() doesn't work for models with '.' in their name when there's a relative import
3 participants