Sambhavnoobcoder commited on
Commit
882b731
·
1 Parent(s): c5dc4f2

Deploy Auto-Quantization MVP

Browse files
Files changed (1) hide show
  1. app.py +28 -10
app.py CHANGED
@@ -173,21 +173,27 @@ Upload a model to HuggingFace Hub to trigger automatic quantization!
173
  "failed": "❌"
174
  }.get(job["status"], "❓")
175
 
176
- jobs_text += f"""
177
- ### {status_emoji} Job #{job['id']} - {job['status'].upper()}
 
 
178
 
179
- **Model:** `{job['model_id']}`
180
- **Method:** {job['method']}
181
- **Time:** {job['timestamp']}
182
- """
183
 
184
  if job["status"] == "completed" and "output_repo" in job:
185
  jobs_text += f"**✨ Output:** [{job['output_repo']}](https://huggingface.co/{job['output_repo']}) \n"
186
 
187
  if job["status"] == "failed" and "error" in job:
188
- jobs_text += f"**Error:** {job['error'][:200]}... \n"
 
 
 
 
189
 
190
- jobs_text += "---\n\n"
191
 
192
  return jobs_text
193
 
@@ -206,9 +212,21 @@ def get_metrics():
206
 
207
  total = len(job_queue)
208
  completed = len([j for j in job_queue if j["status"] == "completed"])
209
- failed = len([j for j in job_queue if j["status"] == "failed"])
210
 
211
- success_rate = f"{(completed/(completed+failed)*100):.1f}%" if (completed + failed) > 0 else "N/A"
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
  # Estimated time saved (30 min per model)
214
  time_saved = completed * 0.5
 
173
  "failed": "❌"
174
  }.get(job["status"], "❓")
175
 
176
+ # Truncate model ID if too long
177
+ model_display = job['model_id']
178
+ if len(model_display) > 50:
179
+ model_display = model_display[:47] + "..."
180
 
181
+ jobs_text += f"\n### {status_emoji} Job #{job['id']} - {job['status'].upper()}\n\n"
182
+ jobs_text += f"**Model:** `{model_display}` \n"
183
+ jobs_text += f"**Method:** {job['method']} \n"
184
+ jobs_text += f"**Time:** {job['timestamp']} \n"
185
 
186
  if job["status"] == "completed" and "output_repo" in job:
187
  jobs_text += f"**✨ Output:** [{job['output_repo']}](https://huggingface.co/{job['output_repo']}) \n"
188
 
189
  if job["status"] == "failed" and "error" in job:
190
+ # Truncate long errors and make them more readable
191
+ error_msg = job['error']
192
+ if len(error_msg) > 150:
193
+ error_msg = error_msg[:150] + "..."
194
+ jobs_text += f"**Error:** {error_msg} \n"
195
 
196
+ jobs_text += "\n---\n"
197
 
198
  return jobs_text
199
 
 
212
 
213
  total = len(job_queue)
214
  completed = len([j for j in job_queue if j["status"] == "completed"])
 
215
 
216
+ # Only count legitimate failures (not "already quantized" or validation errors)
217
+ legitimate_failures = []
218
+ for j in job_queue:
219
+ if j["status"] == "failed":
220
+ error = j.get("error", "")
221
+ # Skip validation failures like "already quantized"
222
+ if "already quantized" not in error.lower() and "skipping" not in error.lower():
223
+ legitimate_failures.append(j)
224
+
225
+ failed = len(legitimate_failures)
226
+
227
+ # Calculate success rate based only on legitimate attempts
228
+ legitimate_attempts = completed + failed
229
+ success_rate = f"{(completed/legitimate_attempts*100):.1f}%" if legitimate_attempts > 0 else "N/A"
230
 
231
  # Estimated time saved (30 min per model)
232
  time_saved = completed * 0.5