Automatically select calibration datasets for code models - #2107
Automatically select calibration datasets for code models#2107changwangss wants to merge 6 commits into
Conversation
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| "codestral", | ||
| "deepseekcoder", | ||
| "granitecode", | ||
| "magicoder", |
There was a problem hiding this comment.
Is it still doable if the user wants to use Pile-10k for a code model?
There was a problem hiding this comment.
fixed the issue.
added a dataset_was_explicitly_set flag, changed the dataset default to None across all entry points, and then selected the appropriate default dataset only after determining whether the user had explicitly specified one.
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| quant_lm_head: bool = False, | ||
| to_quant_block_names: Optional[Union[str, list[str]]] = None, | ||
| dataset: Union[str, list, tuple, torch.utils.data.DataLoader] = "NeelNanda/pile-10k", | ||
| dataset: Optional[Union[str, list, tuple, torch.utils.data.DataLoader]] = None, |
There was a problem hiding this comment.
I think the API entry of AutoRound is not this one, so you need to change auto_round/autoround.py /AutoRound as well
@n1ck-guo is it possible to merge your pr ASAP, the different entries confuse developers
There was a problem hiding this comment.
Already addressed in commit 9961d8e. The public AutoRound API in auto_round/autoround.py now defaults dataset to None and forwards it unchanged, allowing the downstream orchestrator to distinguish an omitted dataset from an explicit user choice.
There was a problem hiding this comment.
There is no conflict, this is the correct modification.
| self.dataset = dataset | ||
| if self.dataset is None: | ||
| self.dataset = "NeelNanda/pile-10k" | ||
| self.dataset_was_explicitly_set = dataset is not None |
There was a problem hiding this comment.
based on the code, there is no need to save dataset_was_explicitly_set to self
There was a problem hiding this comment.
Fixed. dataset_was_explicitly_set is now a local variable because it is only needed during initialization and does not need to be stored on self.
|
|
||
| datasets_version = datasets.__version__ | ||
| parsed_version = Version(str(datasets_version)) | ||
| sources = [("opencode-instruct:concat=true", 50), ("github-code-clean", 40), ("mbpp:split=train:concat=true", 10)] |
There was a problem hiding this comment.
is there any data to support this?
There was a problem hiding this comment.
Updated based on our discussion. MBPP has been removed from the automatically selected mixture. For datasets <= 3.6.0, OpenCodeInstruct and GitHub Code Clean are now selected with a 50/50 ratio. For newer datasets versions, the code falls back to OpenCodeInstruct only because script-based GitHub Code Clean is no longer supported.
| sources = [("opencode-instruct:concat=true", 50), ("github-code-clean", 40), ("mbpp:split=train:concat=true", 10)] | ||
| if parsed_version > _GITHUB_CODE_CLEAN_MAX_DATASETS_VERSION: | ||
| sources = [source for source in sources if source[0] != "github-code-clean"] | ||
| logger.warning( |
There was a problem hiding this comment.
Fixed. Changed logger.warning() to logger.warning_once() to avoid repeatedly reporting the same datasets-version compatibility warning when multiple AutoRound instances are created.
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: changwangss <chang1.wang@intel.com>
| quant_lm_head: bool = False, | ||
| to_quant_block_names: Optional[Union[str, list[str]]] = None, | ||
| dataset: Union[str, list, tuple, torch.utils.data.DataLoader] = "NeelNanda/pile-10k", | ||
| dataset: Optional[Union[str, list, tuple, torch.utils.data.DataLoader]] = None, |
There was a problem hiding this comment.
There is no conflict, this is the correct modification.
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Automatically select code-oriented calibration datasets when quantizing a pure-text code model without an explicitly configured calibration dataset.
Add
is_code_model()following the existing model-detection style.encoder,decoder,codec, and unrelated parent directories namedcode.Select an exact-size code calibration dataset:
datasets <= 3.6.0: OpenCodeInstruct 50% and GitHub Code Clean 50%.datasets > 3.6.0: OpenCodeInstruct only, because script-based GitHub Code Clean is no longer supported.Apply automatic selection only to pure-text LLMs that require calibration.
Preserve explicit user dataset choices, including both
NeelNanda/pile-10kand itspile-10kalias.dataset/--datasetis omitted, normal models continue to use Pile-10k, while detected code models use the code-oriented calibration dataset.Keep the existing diffusion default behavior (
coco2014) unchanged.Type of Change
New feature
Related Issues
Fixes or relates to ##1986
Checklist Before Submitting
/azp run Unit-Test-CUDA-AutoRound.