File size: 505 Bytes
7cd7caf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from sentence_transformers import SentenceTransformer
import time
import torch
model = SentenceTransformer("Snowflake/snowflake-arctic-embed-xs", device="cuda")
texts = ["The quick brown fox jumps over the lazy dog."] * 1000
start = time.time()
embeddings = model.encode(
texts,
batch_size=512,
convert_to_tensor=True,
normalize_embeddings=True,
device="cuda",
torch_dtype=torch.int8
)
print(f"⏱️ Embedded 1000 items in {time.time() - start:.2f} seconds")
|