Skip to content

[Bug] Training overlay shows cached resources as Downloading at 99% without an active download #7858

Closed

Description

@Imagineer99

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

  1. Have a complete Hugging Face cache entry without a Studio download manifest.
  2. In Studio, configure training with that cached resource.
  3. Start training.
  4. 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:

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:

# 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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions