-
Notifications
You must be signed in to change notification settings - Fork 42
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
Running chat app on m2 iPad Pro with mistral 7B unable to generate text #24
Comments
Hello @developer-yl! You need to set the HUGGING_FACE_HUB_TOKEN environment variable, because the Mistral tokenizer is retrieved from the original repository, which needs authenticated access. This PR improves the error message, we'll get it merged soon. |
"Read access to gated repos" and setting up in Xcode as in your screenshot should work, as long as you run the app from Xcode. |
@pcuenca I managed to install macOS 15.0 beta 6 into my mac and was able to get the swift-chat with apple's coreml to work, so that means my implementation seems to be right. However once I run this on my ipad ios 18.0 beta 5, it will not work at all. Was this code tested on a physical iOS device before or only on macOS? Log of it working on mac: NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed Failure on the ipad: The model is not found at URL: file:///var/mobile/Containers/Data/Application/495AC6EB-E56D-4279-B420-0B539B15C197/Library/Application%20Support/hf-compiled-transformers/StatefulMistral7BInstructInt4.mlmodelc Will attempt to recover by breaking constraint Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. |
+1 on this, i've set the variable still not able to get past the "Please verify that you have set the HUGGING_FACE_HUB_TOKEN environment variable" |
@developer-yl Grateful if you can share how you got apple's core-ml version to work on Mac OS. i am downloading it like this per the huggingface readme:
I have set the token and validated with a print statement that it is there. I am on MacOS 15 beta Building for Mac. Cannot get past the token issue! its killing me |
Update I got it working, i had to manually set the token into my MacOS CLI (outside of Xcode)
You can verify it works because it creates a folder under
My hunch is that on a device like iPad this will not work that way. I wonder if there's a way to load the tokenizer functions into the device manually or something? |
Setting the Environment Variable in Xcode In Xcode, if you tap SwiftChat -> Edit Scheme, you can enter in Agree to Mistral access I found the file had an error not related to environmental variable: So I went to Clear Json cache That's because the .json files are cached at Make sure to delete all three .json files and restart SwiftChat! I spent 20 mins thinking my token fine-grained permission was wrong, but all you need is |
Running iOS 18.0 beta 6 on m2 iPad Pro and m1 max Mac is running 14.6.1 but running XCode 16.0 beta 5 (swit-transformers preview 45e5fbb, CompactSlider 1.1.6, Path.swift 1.4.1, swift-argument-parser 1.5.0)
I have downloaded the https://huggingface.co/apple/mistral-coreml mistral 7B coreml model
I am running the chat app in the preview branch, it is able to load the model in the iPad fine but it gives an error when I press the top right play button to generate text with the default "Write a poem about Valencia"
When starting app:
The model is not found at URL: file:///var/mobile/Containers/Data/Application/A12F6050-340D-48D8-973D-851121212F36/Library/Application%20Support/hf-compiled-transformers/StatefulMistral7BInstructInt4.mlmodelc
No model could be loaded: Error Domain=com.apple.CoreML Code=0 "The model is not found at URL: file:///var/mobile/Containers/Data/Application/A12F6050-340D-48D8-973D-851121212F36/Library/Application%20Support/hf-compiled-transformers/StatefulMistral7BInstructInt4.mlmodelc" UserInfo={NSLocalizedDescription=The model is not found at URL: file:///var/mobile/Containers/Data/Application/A12F6050-340D-48D8-973D-851121212F36/Library/Application%20Support/hf-compiled-transformers/StatefulMistral7BInstructInt4.mlmodelc}
NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
Failed to send CA Event for app launch measurements for ca_event_type: 1 event_name: com.apple.app_launch_measurement.ExtendedLaunchMetrics
When loading the model:
Compiling model file:///private/var/mobile/Library/Mobile%20Documents/com
appleCloudDocs/Downloads/StatefulMistral7BInstructInt4.mlpackageThe view service did terminate with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method}
loc("/var/mobile/Containers/Data/Application/A12F6050-340D-48D8-973D-851121212F36/Library/Caches/com.testmodel/com.apple.e5rt.e5bundlecache/22A5338b/AAE089F8CD4E605BA9D6F96BF8073D646BC469AEFEA3D60CB0B2F4F18D462764/1A37B336B2CBAE9955E761EC42C04E24E7FE93A1583CBB9B222612B5C9D2C73D.bundle/H14G.bundle/main/main_mps_graph/main_mps_graph.mpsgraphpackage/model_0.mpsgraph":0:0): error: attempting to parse a byte at the end of the bytecode
When pressing the play button:
Error Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0., NSJSONSerializationErrorIndex=0}
The text was updated successfully, but these errors were encountered: