Views
No views yet
1from fastembed import SparseTextEmbedding
2
3documents = [
4 "You should stay, study and sprint.",
5 "History can only prepare us to be surprised yet again.",
6]
7
8model = SparseTextEmbedding(model_name="prithivida/Splade_PP_en_v1")
9embeddings = list(model.embed(documents))
10
11# [
12# SparseEmbedding(values=array(
13# [0.45940185, 0.64054322, 0.2425732, 0.1623179, 1.20566428,
14# 0.62039357...]),
15# indices=array([1012, 1998, 2000, 2005, 2017, 2022...])),
16# SparseEmbedding(values=array([
17# 0.09767706, 0.4374367, 0.00468039, 1.01167965, 1.02318227, 1.30155718
18# ...]),
19# indices=array([2017, 2022, 2025, 2057, 2064, 2069...]))
20# ]
21