praeclarumjj3 commited on
Commit
80b1c78
·
1 Parent(s): a9e3b02

Update chat.py

Browse files
Files changed (1) hide show
  1. chat.py +24 -24
chat.py CHANGED
@@ -159,30 +159,30 @@ class Chat:
159
  yield json.dumps({"text": generated_text, "error_code": 0}).encode()
160
 
161
  def generate_stream_gate(self, params):
162
- try:
163
- for x in self.generate_stream(params):
164
- yield x
165
- except ValueError as e:
166
- print("Caught ValueError:", e)
167
- ret = {
168
- "text": server_error_msg,
169
- "error_code": 1,
170
- }
171
- yield json.dumps(ret).encode()
172
- except torch.cuda.CudaError as e:
173
- print("Caught torch.cuda.CudaError:", e)
174
- ret = {
175
- "text": server_error_msg,
176
- "error_code": 1,
177
- }
178
- yield json.dumps(ret).encode()
179
- except Exception as e:
180
- print("Caught Unknown Error", e)
181
- ret = {
182
- "text": server_error_msg,
183
- "error_code": 1,
184
- }
185
- yield json.dumps(ret).encode()
186
 
187
 
188
  if __name__ == "__main__":
 
159
  yield json.dumps({"text": generated_text, "error_code": 0}).encode()
160
 
161
  def generate_stream_gate(self, params):
162
+ # try:
163
+ for x in self.generate_stream(params):
164
+ yield x
165
+ # except ValueError as e:
166
+ # print("Caught ValueError:", e)
167
+ # ret = {
168
+ # "text": server_error_msg,
169
+ # "error_code": 1,
170
+ # }
171
+ # yield json.dumps(ret).encode()
172
+ # except torch.cuda.CudaError as e:
173
+ # print("Caught torch.cuda.CudaError:", e)
174
+ # ret = {
175
+ # "text": server_error_msg,
176
+ # "error_code": 1,
177
+ # }
178
+ # yield json.dumps(ret).encode()
179
+ # except Exception as e:
180
+ # print("Caught Unknown Error", e)
181
+ # ret = {
182
+ # "text": server_error_msg,
183
+ # "error_code": 1,
184
+ # }
185
+ # yield json.dumps(ret).encode()
186
 
187
 
188
  if __name__ == "__main__":