xu song commited on
Commit
c56ba55
·
1 Parent(s): b6dd571
Files changed (1) hide show
  1. models/cpp_qwen2.py +7 -1
models/cpp_qwen2.py CHANGED
@@ -126,12 +126,18 @@ class Qwen2Simulator(Simulator):
126
  stream=True,
127
  **self.generation_kwargs
128
  )
 
 
129
  generated_text = ""
130
  # TODO: 检测finish reason,如果是length,则shift,并继续生成。
131
  for out in output:
132
  stream = copy.deepcopy(out)
133
  generated_text += stream["choices"][0]["text"]
134
- yield generated_text
 
 
 
 
135
 
136
 
137
  bot = Qwen2Simulator()
 
126
  stream=True,
127
  **self.generation_kwargs
128
  )
129
+
130
+
131
  generated_text = ""
132
  # TODO: 检测finish reason,如果是length,则shift,并继续生成。
133
  for out in output:
134
  stream = copy.deepcopy(out)
135
  generated_text += stream["choices"][0]["text"]
136
+ if "all_text" in stream["choices"][0]:
137
+ yield stream["choices"][0]["all_text"]
138
+ else:
139
+ logger.info("all_text not found")
140
+ yield generated_text
141
 
142
 
143
  bot = Qwen2Simulator()