Spaces:
Sleeping
Sleeping
Oleg Shulyakov
commited on
Commit
·
d209476
1
Parent(s):
bdc0d9e
Small changes
Browse files
app.py
CHANGED
|
@@ -11,10 +11,11 @@ from pathlib import Path
|
|
| 11 |
from textwrap import dedent
|
| 12 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 13 |
|
| 14 |
-
|
| 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
|
|
@@ -27,6 +28,10 @@ def escape(s: str) -> str:
|
|
| 27 |
return s
|
| 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,
|
|
@@ -35,11 +40,6 @@ def generate_importance_matrix(model_path: str, train_data_path: str, output_pat
|
|
| 35 |
"--output-frequency", "10",
|
| 36 |
"-o", output_path,
|
| 37 |
]
|
| 38 |
-
|
| 39 |
-
if not os.path.isfile(model_path):
|
| 40 |
-
raise Exception(f"Model file not found: {model_path}")
|
| 41 |
-
|
| 42 |
-
print("Running imatrix command...")
|
| 43 |
process = subprocess.Popen(imatrix_command, shell=False)
|
| 44 |
|
| 45 |
try:
|
|
|
|
| 11 |
from textwrap import dedent
|
| 12 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 13 |
|
|
|
|
| 14 |
# used for restarting the space
|
| 15 |
SPACE_ID = os.environ.get("SPACE_ID")
|
| 16 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 17 |
+
|
| 18 |
+
# Llama.cpp Safetensors to GGUF F16
|
| 19 |
CONVERSION_SCRIPT = "/app/convert_hf_to_gguf.py"
|
| 20 |
|
| 21 |
# escape HTML for logging
|
|
|
|
| 28 |
return s
|
| 29 |
|
| 30 |
def generate_importance_matrix(model_path: str, train_data_path: str, output_path: str):
|
| 31 |
+
if not os.path.isfile(model_path):
|
| 32 |
+
raise Exception(f"Model file not found: {model_path}")
|
| 33 |
+
|
| 34 |
+
print("Running imatrix command...")
|
| 35 |
imatrix_command = [
|
| 36 |
"llama-imatrix",
|
| 37 |
"-m", model_path,
|
|
|
|
| 40 |
"--output-frequency", "10",
|
| 41 |
"-o", output_path,
|
| 42 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
process = subprocess.Popen(imatrix_command, shell=False)
|
| 44 |
|
| 45 |
try:
|