-
Notifications
You must be signed in to change notification settings - Fork 384
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
FEAT: add support for local model checkpoints and trust_remote_code in HuggingFaceChatTarget #574
FEAT: add support for local model checkpoints and trust_remote_code in HuggingFaceChatTarget #574
Conversation
…ingFaceChatTarget
Hello @romanlutz, The current demo was just a POC and includes unnecessary elements. Please share your feedback on further enhancements and any other suggestions if needed :) |
Looks amazing @KutalVolkan ! That was incredibly fast 😅 Tests moved to the targets directory I think. https://github.com/Azure/PyRIT/blob/main/tests/target/test_huggingface_chat_target.py |
Thank you, Roman! 😊 It might seem fast, but sometimes it’s just the time zone magic at work. I’m glad we’re keeping things efficient, though! Let me know if there’s anything else I should add. |
Thank you @rdheekonda & @romanlutz for the support and guidance :) |
Overview
This pull request adds support for loading local model checkpoints in the
HuggingFaceChatTarget
class through the newmodel_path
parameter. It also introduces thetrust_remote_code
parameter to handle models that require executing custom code during loading.These enhancements improve the flexibility and usability of the
HuggingFaceChatTarget
class by enabling users to:model_path
parameter, supporting local model checkpoints.trust_remote_code=True
, necessary for models likemicrosoft/Phi-3-mini-4k-instruct
.Work Completed
HuggingFaceChatTarget
Class:model_path
Parameter:__init__
method to include the optionalmodel_path
parameter.load_model_and_tokenizer
method to load models from a local directory whenmodel_path
is provided.trust_remote_code
Parameter:trust_remote_code
parameter with a default value ofFalse
to the__init__
method.trust_remote_code
to thefrom_pretrained
methods when loading the tokenizer and model.model_id
.trust_remote_code=False
, so models that do not require it are unaffected.Related Issue
Issue #572