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

Cannot import Mistral7b #28

Open
juliusmlr opened this issue Nov 3, 2024 · 9 comments
Open

Cannot import Mistral7b #28

juliusmlr opened this issue Nov 3, 2024 · 9 comments

Comments

@juliusmlr
Copy link

On my Macbook Air m3 with MacOS 15.1 (24B83) i cannot import the mistral model downloaded from this repo: https://huggingface.co/apple/mistral-coreml

I'm running the preview branch.
This is the XCode error i'm running in:

.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
Models/LanguageModel.swift:39: Fatal error: Cannot obtain shape information

Any idea?

@rudrankriyam
Copy link

Facing the same issue

@kokluch
Copy link

kokluch commented Nov 23, 2024

same

@joaomelo81
Copy link

joaomelo81 commented Nov 26, 2024

Switch the branch to main

@OneMHz
Copy link

OneMHz commented Jan 31, 2025

If you look at model.modelDescription.inputDescriptionsByName, it contains key = inputIds. But the code is looking for input_ids. But if you fix that, then it complains about the causal mask because that's not added as an MLFeatureValue. And if you fix that, it complains that mistral needs an MLState (though, not in the most clear message), which is only iOS 18+/macOS15+. And if you fix that, it complains that the shape.count = 0 != stride.count = 3 or something (I had to update to the latest and need to re-apply some local changes to get the exact error back).

But I'm kind of naively fixing the error messages locally and hoping for the best so some guidance would be great.

@pcuenca
Copy link
Member

pcuenca commented Jan 31, 2025

Hi @OneMHz, are you using the preview branch?

@OneMHz
Copy link

OneMHz commented Jan 31, 2025

No. Main. I did manage to code my way to getting a result. But it’s coming back as a MLMultiArray so that doesn’t work for the return type

@pcuenca
Copy link
Member

pcuenca commented Jan 31, 2025

You need the preview branch of this project, which also pulls the preview branch from swift-transformers. It adds supports for MLState and a few other things. Please, let us know if that works!

@pcuenca
Copy link
Member

pcuenca commented Jan 31, 2025

Sorry about that, we should unify soon!

@OneMHz
Copy link

OneMHz commented Jan 31, 2025

Thanks! That is working much better!

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

6 participants