Skip to content

Commit

Permalink
issue in llama.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchitvj committed Mar 24, 2024
1 parent 1bb1216 commit a7354ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llm_quantize/quantize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import subprocess
import sys
import os


def execute_commands(model_dir_path, quantization=None):
Expand All @@ -13,7 +13,7 @@ def execute_commands(model_dir_path, quantization=None):
if quantization:
model_file = f"llama.cpp/models/{model_dir_path}/ggml-model-f16.gguf"
quantized_model_file = f"llama.cpp/models/{model_dir_path.split('/')[-1]}/ggml-model-{quantization}.gguf"
subprocess.run(["llama.cpp/llm_quantize", model_file, quantized_model_file, quantization], check=True)
subprocess.run(["llama.cpp/quantize", model_file, quantized_model_file, quantization], check=True)

else:
print("llama.cpp doesn't exist, check readme how to clone.")
Expand Down
1 change: 1 addition & 0 deletions src/grag/quantize/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
if user_input != "":
root_path = user_input

# noinspection PyNoneFunctionAssignment
res = get_llamacpp_repo(root_path)

if "Already up to date." in str(res.stdout):
Expand Down
2 changes: 1 addition & 1 deletion src/grag/quantize/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ def quantize_model(model_dir_path: str, quantization: str, root_path: str) -> No
subprocess.run(["python3", "convert.py", f"models/{model_dir_path}/"], check=True)
model_file = f"models/{model_dir_path}/ggml-model-f32.gguf"
quantized_model_file = f"models/{model_dir_path.split('/')[-1]}/ggml-model-{quantization}.gguf"
subprocess.run(["quantize", model_file, quantized_model_file, quantization], check=True)
subprocess.run(["./quantize", model_file, quantized_model_file, quantization], check=True)
print(f"Quantized model present at {root_path}/llama.cpp/{quantized_model_file}")
os.chdir(Path(__file__).parent) # Return to the root path after operation

0 comments on commit a7354ee

Please sign in to comment.