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

add --trust_remote_code for text generation examples #870

Merged
merged 3 commits into from
May 3, 2024

Conversation

yangulei
Copy link
Contributor

@yangulei yangulei commented Apr 7, 2024

Add --trust_remote_code argument for text generation examples to allow the custom models defined on the Hub in their own modeling files.

@ssarkar2 ssarkar2 requested review from ssarkar2 and removed request for ssarkar2 April 9, 2024 21:09
Copy link
Collaborator

@ssarkar2 ssarkar2 left a comment

Choose a reason for hiding this comment

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

LGTM otherwise, minor comment regarding the help message

@ssarkar2 ssarkar2 added the run-test Run CI for PRs from external contributors label Apr 25, 2024
Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

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

This one is tricky as remote code offers absolutely no guarantee of compliance with the Transformers API. I've pushed back against it in the past because this example will for sure fail with at least a few models with remote code out there.
I'm okay with allowing it, but let's log a warning that clearly states that trust_remote_code is true so this example may fail as this model doesn't necessarily follow the Transformers API.

@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.

Adding warning print as suggested by @regiss
Co-authored-by: regisss <15324346+regisss@users.noreply.github.com>
@regisss regisss added run-test Run CI for PRs from external contributors and removed run-test Run CI for PRs from external contributors labels May 3, 2024
@regisss regisss merged commit b54e5c3 into huggingface:main May 3, 2024
11 of 12 checks passed
ccrhx4 pushed a commit to ccrhx4/ccrhx4.optimum-habana that referenced this pull request May 11, 2024
Co-authored-by: Sayantan Sarkar <supersarkar@gmail.com>
Co-authored-by: regisss <15324346+regisss@users.noreply.github.com>
@ImtiazSajwani
Copy link

Thanks for the quick workaround but I am still seeing the error

$git status
On branch remote_code

File "/usr/local/lib/python3.10/dist-packages/transformers/dynamic_module_utils.py", line 621, in resolve_trust_remote_code
raise ValueError(
ValueError: Loading requires you to execute the configuration file in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option trust_remote_code=True to remove this error.
[

@yangulei
Copy link
Contributor Author

@ImtiazSajwani Could you share the command to reproduce this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-test Run CI for PRs from external contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants