From f1871f4050267445107c35f9e376b8e21d021dc9 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 23 Mar 2021 17:29:56 +0100 Subject: [PATCH] Update. --- gpt-test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gpt-test.py b/gpt-test.py index ff72e50..557f734 100755 --- a/gpt-test.py +++ b/gpt-test.py @@ -22,7 +22,9 @@ from transformers import GPT2Tokenizer, GPT2LMHeadModel ###################################################################### -def complete(model, primer, nb_sentences = 1, nb_token_max = 100, temperature = None): +def complete(model, tokenizer, + primer, + nb_sentences = 1, nb_token_max = 100, temperature = None): nt, ns = 0, 0 tokens = tokenizer.encode(primer) primer_len = len(tokens) @@ -52,7 +54,7 @@ model = GPT2LMHeadModel.from_pretrained(model_name) model.eval() print( - complete(model, + complete(model, tokenizer, 'The object was blue all over, but also green all over, it was a', ) ) -- 2.39.5