BigSalmon commited on
Commit
aeb78d5
·
1 Parent(s): 46d30f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -81,7 +81,7 @@ def BestProbs(prompt):
81
  logits, past_key_values = model(myinput, past_key_values = past_key_values, return_dict=False)
82
  logits = logits[0,-1]
83
  probabilities = torch.nn.functional.softmax(logits)
84
- best_logits, best_indices = logits.topk(200)
85
  best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
86
  for i in best_words[0:10]:
87
  print("_______")
@@ -102,12 +102,14 @@ def BestProbs2(prompt):
102
  best_logits, best_indices = logits.topk(10)
103
  best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
104
  for i in best_words[0:10]:
 
105
  st.write(i)
106
 
107
  with st.form(key='my_form'):
108
  prompt = st.text_area(label='Enter sentence', value=g)
109
  submit_button = st.form_submit_button(label='Submit')
110
  submit_button2 = st.form_submit_button(label='Fast Forward')
 
111
 
112
  if submit_button:
113
  with torch.no_grad():
@@ -125,6 +127,11 @@ with st.form(key='my_form'):
125
  words = []
126
  st.write(best_words)
127
  if submit_button2:
 
 
 
 
 
 
128
  st.write("___")
129
- ok = BestProbs(prompt)
130
- st.write(ok)
 
81
  logits, past_key_values = model(myinput, past_key_values = past_key_values, return_dict=False)
82
  logits = logits[0,-1]
83
  probabilities = torch.nn.functional.softmax(logits)
84
+ best_logits, best_indices = logits.topk(10)
85
  best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
86
  for i in best_words[0:10]:
87
  print("_______")
 
102
  best_logits, best_indices = logits.topk(10)
103
  best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
104
  for i in best_words[0:10]:
105
+ print(i)
106
  st.write(i)
107
 
108
  with st.form(key='my_form'):
109
  prompt = st.text_area(label='Enter sentence', value=g)
110
  submit_button = st.form_submit_button(label='Submit')
111
  submit_button2 = st.form_submit_button(label='Fast Forward')
112
+ submit_button3 = st.form_submit_button(label='Fast Forward 2.0')
113
 
114
  if submit_button:
115
  with torch.no_grad():
 
127
  words = []
128
  st.write(best_words)
129
  if submit_button2:
130
+ print("----")
131
+ st.write("___")
132
+ m = BestProbs(prompt)
133
+ st.write(m)
134
+ if submit_button3:
135
+ print("----")
136
  st.write("___")
137
+ st.write(BestProbs)