Replace HubApi downloader with swift-huggingface HubClient#315
Conversation
fde931a to
284ae43
Compare
bcf5b81 to
5d91672
Compare
There was a problem hiding this comment.
Pull request overview
This PR replaces the existing HubApi download implementation with HubClient from the swift-huggingface package, updating download/progress behavior and adjusting tests accordingly.
Changes:
- Add
swift-huggingfaceas a dependency and import/useHubClientinHubApi. - Implement
HubClientselection (cached/uncached, foreground/background) and add repo-id canonicalization for legacy model IDs. - Update download-related tests to reflect the new download/progress behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
Sources/Hub/HubApi.swift |
Switches file download path to HuggingFace.HubClient, adds progress bridging + repo ID resolution/cache, adjusts HEAD redirect handling by platform. |
Tests/HubTests/HubApiTests.swift |
Updates assertions and progress expectation handling for the new download/progress behavior. |
Package.swift |
Adds swift-huggingface dependency and links HuggingFace product into the Hub target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`destination` includes the filename as well, so we were creating
directories such as:
models
└── microsoft
└── phi-4
└── config.json
└── config.json
|
My download workaround fixes downloads for regular files but not for Xet ones. I don't think we can solve this here. The problem, I think, is that So we either have to update |
|
The good news is that tests now proceed without deadlocks (after my second workaround) so we can see what's remaining. |
Whoops, sorry about that. I just opened a PR to fix upstream here: huggingface/swift-huggingface#43 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
Alternative to #297