DuckyPolice commited on
Commit
82d2ad2
1 Parent(s): e867e2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -32,7 +32,7 @@ m = torch.load('model.pt', map_location=torch.device('cpu'))
32
  model.load_state_dict(m)
33
  model.to(device);
34
 
35
- str = st.text_input( 'Enter 1-4 words of the beginning of the text, and wait a minute' , 'The man asks the waiter' )
36
 
37
  # model without additional training
38
  # prompt is a string that will be accepted as input and continued by the model
@@ -59,7 +59,7 @@ out1 = model_init.generate(
59
  # how much (try) not to repeat n_gram in a row
60
  no_repeat_ngram_size=3,
61
  # how many generations to return
62
- num_return_sequences=3,
63
  ).cpu().numpy() #).numpy()
64
 
65
  st.write('\n------------------\n')
@@ -88,12 +88,4 @@ with torch.inference_mode():
88
  top_p=0.6,
89
  no_repeat_ngram_size=2,
90
  num_return_sequences=3,
91
- ).cpu().numpy() #).cpu().numpy()
92
-
93
- st.subheader( 'Texts on a model trained with documents of all subjects and retrained with jokes:' )
94
- n = 0
95
- for out_ in out2:
96
- n += 1
97
- st.write(tokenizer.decode(out_).rpartition('.')[0],'.')
98
- # print(textwrap.fill(tokenizer.decode(out_), 100), end='\n------------------\n')
99
- st.write('\n------------------\n')
 
32
  model.load_state_dict(m)
33
  model.to(device);
34
 
35
+ str = st.text_input( 'Enter 1-4 words of the beginning of the text, and wait a minute' , '' )
36
 
37
  # model without additional training
38
  # prompt is a string that will be accepted as input and continued by the model
 
59
  # how much (try) not to repeat n_gram in a row
60
  no_repeat_ngram_size=3,
61
  # how many generations to return
62
+ num_return_sequences=1,
63
  ).cpu().numpy() #).numpy()
64
 
65
  st.write('\n------------------\n')
 
88
  top_p=0.6,
89
  no_repeat_ngram_size=2,
90
  num_return_sequences=3,
91
+ ).cpu().numpy() #).cpu().numpy()