* Studio Hub: default downloads to Xet transport Model and dataset downloads defaulted to HTTP; flip the default to Xet for faster parallel chunked transfers. - Frontend: DEFAULT_TRANSPORT_MODE is now Xet, so a user with no saved preference starts on Xet. effectiveTransportMode() already downgrades to HTTP and warns when hf_xet is unavailable, so this degrades gracefully. - Backend: DownloadModelRequest.use_xet and DownloadDatasetRequest.use_xet default to True, keeping the API in step with the UI. Set use_xet=False for sequential HTTP Range-resume. - Align the internal _spawn_download_worker default so no caller silently falls back to HTTP. Inference and training model loads were already Xet-first with an HTTP stall fallback, so this brings explicit downloads in line with the rest of Studio. * Studio Hub: gracefully fall back to HTTP when Xet is unavailable With Xet now the default, an omitted or explicit use_xet=True from a non-UI API caller would 400 on installs without hf_xet, since resolve_transport raises when the transport is unavailable. Add resolve_effective_use_xet(), which downgrades a Xet request to HTTP (with a warning) when hf_xet is missing, mirroring the frontend's own downgrade. Both the model and dataset flows now derive a single effective use_xet and feed it to resolve_transport and spawn_worker, so the recorded transport and the worker env can never disagree. The UI is unaffected: it already resolves availability and passes use_xet explicitly. * Add tests for resolve_effective_use_xet Xet to HTTP fallback * Trim comments for PR #6433 --------- Co-authored-by: Daniel Han <danielhanchen@gmail.com>
27 lines
1 KiB
Python
27 lines
1 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
|
|
|
|
from hub.services import download_lifecycle
|
|
|
|
|
|
def _set_xet_reason(monkeypatch, reason):
|
|
monkeypatch.setattr(
|
|
download_lifecycle.download_registry,
|
|
"download_transport_unavailable_reason",
|
|
lambda _transport: reason,
|
|
)
|
|
|
|
|
|
def test_resolve_effective_use_xet_keeps_http_when_not_requested(monkeypatch):
|
|
_set_xet_reason(monkeypatch, "should not be consulted")
|
|
assert download_lifecycle.resolve_effective_use_xet(False) is False
|
|
|
|
|
|
def test_resolve_effective_use_xet_keeps_xet_when_available(monkeypatch):
|
|
_set_xet_reason(monkeypatch, None)
|
|
assert download_lifecycle.resolve_effective_use_xet(True) is True
|
|
|
|
|
|
def test_resolve_effective_use_xet_downgrades_when_xet_unavailable(monkeypatch):
|
|
_set_xet_reason(monkeypatch, "Xet transport is unavailable because hf_xet is not installed.")
|
|
assert download_lifecycle.resolve_effective_use_xet(True) is False
|