Transformers v5 compatibility fixes 4f562fd
Sławomir Dadas commited on
How to use sdadas/stella-pl with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("sdadas/stella-pl", trust_remote_code=True)
sentences = [
"zapytanie: Jak dożyć 100 lat?",
"Trzeba zdrowo się odżywiać i uprawiać sport.",
"Trzeba pić alkohol, imprezować i jeździć szybkimi autami.",
"Gdy trwała kampania politycy zapewniali, że rozprawią się z zakazem niedzielnego handlu."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]How to use sdadas/stella-pl with Transformers:
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("sdadas/stella-pl", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("sdadas/stella-pl", trust_remote_code=True)