k-l-lambda commited on
Commit
54a557e
·
1 Parent(s): 7f31eab

fixed measures bias of StreamingLilyletGenerator

Browse files
Files changed (1) hide show
  1. lilyscript/generator.py +3 -1
lilyscript/generator.py CHANGED
@@ -270,7 +270,9 @@ class StreamingLilyletGenerator:
270
  patches.append(chunk + [self.pad_id] * (self.patch_size - len(chunk)))
271
 
272
  out_text = self.patches_to_text(patches[1:])
273
- prime_ids = self.tokenizer.encode(f'[r:0/{measures}]') if measures is not None else None
 
 
274
  primed = False
275
 
276
  # seed the monitor's running context/stream from the prompt patches (if any)
 
270
  patches.append(chunk + [self.pad_id] * (self.patch_size - len(chunk)))
271
 
272
  out_text = self.patches_to_text(patches[1:])
273
+ # 0-based marker: `y` counts measures remaining AFTER this one (patchifier:
274
+ # y = total - i - 1), so `[r:0/{measures-1}]` yields exactly `measures` total.
275
+ prime_ids = self.tokenizer.encode(f'[r:0/{measures - 1}]') if measures is not None and measures >= 1 else None
276
  primed = False
277
 
278
  # seed the monitor's running context/stream from the prompt patches (if any)