Update README.md
Browse files
README.md
CHANGED
@@ -73,6 +73,9 @@ from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
|
73 |
model = MBartForConditionalGeneration.from_pretrained("Anonymous-TST/knight-errant-TST-zh")
|
74 |
tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50", src_lang="zh_CN", tgt_lang="zh_CN")
|
75 |
|
|
|
|
|
|
|
76 |
article_1 = "jinyong: 接下来会发生什么?"
|
77 |
batch = tokenizer(article_1, return_tensors="pt",return_token_type_ids=False, truncation=True, max_length=64, padding=True).to('cuda')
|
78 |
translated_tokens = model.generate(**batch,max_length=64)
|
|
|
73 |
model = MBartForConditionalGeneration.from_pretrained("Anonymous-TST/knight-errant-TST-zh")
|
74 |
tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50", src_lang="zh_CN", tgt_lang="zh_CN")
|
75 |
|
76 |
+
model.cuda()
|
77 |
+
model.eval()
|
78 |
+
|
79 |
article_1 = "jinyong: 接下来会发生什么?"
|
80 |
batch = tokenizer(article_1, return_tensors="pt",return_token_type_ids=False, truncation=True, max_length=64, padding=True).to('cuda')
|
81 |
translated_tokens = model.generate(**batch,max_length=64)
|