Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote code improvements #23959

Merged
merged 11 commits into from
Jun 6, 2023
Merged

Remote code improvements #23959

merged 11 commits into from
Jun 6, 2023

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Jun 2, 2023

What does this PR do?

This PR adds a few improvements to the code on the Hub API, mainly:

  • if trust_remote_code is unset, we ask the user to validate or not (with a timeout of 30s for users launchin script)
  • in case of conflict between code on the Hub and local code (for when Falcon or MPT are added in Transformers for instance), trust_remote_code=False will execute the local code, trust_remote_code=True the one on the Hub

@sgugger sgugger requested a review from LysandreJik June 2, 2023 14:42
Copy link
Member

@LysandreJik LysandreJik 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!

src/transformers/dynamic_module_utils.py Show resolved Hide resolved
src/transformers/dynamic_module_utils.py Outdated Show resolved Hide resolved
src/transformers/dynamic_module_utils.py Outdated Show resolved Hide resolved
src/transformers/dynamic_module_utils.py Outdated Show resolved Hide resolved
tests/models/auto/test_configuration_auto.py Show resolved Hide resolved
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 2, 2023

The documentation is not available anymore as the PR was closed or merged.

)


TIME_OUT_REMOTE_CODE = 30
Copy link
Member

Choose a reason for hiding this comment

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

isn't it a bit long?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have you ever seen @LysandreJik typing?

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Very nice! 🔥 Thanks for adding

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Nice, thanks for spending so much time on the tests! Appreciate it

@sgugger sgugger merged commit f1660d7 into main Jun 6, 2023
@sgugger sgugger deleted the remote_code_improvements branch June 6, 2023 18:31
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
* Fix model load when it has both code on the Hub and locally

* Add input check with timeout

* Add tests

* Apply suggestions from code review

Co-authored-by: Lysandre Debut <[email protected]>

* Some non-saved stuff

* Add feature extractors

* Add image processor

* Add model

* Add processor and tokenizer

* Reduce timeout

---------

Co-authored-by: Lysandre Debut <[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.

5 participants