Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,19 +21,18 @@ def convert_gguf_to_fp8_safetensors(gguf_path, output_dir, progress=gr.Progress(
|
|
| 21 |
|
| 22 |
try:
|
| 23 |
# Ensure gguf-connector is installed by checking for the 'ggc' command
|
| 24 |
-
# This is more robust than trying to import a potentially non-existent Python module
|
| 25 |
subprocess.run(["ggc", "--version"], check=True, capture_output=True)
|
| 26 |
|
| 27 |
-
# Build command: ggc
|
| 28 |
temp_safetensors_dir = tempfile.mkdtemp()
|
| 29 |
safetensors_path = os.path.join(temp_safetensors_dir, "intermediate.safetensors")
|
| 30 |
fp8_safetensors_path = os.path.join(output_dir, "model.safetensors")
|
| 31 |
|
| 32 |
progress(0.3, desc="Converting GGUF to Safetensors...")
|
| 33 |
# Step 1: GGUF β Safetensors
|
| 34 |
-
# CORRECTED: Using
|
| 35 |
result1 = subprocess.run(
|
| 36 |
-
["ggc", "
|
| 37 |
capture_output=True,
|
| 38 |
text=True
|
| 39 |
)
|
|
@@ -42,9 +41,9 @@ def convert_gguf_to_fp8_safetensors(gguf_path, output_dir, progress=gr.Progress(
|
|
| 42 |
|
| 43 |
progress(0.6, desc="Quantizing Safetensors to FP8...")
|
| 44 |
# Step 2: Safetensors β FP8 Safetensors
|
| 45 |
-
# CORRECTED: Using
|
| 46 |
result2 = subprocess.run(
|
| 47 |
-
["ggc", "
|
| 48 |
capture_output=True,
|
| 49 |
text=True
|
| 50 |
)
|
|
|
|
| 21 |
|
| 22 |
try:
|
| 23 |
# Ensure gguf-connector is installed by checking for the 'ggc' command
|
|
|
|
| 24 |
subprocess.run(["ggc", "--version"], check=True, capture_output=True)
|
| 25 |
|
| 26 |
+
# Build command: ggc t3a (GGUF β safetensors), then q8 (safetensors β FP8)
|
| 27 |
temp_safetensors_dir = tempfile.mkdtemp()
|
| 28 |
safetensors_path = os.path.join(temp_safetensors_dir, "intermediate.safetensors")
|
| 29 |
fp8_safetensors_path = os.path.join(output_dir, "model.safetensors")
|
| 30 |
|
| 31 |
progress(0.3, desc="Converting GGUF to Safetensors...")
|
| 32 |
# Step 1: GGUF β Safetensors
|
| 33 |
+
# CORRECTED: Using 't3a' subcommand and positional arguments
|
| 34 |
result1 = subprocess.run(
|
| 35 |
+
["ggc", "t3a", gguf_path, safetensors_path],
|
| 36 |
capture_output=True,
|
| 37 |
text=True
|
| 38 |
)
|
|
|
|
| 41 |
|
| 42 |
progress(0.6, desc="Quantizing Safetensors to FP8...")
|
| 43 |
# Step 2: Safetensors β FP8 Safetensors
|
| 44 |
+
# CORRECTED: Using 'q8' subcommand for FP8 quantization and positional arguments
|
| 45 |
result2 = subprocess.run(
|
| 46 |
+
["ggc", "q8", safetensors_path, fp8_safetensors_path],
|
| 47 |
capture_output=True,
|
| 48 |
text=True
|
| 49 |
)
|