From: Francois Fleuret Date: Tue, 23 Mar 2021 16:29:56 +0000 (+0100) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=f1871f4050267445107c35f9e376b8e21d021dc9;p=pytorch.git Update. --- 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', ) )