Repository navigation
Description
Description
The training-start overlay can show an already cached model or dataset as Downloading — 99% indefinitely even though no download job is active.
The backend intentionally caps progress at 99% until a manifest-backed disk check verifies completion. That is appropriate for an active or resumed download, but Hugging Face cache entries created outside Studio—or created before Studio's manifest system—do not have a Studio completion manifest. They therefore remain unverified even when all reported bytes are present.
The overlay maps any resource below 100% to the Downloading label, so “cached but not manifest-verified” is presented as an active transfer.
Reproduction
- Have a complete Hugging Face cache entry without a Studio download manifest.
- In Studio, configure training with that cached resource.
- Start training.
- Observe the training-start overlay.
Observed with unsloth/alpaca-cleaned:
- Displayed bytes:
42.3 MB / 42.3 MB - Cache snapshot contained the dataset files.
- No active dataset download worker was running.
- Overlay remained at
Downloading — 99%.
Root cause
The progress backend only reports 1.0 when complete_on_disk succeeds, and that check requires a readable manifest:
unsloth/studio/backend/hub/services/snapshot_progress.py
Lines 72 to 105 in 5b24b8a
| def _snapshot_complete_on_disk( | |
| *, | |
| repo_type: RepoType, | |
| repo_id: str, | |
| variant: Optional[str], | |
| entry: Path, | |
| expected_total: int, | |
| completed_bytes: int, | |
| in_progress_bytes: int, | |
| ) -> bool: | |
| if expected_total <= 0 or completed_bytes < expected_total or in_progress_bytes > 0: | |
| return False | |
| snapshot_dir = latest_snapshot_dir(entry) | |
| if snapshot_dir is None: | |
| return False | |
| if variant is None and hf_cache_scan.repo_cache_dir_has_incomplete_blobs(entry): | |
| return False | |
| hub_cache = entry.parent | |
| if download_manifest.has_cancel_marker( | |
| repo_type, | |
| repo_id, | |
| variant, | |
| hub_cache = hub_cache, | |
| ): | |
| return False | |
| manifest = download_manifest.read_manifest( | |
| repo_type, | |
| repo_id, | |
| variant, | |
| hub_cache = hub_cache, | |
| ) | |
| if manifest is None: | |
| return False | |
| return download_manifest.verify_against_disk(manifest, snapshot_dir).ok |
Otherwise it caps the reported fraction at 0.99:
unsloth/studio/backend/hub/services/snapshot_progress.py
Lines 249 to 258 in 5b24b8a
| # Cap at 0.99 until the manifest-backed disk check verifies completion: on | |
| # resume, completed bytes can sit above the threshold while files still download. | |
| progress = ( | |
| 1.0 | |
| if complete_on_disk | |
| else ( | |
| min(display_downloaded_bytes / display_expected_total, 0.99) | |
| if display_expected_total > 0 | |
| else 0 | |
| ) |
The training overlay treats every value below 100% as Downloading:
unsloth/studio/frontend/src/features/studio/training-start-overlay.tsx
Lines 177 to 191 in 5b24b8a
| function DownloadRow({ label, state }: DownloadRowProps): ReactElement | null { | |
| const t = useT(); | |
| // Rolling-window rate + ETA from the cumulative-byte series the poll hook | |
| // produces, so we show "5.2 / 20.7 GB • 85.3 MB/s • 3m 12s left", not just the pair. | |
| const stats = useTransferStats(state.downloadedBytes, state.totalBytes); | |
| if (state.downloadedBytes <= 0 && !state.cachePath) return null; | |
| const isComplete = state.totalBytes > 0 && state.percent >= 100; | |
| const statusLabel = isComplete | |
| ? t("studio.trainingStart.ready") | |
| : state.totalBytes > 0 | |
| ? t("studio.trainingStart.downloading") | |
| : state.downloadedBytes === 0 | |
| ? t("studio.trainingStart.preparing") | |
| : null; |
Its cached-state coercion also preserves a cache entry at 99% whenever downloaded bytes are nonzero:
| function coerceCachedStateReady(state: DownloadState): DownloadState { | |
| if (!state.cachePath) return state; | |
| if (state.downloadedBytes > 0 && state.percent < 100) return state; | |
| const totalBytes = | |
| state.totalBytes > 0 ? state.totalBytes : state.downloadedBytes; | |
| if (totalBytes <= 0) { | |
| return { ...state, percent: 100 }; | |
| } | |
| return { | |
| ...state, | |
| downloadedBytes: totalBytes, | |
| totalBytes, | |
| percent: 100, | |
| }; |
Expected behavior
The UI should distinguish these states:
- actively downloading;
- cached and verified;
- cached but lacking Studio verification metadata;
- incomplete or unusable.
At minimum, a cached resource with no active download should not be labelled Downloading. Outside the download phase, the overlay could show Cached, Ready, or Unverified cache, depending on whether actual usability has been established.
Activity
fix(studio): stop showing manifest-less cache entries as downloading (#…