Parameterize trust_remote_code for quark_visitai#2575
Open
shaahji wants to merge 2 commits into
Open
Conversation
trust_remote_code was being defaulted to True raising security concerns. Replacing the default with user driven value thru' the config.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes Quark Vitis AI quantization safer by removing hard-coded trust_remote_code=True in Hugging Face model/tokenizer loading and instead deriving the value from user configuration (pass config and/or the model handler load kwargs).
Changes:
- Add
trust_remote_codeparameters to Quark Vitis AI LLM model/tokenizer preparation helpers and propagate intofrom_pretrained(...). - Introduce a
trust_remote_codepass config knob inQuarkQuantizationVitisAIand plumb the resolved value into the torch quantization runner. - Update the quantization runner to pass
trust_remote_codethrough to model/tokenizer loading.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
olive/passes/quark_vitisai/torch/language_modeling/llm_utils/model_preparation.py |
Parameterizes trust_remote_code for tokenizer/model loads (and tokenizer re-load in save_model) instead of forcing True. |
olive/passes/quark_vitisai/torch/language_modeling/llm_ptq/quantize_quark.py |
Threads trust_remote_code into get_model/get_tokenizer calls used by Quark torch quantization. |
olive/passes/quark_vitisai/quark_quantization_vitisai.py |
Adds pass-level trust_remote_code config and resolves it from model load kwargs with an explicit override path. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Parameterize
trust_remote_codefor quark_visitaitrust_remote_codewas being defaulted to True raising security concerns. Replacing the default with user driven value thru' the config.Checklist before requesting a review
lintrunner -a(Optional) Issue link