Update README.md
Browse files
README.md
CHANGED
|
@@ -40,7 +40,9 @@ batch = tokenizer.batch_encode_plus(
|
|
| 40 |
|
| 41 |
# Compute the embeddings and keep only the _**[CLS]**_ embedding (the first token)
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
embeddings = outputs.last_hidden_state[:,0]
|
| 46 |
|
|
|
|
| 40 |
|
| 41 |
# Compute the embeddings and keep only the _**[CLS]**_ embedding (the first token)
|
| 42 |
|
| 43 |
+
# Get raw embeddings (no gradients)
|
| 44 |
+
with torch.no_grad():
|
| 45 |
+
outputs = model(**batch, output_hidden_states=True, return_dict=True)
|
| 46 |
|
| 47 |
embeddings = outputs.last_hidden_state[:,0]
|
| 48 |
|