Skip to content

Allow quantize to only copy tensors, other improvements #2931

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 2 commits into from
Sep 1, 2023

Conversation

KerfuffleV2
Copy link
Collaborator

You can now specify copy as the type to the quantize tool to only copy tensors, never quantize. I forget where I saw it, but it was recently mentioned that something like could be used to convert/repackage from stuff like GGUF V1 to GGUF V2.

This also improves the logic in the actual quantize function (mainly for k-quants) to be a bit smarter when requantizing to the same format. The current logic skips quantizing when quantize_type == tensor->type. However, this means the k-quants logic for stuff like counting numbers of tensors to decide whether to use more bits doesn't run. The result is if you quantize to q4_k_m and then requantize to q4_k_m stuff like requantizing q6_k tensors to q4_k will occur. Not super likely, but I recall reading a pull recently where someone was confused by behavior like that and making it work a little more intuitively is pretty easy. (Of course, if the k-quants strategy changes then you're still going to have a bad time but this change is at least as good as the status quo.)

@ghost
Copy link

ghost commented Aug 31, 2023

Related: #2821 (comment)

@KerfuffleV2 KerfuffleV2 merged commit 5d6f19f into ggml-org:master Sep 1, 2023
@KerfuffleV2 KerfuffleV2 deleted the feat-quantize-copy branch September 6, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants