@@ -105,22 +105,38 @@ def _download_with_progress(dst, total, do_download):
105105 stop = threading .Event ()
106106
107107 def _watch ():
108- t0 = time .time ()
108+ # Solo imprime cuando hay PROGRESO real en disco (xet escribe a ráfagas: si
109+ # imprimiéramos cada 2s veríamos 100 líneas con el mismo % y un MB/s "medio"
110+ # que decae solo). MB/s = ritmo del último tramo (real, no decae); ETA = sobre
111+ # el promedio global (estable). Latido cada ~20s si lleva rato plano (xet
112+ # llenando su caché fuera de `dst`) para que se vea que sigue vivo.
113+ t0 = t_prev = last_beat = time .time ()
114+ done_prev = 0
109115 while not stop .is_set ():
116+ stop .wait (2.0 )
117+ if not total :
118+ continue
110119 done = _dir_size (dst )
111- if total and done > 0 :
112- el = max (time .time () - t0 , 1e-6 )
113- spd = done / el / (1024 ** 2 ) # MB/s medios
114- eta = (total - done ) / max (done / el , 1.0 ) / 60 # min restantes
120+ now = time .time ()
121+ if done > done_prev :
122+ inst = (done - done_prev ) / max (now - t_prev , 1e-6 ) / (1024 ** 2 ) # MB/s recientes
123+ avg = done / max (now - t0 , 1e-6 ) # B/s medio
124+ eta = (total - done ) / max (avg , 1.0 ) / 60
115125 print (f"[BerniniR] { 100 * min (done , total ) / total :4.1f} % "
116- f"{ done / g :5.2f} /{ total / g :.2f} GB { spd :5.1f} MB/s "
126+ f"{ done / g :5.2f} /{ total / g :.2f} GB { inst :5.1f} MB/s "
117127 f"ETA { max (eta , 0.0 ):4.1f} min" , flush = True )
118128 if pb :
119129 try :
120130 pb .update_absolute (min (done , total ), total )
121131 except Exception :
122132 pass
123- stop .wait (2.0 )
133+ t_prev = last_beat = now
134+ done_prev = done
135+ elif now - last_beat >= 20 :
136+ print (f"[BerniniR] { 100 * min (done , total ) / total :4.1f} % "
137+ f"{ done / g :.2f} /{ total / g :.2f} GB (sigue bajando; xet escribe a rafagas)" ,
138+ flush = True )
139+ last_beat = now
124140
125141 try :
126142 from huggingface_hub .utils import disable_progress_bars
0 commit comments