-
Notifications
You must be signed in to change notification settings - Fork 152
Experimental: tokenizers with and without templates #168
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
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c5bff79
package.swift test
greenrazer 19d9ada
added tokenizers as a lib
greenrazer 46327cd
added nessisary target to tokenizers
greenrazer c80bb71
Experimental: tokenizers with and without templates
pcuenca 2682309
Simplify
pcuenca 0961401
Merge remote-tracking branch 'origin/main' into hub-tokenizers-templates
pcuenca 05dcbc4
Fixing up after merge
pcuenca 6567ca3
Attempting to fix tests
pcuenca 8ea3083
Explicitly split tokenizer targets
pcuenca 2859d92
Minor tweaks for symmetry with previous code
pcuenca ed44ce6
Format
pcuenca 166050a
Formatting
mattt 9edcdb5
Use package traits to conditionalize chat templates feature and Jinja…
mattt 9b4a32d
Conditionally add @available annotation when chat templates aren't av…
mattt 5c8b4ce
Update for Swift < 6.1
pcuenca 7996322
Formatting
mattt 8c92b4e
Formatting
mattt 52a4498
Merge branch 'hub-tokenizers-templates' of github.com:huggingface/swi…
pcuenca a8af756
Compile for Swift 6.1
pcuenca 7199b17
Remove duplicated ilnes
pcuenca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // swift-tools-version: 5.9 | ||
| // The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
|
||
| import PackageDescription | ||
|
|
||
| /// Define the strict concurrency settings to be applied to all targets. | ||
| let swiftSettings: [SwiftSetting] = [ | ||
| .enableExperimentalFeature("StrictConcurrency"), | ||
| ] | ||
|
|
||
| let package = Package( | ||
| name: "swift-transformers", | ||
| platforms: [.iOS(.v16), .macOS(.v13)], | ||
| products: [ | ||
| .library(name: "Hub", targets: ["Hub"]), | ||
| // ^ Hub client library | ||
| .library(name: "Tokenizers", targets: ["Tokenizers"]), | ||
| // ^ Tokenizers library with chat template support | ||
| .library(name: "Transformers", targets: ["Tokenizers", "Generation", "Models"]), | ||
| // ^ Everything, including Core ML inference | ||
| .executable(name: "transformers", targets: ["TransformersCLI"]), | ||
| .executable(name: "hub-cli", targets: ["HubCLI"]), | ||
| ], | ||
| dependencies: [ | ||
| .package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.4.0")), | ||
| .package(url: "https://github.com/johnmai-dev/Jinja", .upToNextMinor(from: "1.2.1")), | ||
| ], | ||
| targets: [ | ||
| .executableTarget( | ||
| name: "TransformersCLI", | ||
| dependencies: ["Models", .product(name: "ArgumentParser", package: "swift-argument-parser")] | ||
| ), | ||
| .executableTarget(name: "HubCLI", dependencies: ["Hub", .product(name: "ArgumentParser", package: "swift-argument-parser")]), | ||
| .target(name: "Hub", resources: [.process("FallbackConfigs")], swiftSettings: swiftSettings), | ||
| .target(name: "Tokenizers", dependencies: ["Hub", .product(name: "Jinja", package: "Jinja")]), | ||
| .target(name: "TensorUtils"), | ||
| .target(name: "Generation", dependencies: ["Tokenizers", "TensorUtils"]), | ||
| .target(name: "Models", dependencies: ["Tokenizers", "Generation", "TensorUtils"]), | ||
| .testTarget(name: "TokenizersTests", dependencies: ["Tokenizers", "Models", "Hub"], resources: [.process("Resources"), .process("Vocabs")]), | ||
| .testTarget(name: "HubTests", dependencies: ["Hub", .product(name: "Jinja", package: "Jinja")], swiftSettings: swiftSettings), | ||
| .testTarget(name: "PreTokenizerTests", dependencies: ["Tokenizers", "Hub"]), | ||
| .testTarget(name: "TensorUtilsTests", dependencies: ["TensorUtils", "Models", "Hub"], resources: [.process("Resources")]), | ||
| .testTarget(name: "NormalizerTests", dependencies: ["Tokenizers", "Hub"]), | ||
| .testTarget(name: "PostProcessorTests", dependencies: ["Tokenizers", "Hub"]), | ||
| ] | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P0] TransformersCLI target omits Generation dependency
The new
TransformersCLI.swiftfile importsGeneration, but theTransformersCLIexecutable target now only depends onModelsandArgumentParser. BecauseGenerationis not listed, a build will fail withNo such module 'Generation', preventing the CLI from compiling. The target still needs a direct dependency onGeneration(and any other modules it imports).Useful? React with 👍 / 👎.