[BUG-FIX]: download progress not reported to Python during file transfers#791
[BUG-FIX]: download progress not reported to Python during file transfers#791tobocop2 wants to merge 1 commit into
Conversation
8e0dd2d to
066a2de
Compare
…progress ItemBridgeState::compute_diff hardcoded all total_transfer_bytes fields to 0, suppressing the fine-grained network-level progress that xet-core already tracks per HTTP chunk. This caused Python callbacks to only receive coarse bytes_completed updates (per disk write, ~256MB batches). - Add transfer_bytes and transfer_bytes_completed to ItemProgressReport - Update ItemBridgeState::compute_diff to diff transfer fields (matching GroupBridgeState which already does this correctly) - Fire callbacks when transfer progress changes, even if bytes_completed has not changed yet
066a2de to
13645b7
Compare
|
Friendly bump on this, happy to address any feedback if needed. Let me know if there's anything blocking review. |
|
@tobocop2 Hi, with the release of |
|
no problem. I'm currently using this workaround huggingface/huggingface_hub#4129 I will try to step up to the latest hugging face hub and report back if the problem persists. |
|
@seanses stepped up to Repro: import os, shutil, time
os.environ["HF_HOME"] = "/tmp/xet_repro_cache" # set before importing huggingface_hub
shutil.rmtree("/tmp/xet_repro_cache", ignore_errors=True) # cold download each run
from huggingface_hub import hf_hub_download
from tqdm.auto import tqdm
REPO, FILE = "unsloth/Qwen3-4B-GGUF", "Qwen3-4B-UD-IQ1_S.gguf" # ~1 GB, xet-backed
class Recorder(tqdm):
def __init__(self, *a, **k):
k["disable"] = True
super().__init__(*a, **k)
self._t = time.monotonic()
def update(self, n=1):
now = time.monotonic()
print(f"+{int(n)/1e6:6.1f} MB (+{now - self._t:5.1f}s gap)", flush=True)
self._t = now
return super().update(n)
hf_hub_download(REPO, FILE, tqdm_class=Recorder)HF_HUB_DISABLE_XET=0 python repro.py # xet
HF_HUB_DISABLE_XET=1 python repro.py # httpEach line is one xet delivers 100+ MB per callback with gaps up to ~2 min. HTTP ( |
|
Apologies, the PR that updates huggingface_hub to use the new API has not landed yet. I'm aware that even using the new API the update gap can still be large, I'll discussed with the huggingface_hub maintainers to see if we can add a separate progress bar so the update gap there can be smaller, see relevant discussion here. |
Problem
Download progress bars in
huggingface_hubupdate in large jumps (e.g. 0% -> 26% -> 63% -> 100% for a 4GB file) instead of smoothly. The root cause is thatItemBridgeState::compute_diffhardcodes alltotal_transfer_bytesfields to 0, so the fine-grained per-HTTP-chunk progress that xet-core already tracks internally never reaches Python callbacks.Fix
transfer_bytesandtransfer_bytes_completedtoItemProgressReportItemBridgeState::compute_diffto diff transfer fields, matching the existingGroupBridgeStatebehaviorGroupBridgeState::compute_diffitem inclusion to also trigger on transfer progressReproduction
Single file
Multi-file
Before: tqdm bar jumps 0% -> 26% -> 63% -> 100% with ~4 callbacks for a 4GB file.
After: tqdm bar updates smoothly every 250ms.
See
callback_bridge.rstests for coverage of the new transfer byte diffing.