-
Notifications
You must be signed in to change notification settings - Fork 271
Support loading hugging face checkpoint #1165
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
Changes from all commits
d3a8f9c
ff76274
99dc97f
72a39e2
c04cd96
0cb125c
6d5e0ac
3650fc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,6 +246,14 @@ def setup_model(args, model_dtype, model_kwargs, logger): | |
| torch_dtype=model_dtype, | ||
| **model_kwargs, | ||
| ) | ||
| elif args.load_quantized_model: | ||
| from neural_compressor.torch.quantization import load | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ulivne sounds like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
neural_compressor is installed automatically as part of habana software stack. it replaces habana_quantization_toolkit which was also not part of requirements. |
||
| model = load( | ||
| model_name_or_path=args.model_name_or_path, | ||
| format="huggingface", | ||
| device="hpu", | ||
| **model_kwargs | ||
| ) | ||
| else: | ||
| if args.assistant_model is not None: | ||
| assistant_model = AutoModelForCausalLM.from_pretrained( | ||
|
|
@@ -619,6 +627,9 @@ def initialize_model(args, logger): | |
| "trust_remote_code": args.trust_remote_code, | ||
| } | ||
|
|
||
| if args.load_quantized_model: | ||
| model_kwargs["torch_dtype"] = torch.bfloat16 | ||
|
|
||
| if args.trust_remote_code: | ||
| logger.warning("`trust_remote_code` is set, there is no guarantee this model works properly and it may fail") | ||
|
|
||
|
|
||
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.
one line missing here