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

[Bug] NativeContextualEmbeddings causes crash #34

Open
Kilo-Loco opened this issue Jan 26, 2024 · 2 comments
Open

[Bug] NativeContextualEmbeddings causes crash #34

Kilo-Loco opened this issue Jan 26, 2024 · 2 comments

Comments

@Kilo-Loco
Copy link
Contributor

I have attempted to switch from using NativeEmbeddings to NativeContextualEmbeddings and it is causing my iOS app to crash. It seems that the embeddings object is failing to initialize the model.

Error:

SimilaritySearchKit/NativeContextualEmbeddings.swift:43: Fatal error: 'try!' expression unexpectedly raised an error: Foundation._GenericObjCError.nilError

Usage:

await SimilarityIndex(
    model: NativeContextualEmbeddings(),
    metric: CosineSimilarity()
)

Device:
iPhone 13 Pro Max
iOS Version 17.2.1

@ZachNagengast
Copy link
Owner

I believe this is happening because nativeModel.requestAssets is not completed before trying to load the model. Tricky to catch because it only shows up if it is the very first install of the app. Thanks for the report!

@tiepvuvan
Copy link

I think we should let developers decide when to load the model(and documented it) like the way Apple did. They tell us to requireAssets before using the Contextual Model.

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