From fec76a481d1ecfbf068d87735dd44ffc26158f6e Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Tue, 23 Jul 2019 16:05:29 +0200 Subject: [PATCH] Update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aae27cc8ee..8e2074f727 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,8 @@ for model_class, tokenizer_class, pretrained_weights in MODELS: # Encode text input_ids = torch.tensor([tokenizer.encode("Here is some text to encode")]) - last_hidden_states = model(input_ids)[0] # Models outputs are now tuples + with torch.no_grad(): + last_hidden_states = model(input_ids)[0] # Models outputs are now tuples # Each architecture is provided with several class for fine-tuning on down-stream tasks, e.g. BERT_MODEL_CLASSES = [BertModel, BertForPreTraining, BertForMaskedLM, BertForNextSentencePrediction,