Tomtom84 commited on
Commit
9a2b198
·
verified ·
1 Parent(s): 7c37296

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -107,12 +107,12 @@ async def tts(ws: WebSocket):
107
  buf = []
108
 
109
  while True:
110
- next_cache_pos = torch.tensor([offset_len], device=device) if past is not None else None
111
  gen = model.generate(
112
  input_ids = ids if past is None else torch.tensor([[last_tok]], device=device),
113
  attention_mask = attn if past is None else None,
114
  past_key_values = past,
115
- cache_position = None if past is None else next_cache_pos,
116
  max_new_tokens = CHUNK_TOKENS,
117
  logits_processor=[masker],
118
  do_sample=True, temperature=0.7, top_p=0.95,
 
107
  buf = []
108
 
109
  while True:
110
+ next_cache_pos = torch.tensor([past.get_seq_length()], device=device)
111
  gen = model.generate(
112
  input_ids = ids if past is None else torch.tensor([[last_tok]], device=device),
113
  attention_mask = attn if past is None else None,
114
  past_key_values = past,
115
+ cache_position = next_cache_pos,
116
  max_new_tokens = CHUNK_TOKENS,
117
  logits_processor=[masker],
118
  do_sample=True, temperature=0.7, top_p=0.95,