diff --git a/docs/source/model_doc/pegasus.rst b/docs/source/model_doc/pegasus.rst index 449a618b3b9..ff66847bbdb 100644 --- a/docs/source/model_doc/pegasus.rst +++ b/docs/source/model_doc/pegasus.rst @@ -90,7 +90,7 @@ Usage Example >>> device = 'cuda' if torch.cuda.is_available() else 'cpu' >>> tokenizer = PegasusTokenizer.from_pretrained(model_name) >>> model = PegasusForConditionalGeneration.from_pretrained(model_name).to(device) - >>> batch = tokenizer(src_text, truncation=True, padding='longest', return_tensors="pt").to(torch_device) + >>> batch = tokenizer(src_text, truncation=True, padding='longest', return_tensors="pt").to(device) >>> translated = model.generate(**batch) >>> tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True) >>> assert tgt_text[0] == "California's largest electricity provider has turned off power to hundreds of thousands of customers."