Spaces:
Running
Running
Oleg Shulyakov
commited on
Commit
·
57256b4
1
Parent(s):
f3a3278
Update paths
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
15 |
# used for restarting the space
|
16 |
SPACE_ID = os.environ.get("SPACE_ID")
|
17 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
18 |
-
CONVERSION_SCRIPT = "
|
19 |
|
20 |
# escape HTML for logging
|
21 |
def escape(s: str) -> str:
|
@@ -28,7 +28,7 @@ def escape(s: str) -> str:
|
|
28 |
|
29 |
def generate_importance_matrix(model_path: str, train_data_path: str, output_path: str):
|
30 |
imatrix_command = [
|
31 |
-
"
|
32 |
"-m", model_path,
|
33 |
"-f", train_data_path,
|
34 |
"-ngl", "99",
|
@@ -63,7 +63,7 @@ def split_upload_model(model_path: str, outdir: str, repo_id: str, oauth_token:
|
|
63 |
raise ValueError("You have to be logged in.")
|
64 |
|
65 |
split_cmd = [
|
66 |
-
"
|
67 |
"--split",
|
68 |
]
|
69 |
if split_max_size:
|
@@ -185,7 +185,7 @@ def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_rep
|
|
185 |
if train_data_file:
|
186 |
train_data_path = train_data_file.name
|
187 |
else:
|
188 |
-
train_data_path = "
|
189 |
|
190 |
print(f"Training data file path: {train_data_path}")
|
191 |
|
@@ -201,12 +201,12 @@ def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_rep
|
|
201 |
quantized_gguf_path = str(Path(outdir)/quantized_gguf_name)
|
202 |
if use_imatrix:
|
203 |
quantise_ggml = [
|
204 |
-
"
|
205 |
"--imatrix", imatrix_path, fp16, quantized_gguf_path, imatrix_q_method
|
206 |
]
|
207 |
else:
|
208 |
quantise_ggml = [
|
209 |
-
"
|
210 |
fp16, quantized_gguf_path, q_method
|
211 |
]
|
212 |
result = subprocess.run(quantise_ggml, shell=False, capture_output=True)
|
|
|
15 |
# used for restarting the space
|
16 |
SPACE_ID = os.environ.get("SPACE_ID")
|
17 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
18 |
+
CONVERSION_SCRIPT = "/app/convert_hf_to_gguf.py"
|
19 |
|
20 |
# escape HTML for logging
|
21 |
def escape(s: str) -> str:
|
|
|
28 |
|
29 |
def generate_importance_matrix(model_path: str, train_data_path: str, output_path: str):
|
30 |
imatrix_command = [
|
31 |
+
"llama-imatrix",
|
32 |
"-m", model_path,
|
33 |
"-f", train_data_path,
|
34 |
"-ngl", "99",
|
|
|
63 |
raise ValueError("You have to be logged in.")
|
64 |
|
65 |
split_cmd = [
|
66 |
+
"llama-gguf-split",
|
67 |
"--split",
|
68 |
]
|
69 |
if split_max_size:
|
|
|
185 |
if train_data_file:
|
186 |
train_data_path = train_data_file.name
|
187 |
else:
|
188 |
+
train_data_path = "train_data.txt" #fallback calibration dataset
|
189 |
|
190 |
print(f"Training data file path: {train_data_path}")
|
191 |
|
|
|
201 |
quantized_gguf_path = str(Path(outdir)/quantized_gguf_name)
|
202 |
if use_imatrix:
|
203 |
quantise_ggml = [
|
204 |
+
"llama-quantize",
|
205 |
"--imatrix", imatrix_path, fp16, quantized_gguf_path, imatrix_q_method
|
206 |
]
|
207 |
else:
|
208 |
quantise_ggml = [
|
209 |
+
"llama-quantize",
|
210 |
fp16, quantized_gguf_path, q_method
|
211 |
]
|
212 |
result = subprocess.run(quantise_ggml, shell=False, capture_output=True)
|