CoolFace
Modelpublic

AnkitSatpute/Llama-3.1-ReRank-AllFTbtAbstr

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes
Model Card

Model Card for Model ID

The model is trained to generate document embeddings for math research papers and use the embeddings to find similar ranked documents.

Model Details

LLaMa model that is trained with contrastive learning for sequence classification.

How to use for generating embeddings

from transformers import AutoTokenizer, AutoModel import torch

sentences = ["Hello Who are you?", "I am fine thank you"]

tokenizer = AutoTokenizer.from_pretrained('AnkitSatpute/Llama-3.1-ReRank-AllFTbtAbstr')

model = AutoModel.from_pretrained('AnkitSatpute/Llama-3.1-ReRank-AllFTbtAbstr')

model.eval()

with torch.no_grad():

modeloutput = model(**encodedinput)

sentenceembeddings = modeloutput[0][:, 0]

sentenceembeddings = torch.nn.functional.normalize(sentenceembeddings, p=2, dim=1)

print("Sentence embeddings:", sentence_embeddings)