FABLESLIP commited on
Commit
030d017
·
verified ·
1 Parent(s): 43cffbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -227,7 +227,7 @@ def _warmup_thread(models: List[str]):
227
  t_global = time.time()
228
  _log_warmup(f"[JOB] start • {len(models)} dépôts")
229
 
230
- for i, repo in enumerate(models):
231
  if warmup_stop.is_set():
232
  _log_warmup("[STOP] Arrêt demandé — fin du job après ce point")
233
  break
@@ -237,7 +237,8 @@ def _warmup_thread(models: List[str]):
237
  warmup_state["current"] = repo
238
  warmup_state["percent"] = int((i / max(1, len(models))) * 100)
239
 
240
- res = _download_one(repo)
 
241
  with warmup_lock:
242
  if res == "ok":
243
  ok_count += 1
@@ -249,24 +250,23 @@ def _warmup_thread(models: List[str]):
249
  warmup_state["failed_repos"].append(repo)
250
  elif res == "stopped":
251
  _log_warmup("[STOP] Fin anticipée — demande reçue pendant le run")
 
252
  break
253
 
254
  warmup_state["percent"] = int(((i + 1) / max(1, len(models))) * 100)
255
 
256
-
257
  if warmup_stop.is_set():
258
  _log_warmup("[STOP] Fin anticipée — demande reçue pendant le run")
259
  break
260
 
261
- with warmup_lock:
262
- warmup_state["percent"] = 100
263
  warmup_state["done"] = True
264
  warmup_state["running"] = False
265
  warmup_state["ok_count"] = ok_count
266
  warmup_state["finished_at"] = time.time()
267
- _log_warmup(f"[JOB] done • {ok_count}/{len(models)} • {time.time()-t_global:.1f}s")
268
-
269
 
 
270
  # <<<< HUGINFACE PATCH: WARMUP STATE+HELPERS END >>>>
271
  # ---------- Helpers ----------
272
 
@@ -1055,15 +1055,13 @@ const warmupCloseBtn = document.getElementById('warmupCloseBtn');
1055
 
1056
  // Helpers popup
1057
  function buildFinalSummary(s){
1058
- const asked = Array.isArray(s.asked) ? s.asked : [];
1059
- const okL = Array.isArray(s.ok_repos) ? s.ok_repos : [];
1060
- const failL = Array.isArray(s.failed_repos) ? s.failed_repos : [];
1061
  const cacheL = Array.isArray(s.cache_repos) ? s.cache_repos : [];
1062
  const dlL = Array.isArray(s.downloaded_repos) ? s.downloaded_repos : [];
1063
- const tot = asked.length;
1064
 
1065
  const lines = [];
1066
- lines.push(`Terminé — demandés: ${tot} • ⬛ cache: ${cacheL.length} • ✅ téléchargés: ${dlL.length} • ❌ échecs: ${failL.length}`);
1067
  lines.push("");
1068
 
1069
  lines.push("Demandés : " + asked.length);
@@ -1082,13 +1080,12 @@ function buildFinalSummary(s){
1082
  if (failL.length) lines.push(failL.map(m=>' • '+m).join('\n'));
1083
 
1084
  return lines.join('\n');
 
1085
 
1086
  // >>> C2_BEGIN warmup_preface
1087
  let warmupPreface = '';
1088
  // >>> C2_END warmup_preface
1089
 
1090
-
1091
-
1092
  // >>> A2B2P3_BEGIN warmup_defaults
1093
  // Modèles par défaut si l’utilisateur laisse la saisie vide.
1094
  // (Liste “safe” validée chez toi ; on pourra l’étendre plus tard.)
 
227
  t_global = time.time()
228
  _log_warmup(f"[JOB] start • {len(models)} dépôts")
229
 
230
+ for i, repo in enumerate(models):
231
  if warmup_stop.is_set():
232
  _log_warmup("[STOP] Arrêt demandé — fin du job après ce point")
233
  break
 
237
  warmup_state["current"] = repo
238
  warmup_state["percent"] = int((i / max(1, len(models))) * 100)
239
 
240
+ res = _download_one(repo)
241
+
242
  with warmup_lock:
243
  if res == "ok":
244
  ok_count += 1
 
250
  warmup_state["failed_repos"].append(repo)
251
  elif res == "stopped":
252
  _log_warmup("[STOP] Fin anticipée — demande reçue pendant le run")
253
+ warmup_state["percent"] = int(((i + 1) / max(1, len(models))) * 100)
254
  break
255
 
256
  warmup_state["percent"] = int(((i + 1) / max(1, len(models))) * 100)
257
 
 
258
  if warmup_stop.is_set():
259
  _log_warmup("[STOP] Fin anticipée — demande reçue pendant le run")
260
  break
261
 
262
+ with warmup_lock:
263
+ warmup_state["percent"] = 100
264
  warmup_state["done"] = True
265
  warmup_state["running"] = False
266
  warmup_state["ok_count"] = ok_count
267
  warmup_state["finished_at"] = time.time()
 
 
268
 
269
+ _log_warmup(f"[JOB] done • {ok_count}/{len(models)} • {time.time()-t_global:.1f}s")
270
  # <<<< HUGINFACE PATCH: WARMUP STATE+HELPERS END >>>>
271
  # ---------- Helpers ----------
272
 
 
1055
 
1056
  // Helpers popup
1057
  function buildFinalSummary(s){
1058
+ const asked = Array.isArray(s.asked) ? s.asked : [];
 
 
1059
  const cacheL = Array.isArray(s.cache_repos) ? s.cache_repos : [];
1060
  const dlL = Array.isArray(s.downloaded_repos) ? s.downloaded_repos : [];
1061
+ const failL = Array.isArray(s.failed_repos) ? s.failed_repos : [];
1062
 
1063
  const lines = [];
1064
+ lines.push(`Terminé — demandés: ${asked.length} • ⬛ cache: ${cacheL.length} • ✅ téléchargés: ${dlL.length} • ❌ échecs: ${failL.length}`);
1065
  lines.push("");
1066
 
1067
  lines.push("Demandés : " + asked.length);
 
1080
  if (failL.length) lines.push(failL.map(m=>' • '+m).join('\n'));
1081
 
1082
  return lines.join('\n');
1083
+ }
1084
 
1085
  // >>> C2_BEGIN warmup_preface
1086
  let warmupPreface = '';
1087
  // >>> C2_END warmup_preface
1088
 
 
 
1089
  // >>> A2B2P3_BEGIN warmup_defaults
1090
  // Modèles par défaut si l’utilisateur laisse la saisie vide.
1091
  // (Liste “safe” validée chez toi ; on pourra l’étendre plus tard.)