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

Set trust remote code for custom model #435

Conversation

wgzintel
Copy link
Contributor

  1. set trust_remote_code=true for 'baichuan', 'qwen', 'chatglm' to permit loading of these models.
  2. enable Phi2 and starcoder models.

@github-actions github-actions bot added the llm_bench Label for llm_bench/ folder label May 10, 2024
@@ -143,7 +143,12 @@ def create_text_gen_model(model_path, device, **kwargs):
else:
remote_code = False
try:
model_config = AutoConfig.from_pretrained(model_path)
remote_models = ['baichuan', 'qwen', 'chatglm']
Copy link
Collaborator

@eaidova eaidova May 13, 2024

Choose a reason for hiding this comment

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

I think we need to differentiate qwen and qwen1.5 models here, because the second one does not required remote code

Copy link
Collaborator

Choose a reason for hiding this comment

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

@eaidova Since these models throw exception in model_class.from_pretrained() instead of AutoConfig.from_pretrained(), we are thinking to catch the exception of model_class.from_pretrained() and call both AutoConfig.from_pretrained()/model_class.from_pretrained() again with trust_remote_code=True. Any preference from your side?

Copy link
Collaborator

Choose a reason for hiding this comment

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

from my side no, only possibly it may be time consuming as leads to loading model twice, but as we speak only for loading IR and model already downloaded, it should not be issue

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you please check with these changes?
#440
explicit setting trust_remote_code=False for config prevent waiting user input and allow capturing exception as expected

Copy link
Contributor Author

@wgzintel wgzintel May 16, 2024

Choose a reason for hiding this comment

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

@eaidova Merged [https://github.com//pull/440] into this PR which need to merge into 2024.1, please take a look.

@peterchen-intel peterchen-intel merged commit 86c2098 into openvinotoolkit:releases/2024/1 May 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llm_bench Label for llm_bench/ folder
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants