-
Notifications
You must be signed in to change notification settings - Fork 16
Add HF_TRUST_REMOTE_CODE
environment variable
#78
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
Conversation
The `strtobool` had to be defined within `huggingface_inference_toolkit` since it's deprecated and removed from `distutils` from Python 3.10 onwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, question: under the hood, this trust_remote_code bypasses security flags like weights_only=True in pytorch and stuff right ? (allowing for arbitrary pickle loading)
Where do you intend to activate it ? In one of your hf endpoints using a custom env variable ? (just want to make sure we do not activate it by default there :) )
It's indeed disabled by default, and explicitly enabled on the user's side if desired; to basically load models that live within the Hub repository instead of directly being supported / integrated within P.S. Thanks for the review! |
9cb211b
to
c9384c2
Compare
To add more context to this PR, it's updated here huggingface/Google-Cloud-Containers#64 |
Description
As flagged by Changyu Zhu from Google, there was no way of setting
trust_remote_code=True
when loading a model from the Hugging Face Hub that requires remote code execution; whilst for Text Generation Inference (TGI) is indeed possible via theTRUST_REMOTE_CODE
environment variable (as per https://huggingface.co/docs/text-generation-inference/en/basic_tutorials/safety).This PR adds the
HF_TRUST_REMOTE_CODE
environment variable in order to be able to set it fortransformers
,sentence-transformers
, anddiffusers
pipelines. Additionally, this PR also fixes the**kwargs
propagation for bothsentence-transformers
anddiffusers
. Finally, this PR also updates theREADME.md
accordingly as of theHF_TRUST_REMOTE_CODE
addition, while also fixing some typos and aligning the formatting.Note
As of the recent merges within #76 and #77, the version in
setup.py
has also been bumped to0.4.1
to include all those changes and generate the wheel accordingly. So on, once this PR is merged, the version in themain
branch should point to0.4.2.dev0
instead.