Skip to content
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

Can swift-transformers support version 0.1.13 and above and swift-argument-parser support version 1.4.0 and above? #290

Open
WtecHtec opened this issue Jan 4, 2025 · 5 comments

Comments

@WtecHtec
Copy link

WtecHtec commented Jan 4, 2025

No description provided.

@atiorh
Copy link
Contributor

atiorh commented Jan 4, 2025

#247

@WtecHtec
Copy link
Author

WtecHtec commented Jan 5, 2025

I downloaded the source code of WhisperKit and mlx-swift-examples.

Then, by modifying the Package.swift files of each project, I adjusted the version numbers of swift-transformers and swift-argument-parser to make them compatible.

During the setup of WhisperKit, it may be necessary to modify the inheritance of extension WhisperTokenizerWrapper: Tokenizer and add the following code:

func encode(text: String, addSpecialTokens: Bool) -> [Int] {
    return []
}

func applyChatTemplate(messages: [[String : String]]) throws -> [Int] {
    return []
}

func applyChatTemplate(messages: [[String : String]], chatTemplate: Tokenizers.ChatTemplateArgument) throws -> [Int] {
    return []
}

func applyChatTemplate(messages: [[String : String]], chatTemplate: String) throws -> [Int] {
    return []
}

func applyChatTemplate(messages: [[String : String]], chatTemplate: Tokenizers.ChatTemplateArgument?, addGenerationPrompt: Bool, truncation: Bool, maxLength: Int?, tools: [[String : Any]]?) throws -> [Int] {
    return []
}

Afterward, reload them into SPM (Swift Package Manager) to check if the version numbers of the packages have been successfully modified. Finally, load both WhisperKit and mlx-swift-examples into the project using the local package method. 🏅

https://github.com/user-attachments/assets/e6510e69-4a64-48b3-9a34-04b3e71b2e2e
image

@atiorh
Copy link
Contributor

atiorh commented Jan 5, 2025

Thanks a lot for the detailed report! If you don't mind me asking, what models are you running through MLX Swift? It is always helpful for us to learn about the workflows that are being used in conjunction with WhisperKit.

@WtecHtec
Copy link
Author

WtecHtec commented Jan 5, 2025

Currently using qwen205b4bit, it works well

@BrandonWeng
Copy link

I maintain a small fork to bump swift-transformers as needed. You need 0.1.15 to run deepseek r1

https://github.com/BrandonWeng/WhisperKit/tree/main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants