Closed ericlewis closed 12 months ago
I haven't tried to optimize for iOS yet, but it's cool to start working on iOS integration!
This PR looks great in terms of UI. However, it won't be possible to read the model file on iOS unless we use
startAccessingSecurityScopedResource()
on the file selected by the user in the file browser. Would you like to address that, or would you prefer that I submit it as a separate PR first?
Different PR would probably be a good idea. Works fine in simulator, never heard of security scoped resource on device 👁️
oh and I can address it if you like!
oh and I can address it if you like!
Amazing, thank you! Let me know if you need help.
@pcuenca I added the security scope handling in this PR simply because it was easy enough. The LLaMA 2 model is too big for my iPhone (apparently) and the distilgpt2 mlpackage uses token_scores which isn't supported by swift-transformers yet.. but it appears that the prediction does successfully go through on device.
distilgpt2 mlpackage uses token_scores which isn't supported by swift-transformers yet
Sorry about that, I'll upload a small compatible model later.
distilgpt2 mlpackage uses token_scores which isn't supported by swift-transformers yet
Sorry about that, I'll upload a small compatible model later.
modified swift-transformers to sort of support it, so no worries. rearranging UI after testing on device to feel more natural and will let you know when finished. changing to draft.
https://github.com/huggingface/swift-chat/assets/674503/6a8c4159-5d5f-4054-bf6c-141ce5f958a2
iPhone now defaults to a more compact interface as demonstrated above. iPad and macOS share the existing layout.
@pcuenca okie dokie, this should be good now! I have tested on iPad, iPhone, and macOS devices.
Optimizes the UI for working across iPad / iPhone / macOS