Views
No views yet
1#Import model:
2from happytransformer import HappyGeneration
3happy_gen = HappyGeneration("GPT2", "DarwinAnim8or/gpt-grug-355m")
4
5#Set generation settings:
6from happytransformer import GENSettings
7args_top_k = GENSettings(no_repeat_ngram_size=2, do_sample=True,top_k=50, temperature=0.7, max_length=50, early_stopping=False)
8
9#Generate a response:
10result = happy_gen.generate_text("""Person: "Hello grug"
11Grug: "hello person"
12###
13Person: "how are you grug"
14Grug: "grug doing ok. grug find many berry. good for tribe."
15###
16Person: "what does grug think of new spear weapon?"
17Grug: "grug no like new spear weapon. grug stick bigger. spear too small, break easy"
18###
19Person: "what does grug think of football?"
20Grug: \"""", args=args_top_k)
21
22print(result)
23print(result.text)