codemichaeld commited on
Commit
32f4258
Β·
verified Β·
1 Parent(s): d4ee227

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -20,9 +20,10 @@ def convert_gguf_to_fp8_safetensors(gguf_path, output_dir, progress=gr.Progress(
20
  progress(0.1, desc="Starting GGUF to FP8 conversion...")
21
 
22
  try:
23
- # Ensure gguf-connector is installed
24
- import gguf_connector # noqa
25
-
 
26
  # Build command: ggc t3 (GGUF β†’ safetensors), then q (safetensors β†’ FP8)
27
  temp_safetensors_dir = tempfile.mkdtemp()
28
  safetensors_path = os.path.join(temp_safetensors_dir, "intermediate.safetensors")
@@ -30,8 +31,9 @@ def convert_gguf_to_fp8_safetensors(gguf_path, output_dir, progress=gr.Progress(
30
 
31
  progress(0.3, desc="Converting GGUF to Safetensors...")
32
  # Step 1: GGUF β†’ Safetensors
 
33
  result1 = subprocess.run(
34
- ["ggc", "t3", gguf_path, safetensors_path],
35
  capture_output=True,
36
  text=True
37
  )
@@ -40,8 +42,9 @@ def convert_gguf_to_fp8_safetensors(gguf_path, output_dir, progress=gr.Progress(
40
 
41
  progress(0.6, desc="Quantizing Safetensors to FP8...")
42
  # Step 2: Safetensors β†’ FP8 Safetensors
 
43
  result2 = subprocess.run(
44
- ["ggc", "q", safetensors_path, fp8_safetensors_path],
45
  capture_output=True,
46
  text=True
47
  )
 
20
  progress(0.1, desc="Starting GGUF to FP8 conversion...")
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 t3 (GGUF β†’ safetensors), then q (safetensors β†’ FP8)
28
  temp_safetensors_dir = tempfile.mkdtemp()
29
  safetensors_path = os.path.join(temp_safetensors_dir, "intermediate.safetensors")
 
31
 
32
  progress(0.3, desc="Converting GGUF to Safetensors...")
33
  # Step 1: GGUF β†’ Safetensors
34
+ # CORRECTED: Using --input and --output flags
35
  result1 = subprocess.run(
36
+ ["ggc", "t3", "--input", gguf_path, "--output", safetensors_path],
37
  capture_output=True,
38
  text=True
39
  )
 
42
 
43
  progress(0.6, desc="Quantizing Safetensors to FP8...")
44
  # Step 2: Safetensors β†’ FP8 Safetensors
45
+ # CORRECTED: Using --input and --output flags
46
  result2 = subprocess.run(
47
+ ["ggc", "q", "--input", safetensors_path, "--output", fp8_safetensors_path],
48
  capture_output=True,
49
  text=True
50
  )