Views
No views yet
text-embedding-3-small (1536-dim) to predict sentiment: negative, neutral, positive.[batch, 1536] (OpenAI text-embedding-3-small embeddings).1from transformers import AutoModel
2import torch
3
4# Load model
5model = AutoModel.from_pretrained(
6 "marcovise/TextEmbedding3SmallSentimentHead",
7 trust_remote_code=True
8).eval()
9
10# Your 1536-dim OpenAI embeddings
11embeddings = torch.randn(4, 1536) # batch of 4 examples
12
13# Predict sentiment
14with torch.no_grad():
15 logits = model(inputs_embeds=embeddings)["logits"] # [batch, 3]
16 predictions = logits.argmax(dim=1) # [batch]
17 # 0=negative, 1=neutral, 2=positive
18
19print(predictions) # tensor([1, 0, 2, 1])