Support concurrent model downloads - #126
Merged
Merged
Conversation
Replace the single-download HuggingFaceDownloadManager with a queue that runs up to 3 downloads at once. Each download tracks its own operation, task, progress, state (downloading/paused/queued) and waiters, keyed by model ID; extra requests are queued FIFO and started as active slots free up on completion or cancel. Pause (SIGSTOP), resume (SIGCONT) and cancel now target an individual model. Add a cumulative disk gate: capacityBlocker compares a model's size against free space minus reservedBytes (the remaining bytes of every in-flight download), so a download is only offered when it still fits. Update all consumers: the sidebar arrow shows the active count, the Models banner lists one row per download with per-model controls, and hub rows drive their state per model while disabling downloads that no longer fit on disk.
Every requested download now starts immediately; drop the FIFO queue, the concurrency limit, and the .queued state. DownloadState is just downloading/paused. The multi-download manager, per-model controls, reservedBytes, the disk gate, the banner list, and the sidebar count are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the single-download HuggingFaceDownloadManager with a queue that runs up to a user's device suffices. Each download tracks its own operation, task, progress, state (downloading/paused/queued) and waiters, keyed by model ID; extra requests are queued FIFO and started as active slots free up on completion or cancel. Pause (SIGSTOP), resume (SIGCONT) and cancel now target an individual model.
Add a cumulative disk gate: capacityBlocker compares a model's size against free space minus reservedBytes (the remaining bytes of every in-flight download), so a download is only offered when it still fits.
Update all consumers: the sidebar arrow shows the active count, the Models banner lists one row per download with per-model controls, and hub rows drive their state per model while disabling downloads that no longer fit on disk.