Allow trust_remote_code and use_fast to be specified in args for Hugging Face #2644
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.
trust_remote_code
Currently, attempting to set
trust_remote_code
inargs
forHuggingFaceClient
fails becausetrust_remote_code
is already hardcoded toTrue
, resulting in the error message:We fix this by only passing
trust_remote_code=True
toAutoModelForCausalLM
if it is not specified inargs
. Eventually we will break backwards compatibility - we will stop passingtrust_remote_code=True
if unspecified, and require users to specify ittrust_remote_code
inargs
if they need it. This is because thetrust_remote_code=True
default is a security risk.use_fast
Currently, it is not possible to set
use_fast
for Hugging Face tokenizers, because two different Hugging Face tokenizers are instantiated for a run that usesHuggingFaceClient
, one insideHuggingFaceClient
here and one insideHuggingFaceTokenizer
. This is problematic because the first tokenizer is instantiated using theargs
from themodel_deployment.yaml
, not theargs
fromtokenizer_config.yaml
, whereas the second tokenizer is instantiated using theargs
fromtokenizer_config.yaml
. Attempting to setuse_fast
inmodel_deployments.yaml
results in this error:We fix this by deleting the first tokenizer and only using the second tokenizer.
Fixes #2639