Fix the dense embedding dimension slice

#32
Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -4684,7 +4684,7 @@ batch_dict = tokenizer(input_texts, max_length=8192, padding=True, truncation=Tr
4684
  outputs = model(**batch_dict)
4685
 
4686
  dimension=768 # The output dimension of the output embedding, should be in [128, 768]
4687
- embeddings = outputs.last_hidden_state[:, 0][:dimension]
4688
 
4689
  embeddings = F.normalize(embeddings, p=2, dim=1)
4690
  scores = (embeddings[:1] @ embeddings[1:].T) * 100
 
4684
  outputs = model(**batch_dict)
4685
 
4686
  dimension=768 # The output dimension of the output embedding, should be in [128, 768]
4687
+ embeddings = outputs.last_hidden_state[:, 0, :dimension]
4688
 
4689
  embeddings = F.normalize(embeddings, p=2, dim=1)
4690
  scores = (embeddings[:1] @ embeddings[1:].T) * 100