Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,11 @@ import subprocess
|
|
3 |
import streamlit as st
|
4 |
from huggingface_hub import snapshot_download
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
# Define quantization types
|
7 |
QUANT_TYPES = [
|
8 |
"Q2_K", "Q3_K_M", "Q3_K_S", "Q4_K_M", "Q4_K_S",
|
@@ -24,9 +29,11 @@ def convert_to_gguf(model_dir, output_file):
|
|
24 |
"""
|
25 |
st.write(f"π Converting `{model_dir}` to GGUF format...")
|
26 |
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
|
|
|
|
27 |
cmd = [
|
28 |
"python3",
|
29 |
-
"
|
30 |
"--model", model_dir,
|
31 |
"--outtype f16",
|
32 |
"--outfile", output_file
|
|
|
3 |
import streamlit as st
|
4 |
from huggingface_hub import snapshot_download
|
5 |
|
6 |
+
def check_directory_path(directory_name: str) -> str:
|
7 |
+
if os.path.exists(directory_name):
|
8 |
+
path = os.path.abspath(directory_name)
|
9 |
+
return str(path)
|
10 |
+
|
11 |
# Define quantization types
|
12 |
QUANT_TYPES = [
|
13 |
"Q2_K", "Q3_K_M", "Q3_K_S", "Q4_K_M", "Q4_K_S",
|
|
|
29 |
"""
|
30 |
st.write(f"π Converting `{model_dir}` to GGUF format...")
|
31 |
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
32 |
+
model_dir_path=check_directory_path("llama.cpp")
|
33 |
+
st.write(model_dir_path)
|
34 |
cmd = [
|
35 |
"python3",
|
36 |
+
f"{model_dir_path}/convert-hf-to-gguf.py",
|
37 |
"--model", model_dir,
|
38 |
"--outtype f16",
|
39 |
"--outfile", output_file
|