Tomtom84 commited on
Commit
e97cf4d
·
verified ·
1 Parent(s): 291cd8b

Update orpheus-tts/decoder.py

Browse files
Files changed (1) hide show
  1. orpheus-tts/decoder.py +11 -1
orpheus-tts/decoder.py CHANGED
@@ -94,20 +94,30 @@ def turn_token_into_id(token_string, index):
94
  async def tokens_decoder(token_gen):
95
  buffer = []
96
  count = 0
97
- async for token_sim in token_gen:
 
 
 
98
  token = turn_token_into_id(token_sim, count)
 
 
99
  if token is None:
100
  pass
101
  else:
102
  if token > 0:
103
  buffer.append(token)
104
  count += 1
 
105
 
106
  if count % 7 == 0 and count > 27:
107
  buffer_to_proc = buffer[-28:]
 
108
  audio_samples = convert_to_audio(buffer_to_proc, count)
109
  if audio_samples is not None:
 
110
  yield audio_samples
 
 
111
 
112
 
113
  # ------------------ Synchronous Tokens Decoder Wrapper ------------------ #
 
94
  async def tokens_decoder(token_gen):
95
  buffer = []
96
  count = 0
97
+ token_count = 0
98
+ async for token_sim in token_gen:
99
+ token_count += 1
100
+ print(f"DEBUG DECODER: Processing token {token_count}: {repr(token_sim)}")
101
  token = turn_token_into_id(token_sim, count)
102
+ print(f"DEBUG DECODER: Converted to ID: {token}")
103
+
104
  if token is None:
105
  pass
106
  else:
107
  if token > 0:
108
  buffer.append(token)
109
  count += 1
110
+ print(f"DEBUG DECODER: Added to buffer. Count: {count}, Buffer size: {len(buffer)}")
111
 
112
  if count % 7 == 0 and count > 27:
113
  buffer_to_proc = buffer[-28:]
114
+ print(f"DEBUG DECODER: Converting buffer to audio. Buffer: {buffer_to_proc}")
115
  audio_samples = convert_to_audio(buffer_to_proc, count)
116
  if audio_samples is not None:
117
+ print(f"DEBUG DECODER: Generated audio chunk of {len(audio_samples)} bytes")
118
  yield audio_samples
119
+ else:
120
+ print("DEBUG DECODER: convert_to_audio returned None")
121
 
122
 
123
  # ------------------ Synchronous Tokens Decoder Wrapper ------------------ #