gguf-py : fix and simplify quantized shape round-trip#7483
Merged
Conversation
13 tasks
compilade
commented
May 23, 2024
| tensor_names.add(tensor_name) | ||
| ggml_type = GGMLQuantizationType(raw_dtype[0]) | ||
| n_elems = int(np.prod(dims)) | ||
| np_dims = tuple(reversed(dims.tolist())) |
Collaborator
Author
There was a problem hiding this comment.
.tolist() is necessary here to avoid an error when reshaping afterwards, something about the shape being of type np.float64 for some reason.
ggerganov
approved these changes
May 23, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#7234 has broken quantized tensor copy in
gguf-new-metadata.py. (thanks @CISC for finding this! ref: #7234 (comment))This was originally reported for
IQ4_NL, but I think it affects all quantized tensor types.(Converted models are fine, no worries. This fixes a crash of
gguf-new-metadata.py)Summary of changes
quant_shape_from_byte_shapeandquant_shape_to_byte_shapeto convert between shapesReaderTensorto the shape GGUFWriter expects to receiveshapeof theReaderTensors are left unchanged to avoid changing the behavior ofgguf-dump.pyTesting
Q8_0Q8_0bloom model when addinggeneral.descriptionwithgguf-new-metadata.py, then removing it, and the resulting model file has the same checksum as the original model.IQ4_NLIQ4_NL. The checksums match.