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_lf-amazontitles-1.3m')
4embeddings = model.encode(sentences)
5print(embeddings)1from transformers import AutoTokenizer, AutoModel
2
3pooler = lambda x: x[:, 0, :] # Choose CLS token
4
5sentences = ["This is an example sentence", "Each sentence is converted"]
6tokenizer = AutoTokenizer.from_pretrained('quicktensor/dexml_lf-amazontitles-1.3m')
7model = AutoModel.from_pretrained('quicktensor/dexml_lf-amazontitles-1.3m')
8
9encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
10with torch.no_grad():
11 embeddings = pooler(model(**encoded_input))
12
13print(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}