-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Add quantize script for batch quantization #92
Merged
Merged
Conversation
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
ggerganov
approved these changes
Mar 13, 2023
I wrote up a basic python implementation of the same script for Windows users, would it be worth making a pull request to replace the batch script? import os
import re
import sys
def print_usage():
print("Usage: llama-quantize.py 7B|13B|30B|65B [--remove-f16]")
exit(0)
if not len(sys.argv) > 1:
print_usage()
regex_test = re.compile("^[0-9]{1,2}B$")
if not regex_test.match(sys.argv[1]):
print_usage()
model_directory = f"./models/{sys.argv[1]}/"
if not os.path.exists(model_directory):
print("Failed to find model directory")
print_usage()
for file in os.listdir(model_directory):
if not "ggml-model-f16.bin" in file:
continue
file = os.path.join(model_directory, file)
new_name = file.replace("f16", "q4_0")
binary_name = "./quantize"
if sys.platform == "win32":
binary_name += ".exe"
binary_name = binary_name[2:]
os.system(f"{binary_name} {file} {new_name} 2")
if len(sys.argv) > 2:
if sys.argv[2] == "--remove-f16":
os.remove(file) |
This comment was marked as outdated.
This comment was marked as outdated.
dmahurin
pushed a commit
to dmahurin/llama.cpp
that referenced
this pull request
May 31, 2023
dmahurin
pushed a commit
to dmahurin/llama.cpp
that referenced
this pull request
Jun 1, 2023
Deadsg
pushed a commit
to Deadsg/llama.cpp
that referenced
this pull request
Dec 19, 2023
This was referenced Mar 2, 2024
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.
Alternative to #17 suggested in #17 (comment)