nuojohnchen commited on
Commit
44c12b6
·
verified ·
1 Parent(s): d644194

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -111,16 +111,16 @@ def generate_response(instruction, model_path, progress=gr.Progress()):
111
  do_sample=True
112
  )
113
 
114
- full_response = response_tokenizer.decode(output[0], skip_special_tokens=True)
115
 
116
- clean_response = full_response.replace(f"<|user|>\n{instruction}\n<|assistant|>", "").strip()
117
 
118
- if "<|user|>" in clean_response:
119
- clean_response = clean_response.split("<|user|>")[0].strip()
120
 
121
- for token in ["<user>", "User:", "Human:"]:
122
- if token in clean_response:
123
- clean_response = clean_response.split(token)[0].strip()
124
 
125
 
126
 
 
111
  do_sample=True
112
  )
113
 
114
+ full_response = response_tokenizer.decode(output[0], skip_special_tokens=True)
115
 
116
+ clean_response = full_response.replace(f"<|user|>\n{instruction}\n<|assistant|>", "").strip()
117
 
118
+ if "<|user|>" in clean_response:
119
+ clean_response = clean_response.split("<|user|>")[0].strip()
120
 
121
+ for token in ["<user>", "User:", "Human:"]:
122
+ if token in clean_response:
123
+ clean_response = clean_response.split(token)[0].strip()
124
 
125
 
126