Views
No views yet
sentence-transformers installed you can use this model as following:1from sentence_transformers import SentenceTransformer
2sentences = ["This is an example sentence", "Each sentence is converted"]
3model = SentenceTransformer('quicktensor/dexml_movielens-33m')
4embeddings = model.encode(sentences)
5print(embeddings)1from transformers import AutoTokenizer, AutoModel
2import torch
3import torch.nn.functional as F
4
5pooler = lambda x: F.normalize(x[:, 0, :], dim=-1) # Choose CLS token and normalize
6
7sentences = ["This is an example sentence", "Each sentence is converted"]
8tokenizer = AutoTokenizer.from_pretrained('quicktensor/dexml_movielens-33m')
9model = AutoModel.from_pretrained('quicktensor/dexml_movielens-33m')
10
11encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
12with torch.no_grad():
13 embeddings = pooler(model(**encoded_input))
14
15print(embeddings)1@InProceedings{DEXML,
2 author = "Gupta, N. and Khatri, D. and Rawat, A-S. and Bhojanapalli, S. and Jain, P. and Dhillon, I.",
3 title = "Dual-encoders for Extreme Multi-label Classification",
4 booktitle = "International Conference on Learning Representations",
5 month = "May",
6 year = "2024"
7}