-
Notifications
You must be signed in to change notification settings - Fork 102
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 text embedding serving #206
Comments
#100 may have some things that can help |
Hey @sonic182, here's code that matches your Python transformers example: {:ok, model_info} = Bumblebee.load_model({:hf, "bert-base-uncased"}, architecture: :base)
{:ok, tokenizer} = Bumblebee.load_tokenizer({:hf, "bert-base-uncased"})
text = "Hello, world!"
inputs = Bumblebee.apply_tokenizer(tokenizer, text)
Axon.predict(model_info.model, model_info.params, inputs).hidden_state[0] @trodrigu thanks for the reference :) It would make sense to have a serving pipeline to streamline this use case, so I will keep this open :) |
from transformers import CLIPModel, CLIPProcessor
import torch
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
text = "Hello, world!"
inputs = processor(text=text, return_tensors="pt")
model.get_text_features(**inputs) Is it possible to build servings for |
@rakshans1 you can do both text and image the same way as the snippet above (featurizer/tokenizer + running base model). And yeah, we will have serving for both text and image. |
Is there a way of obtaining embedding from text? for example, to extract the 768 dim's from a given text using bert model
something similar to this python example (transformer and torch dependencies)
The text was updated successfully, but these errors were encountered: