Fix custom generate from local directory#38916
Merged
manueldeprada merged 1 commit intohuggingface:mainfrom Jun 20, 2025
Merged
Fix custom generate from local directory#38916manueldeprada merged 1 commit intohuggingface:mainfrom
manueldeprada merged 1 commit intohuggingface:mainfrom
Conversation
|
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. |
4369eaa to
df03945
Compare
1. Create parent dirs before copying files (custom_generate dir) 2. Correctly copy relative imports to the submodule file. 3. Update docs.
df03945 to
114b57d
Compare
gante
approved these changes
Jun 20, 2025
Contributor
gante
left a comment
There was a problem hiding this comment.
LGTM :)
Missing: a test. E.g. we can add a custom_generate folder in tests/fixtures and test we can run it in GenerationIntegrationTests
manueldeprada
added a commit
to manueldeprada/transformers
that referenced
this pull request
Jun 24, 2025
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
zaristei
pushed a commit
to zaristei/transformers
that referenced
this pull request
Sep 9, 2025
…h imports) (huggingface#39015) * create test for huggingface#38916 (custom generate from local dir with imports)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Passing a local folder to
custom_generateviamodel.generate(**inputs, custom_generate="custom_generate_example", ...)fails becauseshutil.copyinsrc/transformers/dynamic_module_utils.pysilently fails if the parent directory structure doesn't exist.So, this PR does: