Update README.md
Browse files
README.md
CHANGED
@@ -2704,7 +2704,7 @@ with torch.no_grad():
|
|
2704 |
model_output = model(**encoded_input)
|
2705 |
|
2706 |
embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
|
2707 |
-
+ embeddings = F.layer_norm(embeddings, normalized_shape=embeddings.shape[1],
|
2708 |
+ embeddings = embeddings[:, :matryoshka_dim]
|
2709 |
embeddings = F.normalize(embeddings, p=2, dim=1)
|
2710 |
print(embeddings)
|
|
|
2704 |
model_output = model(**encoded_input)
|
2705 |
|
2706 |
embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
|
2707 |
+
+ embeddings = F.layer_norm(embeddings, normalized_shape=(embeddings.shape[1],))
|
2708 |
+ embeddings = embeddings[:, :matryoshka_dim]
|
2709 |
embeddings = F.normalize(embeddings, p=2, dim=1)
|
2710 |
print(embeddings)
|