-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Quantize TriLM models using Q2_K_S #552
Merged
Merged
Changes from 3 commits
Commits
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 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 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 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 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 |
---|---|---|
|
@@ -104,6 +104,7 @@ static void usage(const char * executable) { | |
printf(" --leave-output-tensor: Will leave output.weight un(re)quantized. Increases model size but may also increase quality, especially when requantizing\n"); | ||
printf(" --pure: Disable k-quant mixtures and quantize all tensors to the same type\n"); | ||
printf(" --imatrix file_name: use data in file_name as importance matrix for quant optimizations\n"); | ||
printf(" --ignore-imatrix-rules: ignore built-in rules for mandatory imatrix for certain quantization types\n"); // [kawrakow] | ||
printf(" --include-weights tensor_name: use importance matrix for this/these tensor(s)\n"); | ||
printf(" --exclude-weights tensor_name: use importance matrix for this/these tensor(s)\n"); | ||
printf(" --output-tensor-type ggml_type: use this ggml_type for the output.weight tensor\n"); | ||
|
@@ -268,6 +269,8 @@ int main(int argc, char ** argv) { | |
for (; arg_idx < argc && strncmp(argv[arg_idx], "--", 2) == 0; arg_idx++) { | ||
if (strcmp(argv[arg_idx], "--leave-output-tensor") == 0) { | ||
params.quantize_output_tensor = false; | ||
} else if (strcmp(argv[arg_idx], "--ignore-imatrix-rules") == 0) { | ||
params.ignore_imatrix_rules = true; // [kawrakow] | ||
} else if (strcmp(argv[arg_idx], "--output-tensor-type") == 0) { | ||
if (arg_idx < argc-1) { | ||
params.output_tensor_type = parse_ggml_type(argv[++arg_idx]); | ||
|
@@ -422,11 +425,12 @@ int main(int argc, char ** argv) { | |
} | ||
} | ||
|
||
if ((params.ftype == LLAMA_FTYPE_MOSTLY_IQ2_XS || params.ftype == LLAMA_FTYPE_MOSTLY_IQ2_XXS || | ||
if (!params.ignore_imatrix_rules && imatrix_data.empty() && // [kawrakpow] - be able to ignore imatrix rules | ||
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. Interesting typo. |
||
(params.ftype == LLAMA_FTYPE_MOSTLY_IQ2_XS || params.ftype == LLAMA_FTYPE_MOSTLY_IQ2_XXS || | ||
params.ftype == LLAMA_FTYPE_MOSTLY_IQ2_S || | ||
params.ftype == LLAMA_FTYPE_MOSTLY_Q2_K_S || | ||
params.ftype == LLAMA_FTYPE_MOSTLY_IQ1_S || | ||
params.ftype == LLAMA_FTYPE_MOSTLY_IQ1_M) && imatrix_data.empty()) { | ||
params.ftype == LLAMA_FTYPE_MOSTLY_IQ1_M)) { | ||
fprintf(stderr, "\n==========================================================================================================\n"); | ||
fprintf(stderr, "Please do not use IQ1_S, IQ1_M, IQ2_S, IQ2_XXS, IQ2_XS or Q2_K_S quantization without an importance matrix\n"); | ||
fprintf(stderr, "==========================================================================================================\n\n\n"); | ||
|
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.
Could you add a an
// [kawrakow] ...
comment to every line that's been changed underllama.cpp/
? That makes it easy for me to synchronize sources. Thanks!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.
Should be good now.