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

Add Jina Embedding model #52

Merged
merged 9 commits into from
Oct 27, 2023
Merged

Add Jina Embedding model #52

merged 9 commits into from
Oct 27, 2023

Conversation

philipkiely-baseten
Copy link
Member

Add a Truss for Jina embedding model, intending to add to model library today + publish a blog post on this

self._model = None

def load(self):
self._model = AutoModel.from_pretrained(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bonus, you can use hf_cache in the config with these settings so the cold start is fire out of the box.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

environment_variables: {}
external_package_dirs: []
model_metadata:
example_model_input: {"text": ["I want to eat pasta", "I want to eat pizza"]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add the max length to the sample so it's obvious that users can edit it.

Copy link
Contributor

@squidarth squidarth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! could you also please add this to the ci.yaml? lmk if you need help getting the lint to pass

environment_variables: {}
external_package_dirs: []
hf_cache:
- repo_id: jinaai/jina-embeddings-v2-base-en
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably wanna pin the revision here just like you're doing in the load.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense, do you know how to do that? Would it just be revision: abcd1234?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philipkiely-baseten
Copy link
Member Author

@bolasim I was having trouble getting the hf_cache working with the revision, and I want to get this live, so I took hf_cache out entirely when I updated to the latest version.

The model is a quarter of a gig, so the download actually only takes about a second (log line below):

Downloading model.safetensors: 275MB [00:01, 264MB/s]
...
Completed model.load() execution in 8419 ms

The whole model.load() is 8.5 seconds which is not great but not terrible. And the model is running faster now with the new revision, I'm getting 40-45 seconds for my shakespeare dataset.

@bolasim
Copy link
Contributor

bolasim commented Oct 27, 2023

Whatever you think is best!

@philipkiely-baseten philipkiely-baseten merged commit b8d902e into main Oct 27, 2023
1 check passed
@philipkiely-baseten philipkiely-baseten deleted the philip/jina-embed branch December 12, 2023 23:03
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

Successfully merging this pull request may close these issues.

3 participants