TJKlein commited on
Commit
19053f7
·
1 Parent(s): fd864f7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -1
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
- outputs = model(**batch, output_hidden_states=True, return_dict=True)
 
 
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