davidmezzetti commited on
Commit
58bbcf2
1 Parent(s): b03d78b

Update README

Browse files
Files changed (1) hide show
  1. README.md +8 -8
README.md CHANGED
@@ -22,11 +22,11 @@ This model can be used to build embeddings databases with [txtai](https://github
22
  ```python
23
  import txtai
24
 
25
- # New embeddings with requested number of dimensions
26
  embeddings = txtai.Embeddings(
27
  path="neuml/pubmedbert-base-embeddings-matryoshka",
28
  content=True,
29
- dimensions=256
30
  )
31
  embeddings.index(documents())
32
 
@@ -45,10 +45,10 @@ sentences = ["This is an example sentence", "Each sentence is converted"]
45
  model = SentenceTransformer("neuml/pubmedbert-base-embeddings-matryoshka")
46
  embeddings = model.encode(sentences)
47
 
48
- # Requested matryoshka dimensions
49
- dimensions = 256
50
 
51
- print(embeddings[:, :dimensions])
52
  ```
53
 
54
  ## Usage (Hugging Face Transformers)
@@ -82,11 +82,11 @@ with torch.no_grad():
82
  # Perform pooling. In this case, mean pooling.
83
  embeddings = meanpooling(output, inputs['attention_mask'])
84
 
85
- # Requested matryoshka dimensions
86
- dimensions = 256
87
 
88
  print("Sentence embeddings:")
89
- print(embeddings[:, :dimensions])
90
  ```
91
 
92
  ## Evaluation Results
 
22
  ```python
23
  import txtai
24
 
25
+ # New embeddings with requested dimensionality
26
  embeddings = txtai.Embeddings(
27
  path="neuml/pubmedbert-base-embeddings-matryoshka",
28
  content=True,
29
+ dimensionality=256
30
  )
31
  embeddings.index(documents())
32
 
 
45
  model = SentenceTransformer("neuml/pubmedbert-base-embeddings-matryoshka")
46
  embeddings = model.encode(sentences)
47
 
48
+ # Requested dimensionality
49
+ dimensionality = 256
50
 
51
+ print(embeddings[:, :dimensionality])
52
  ```
53
 
54
  ## Usage (Hugging Face Transformers)
 
82
  # Perform pooling. In this case, mean pooling.
83
  embeddings = meanpooling(output, inputs['attention_mask'])
84
 
85
+ # Requested dimensionality
86
+ dimensionality = 256
87
 
88
  print("Sentence embeddings:")
89
+ print(embeddings[:, :dimensionality])
90
  ```
91
 
92
  ## Evaluation Results