Views
No views yet
model.encode for generating embeddings. Below is an example usage snippet:1# Load model directly
2from transformers import AutoTokenizer, AutoModel
3tokenizer = AutoTokenizer.from_pretrained("ArchitRastogi/BGE-Small-LegalEmbeddings-USCode")
4model = AutoModel.from_pretrained("ArchitRastogi/BGE-Small-LegalEmbeddings-USCode")
5text = "Duties of the president"
6inputs = tokenizer(text, return_tensors="pt")
7outputs = model(**inputs)
8#Printing the Embeddings
9print(outputs)
10