-
Notifications
You must be signed in to change notification settings - Fork 3.2k
PTQ model support, quant_cfg, and documentation updates #13519
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9fe6457
Enable changing quant_cfg via command line in the ptq.py script
janekl 75df622
Add config to HFDeepSeekExporter
janekl 08ed32b
Use MODEL_NAME_TO_TYPE directly from model_utils
janekl 9357650
Merge branch 'main' into jlasek/quant_cfg_overrides
janekl 33a5053
Utility to detect HF DeepSeek version
janekl fedfd64
Apply isort and black reformatting
janekl 65952e6
Update broken links
janekl b2e9a5b
Rename temp var
janekl 968a36c
Give up quant_cfg_overrides param
janekl 058dc4b
Get model_type for HFAutoModelForCausalLM with mte
janekl 0715a40
Merge branch 'main' into jlasek/quant_cfg_overrides
janekl 985a94f
Utils to load quant_cfg from JSON file
janekl aee74f2
Apply isort and black reformatting
janekl 56f1233
Update quantization.rst links
janekl d6fa0cc
Improve load_quant_cfg plus unit test
janekl 890be02
Enable loading quant_cfg from a JSON file
janekl 9d32e32
Bugfix for AWQ methods
janekl 1e788f9
Apply isort and black reformatting
janekl 5c25289
Merge branch 'main' into jlasek/quant_cfg_overrides
janekl 62dd00d
Add copyright headers
janekl 685f8fd
Merge branch 'main' into jlasek/quant_cfg_overrides
janekl eedbfdc
Format error msg
janekl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Empty file.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import ast | ||
| from typing import Any, Dict | ||
|
|
||
|
|
||
| def update_nested_dict(dict_: Dict[str, Any], update: str, separator: str = '.') -> None: | ||
| """ | ||
| Update a nested dictionary in-place with a key path and a new value. The update string should be in | ||
| the format 'key1.key2.key3=new_value' for the default dot separator -- which hence must not be a part | ||
| of any key. The new value will be converted to its appropriate type using ast.literal_eval. | ||
|
|
||
| Args: | ||
| dict_ (Dict[str, Any]): The dictionary to update. | ||
| update (str): The update string in the format 'key1.key2.key3=new_value' (for separator="."). | ||
| separator (str): The separator used to split the key path. Default is '.'. | ||
| """ | ||
| # Split the update string into key path and new value | ||
| assert update.count("=") == 1, "Update string must contain exactly one '=' to separate key path and value." | ||
| key_path, value = update.split("=") | ||
| keys = key_path.split(separator) | ||
|
|
||
| # Traverse the nested dictionary & update the final key with new value | ||
| current_dict = dict_ | ||
| for key in keys[:-1]: | ||
| current_dict = current_dict[key] | ||
|
|
||
| last_key = keys[-1] | ||
| current_dict[last_key] = ast.literal_eval(value) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.