scutcyr commited on
Commit
0e3b272
·
1 Parent(s): 7646d66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -27
app.py CHANGED
@@ -62,33 +62,6 @@ if 'generated' not in st.session_state:
62
  if 'past' not in st.session_state:
63
  st.session_state['past'] = []
64
 
65
- def query(history):
66
- inputs = tokenizer.dialogue_encode(
67
- history, add_start_token_as_response=True, return_tensors=True, is_split_into_words=False
68
- )
69
- inputs["input_ids"] = inputs["input_ids"].astype("int64")
70
- ids, scores = model.generate(
71
- input_ids=inputs["input_ids"],
72
- token_type_ids=inputs["token_type_ids"],
73
- position_ids=inputs["position_ids"],
74
- attention_mask=inputs["attention_mask"],
75
- max_length=64,
76
- min_length=1,
77
- decode_strategy="sampling",
78
- temperature=1.0,
79
- top_k=5,
80
- top_p=1.0,
81
- num_beams=0,
82
- length_penalty=1.0,
83
- early_stopping=False,
84
- num_return_sequences=20,
85
- )
86
- max_dec_len = 64
87
- num_return_sequences = 20
88
- bot_response = select_response(
89
- ids, scores, tokenizer, max_dec_len, num_return_sequences, keep_space=False
90
- )[0]
91
- return bot_response
92
 
93
  def get_text():
94
  input_text = st.text_input("用户: ","你好!", key="input")
 
62
  if 'past' not in st.session_state:
63
  st.session_state['past'] = []
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  def get_text():
67
  input_text = st.text_input("用户: ","你好!", key="input")