Jinze commited on
Commit
5d3a5aa
1 Parent(s): 6657c15

Support streaming

Browse files
Files changed (1) hide show
  1. modeling_qwen.py +2 -2
modeling_qwen.py CHANGED
@@ -1026,7 +1026,7 @@ class QWenLMHeadModel(QWenPreTrainedModel):
1026
  seed=-1,
1027
  **kwargs):
1028
  outputs.append(token.item())
1029
- yield tokenizer.decode(outputs, skip_special_tokens=True, errors='ignore')
1030
 
1031
  return stream_generator()
1032
 
@@ -1159,4 +1159,4 @@ class RMSNorm(torch.nn.Module):
1159
  return rms_norm(x, self.weight, self.eps)
1160
  else:
1161
  output = self._norm(x.float()).type_as(x)
1162
- return output * self.weight
 
1026
  seed=-1,
1027
  **kwargs):
1028
  outputs.append(token.item())
1029
+ yield tokenizer.decode(outputs, skip_special_tokens=True, errors='ignore', keep_image_special=True)
1030
 
1031
  return stream_generator()
1032
 
 
1159
  return rms_norm(x, self.weight, self.eps)
1160
  else:
1161
  output = self._norm(x.float()).type_as(x)
1162
+ return output * self.weight