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.
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.
While changing the key from
'seq_len'to'n_samples'is a good correction for semantic accuracy, there's a potential issue if'n_samples'is missing fromcalib_cfg.Currently, if
'n_samples'is not found,self.n_samplesdefaults toNone. ThisNonevalue, when subsequently used by preprocessing functions (e.g., inllmc/data/dataset/specified_preproc.py), is likely to cause aTypeError. For instance:wikitext2_gptqusen_samplesinrange(n_samples), andrange(None)is an error.pileval_awqusen_samplesin a loop break condition (if n_run == n_samples:). Ifn_samplesisNone, the loop might process the entire dataset, leading to unexpected behavior or performance issues.img_generalusen_samplesin comparisons (len(calib_dataset) > n_samples), which will also error withNone.To make this more robust and prevent runtime crashes due to incomplete configurations, consider providing a default integer value for
n_samples. A value like128is used in several example configurations (e.g.,configs/quantization/methods/Awq/awq_w_only.yml).Alternatively, if
n_samplesis a strictly required parameter, accessing it directly viacalib_cfg['n_samples']would raise aKeyErrorimmediately if it's missing, which is a more explicit way to handle mandatory configurations. However, providing a sensible default is often a good balance.