-
Notifications
You must be signed in to change notification settings - Fork 4
Linux fixes #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thinkpractice
wants to merge
18
commits into
huggingface:main
Choose a base branch
from
thinkpractice:linux_fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Linux fixes #12
Conversation
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
…Crypto (instead of CryptoKit) and added some small changes to make some files compile on Linux
…Added platform conditional import for Linux
…w as a package dependency
…non macOS platforms
…available in swift-corelibs-foundation.
Collaborator
|
Hi @thinkpractice. Wow, this is exciting! Lemme take a some time to go over all of this. Aiming to have a review for you tomorrow. |
Author
|
@mattt thanks! Looking forward 😄 And let me know should you have any questions! |
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.
Hi @mattt ,
I'm sending this PR a little early, more of a heads-up, although the code and tests already build. @pedronahum and I are working to bring swift-huggingface to Linux. We made a lot of changes that we will detail below. Our main idea is bringing swift-huggingface (and hopefully swift-transformers later) to TaylorTorch. At this point in time we're still need to solve some issues on Linux, most notably:
MockURLProtocol.swiftdoesn't build on swift > 6.1 (we're currently building TaylorTorch with swift 6.3)TokenStorageclasses to use gnome keyring on Ubuntualso we need to still test the swift-huggingface on Linux, which we will hope to do some time later this week.
kind regards,
Tim
Add Linux Support
This PR adds full Linux compatibility to the swift-huggingface library.
Changes
Dependencies
swift-cryptopackage for cross-platform cryptographic operations (replaces Apple-onlyCryptoKit)New Files
asyncData,asyncUpload,asyncDownload,asyncBytes) since Linux'sFoundationNetworkinglacks native async/await supportFileTokenStorage- File-based storage at~/.cache/huggingface/token.jsonEnvironmentTokenStorage- Reads fromHF_TOKENenvironment variableCompositeTokenStorage- Combines multiple storage backendsModified Files
CryptoKitwithCrypto, added#if canImport(FoundationNetworking)conditionals for network callsAuthenticationServices-specific code with#if canImportguardsHTTPURLResponseextension to free functions (parseNextPageURL(from:)) for Linux compatibilityUniformTypeIdentifiersis unavailable), maderesumeDownloadFileandDownloadProgressDelegateApple-onlyCryptoKitimportTest Updates
#if canImport(FoundationNetworking)imports to all test filesparseNextPageURL(from:)#if canImport(AuthenticationServices)(Apple-only)nonisolated(unsafe)Platform-Specific Features
Some features remain Apple-only due to platform limitations:
HuggingFaceAuthenticationManager(requiresAuthenticationServices)Testing
swift build✅swift build --build-tests✅swift test✅ (Linux)