Peter Michael Gits Claude commited on
Commit
1a1d398
Β·
1 Parent(s): 17f8efe

Add detailed debugging for lm_gen.step() returning None

Browse files

v1.4.8 - Debug text generation failure:
- Added detailed logging for lm_gen.step() calls
- Check if step() returns None vs actual tensor data
- Log tensor shapes and types at each step
- Will reveal why 'NoneType' object is not subscriptable
- Progress: Audio encoding βœ…, C++ compiler βœ…, debugging step API

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -21,7 +21,7 @@ from fastapi.responses import JSONResponse, HTMLResponse
21
  import uvicorn
22
 
23
  # Version tracking
24
- VERSION = "1.4.7"
25
  COMMIT_SHA = "TBD"
26
 
27
  # Configure logging
@@ -182,11 +182,21 @@ def transcribe_audio_moshi(audio_data: np.ndarray, sample_rate: int = 24000) ->
182
  for i in range(audio_tokens.shape[-1]):
183
  # Extract single timestep tokens
184
  code_step = audio_tokens[:, :, i:i+1] # [B, 8, 1]
 
 
185
  # Generate tokens using step method
186
  tokens_out = lm_gen.step(code_step) # [B, 1 + 8, 1]
187
- # Extract text token (index 1)
188
- text_token = tokens_out[:, 1:2, :] # [B, 1, 1]
189
- text_tokens.append(text_token)
 
 
 
 
 
 
 
 
190
 
191
  # Concatenate all text tokens
192
  if text_tokens:
 
21
  import uvicorn
22
 
23
  # Version tracking
24
+ VERSION = "1.4.8"
25
  COMMIT_SHA = "TBD"
26
 
27
  # Configure logging
 
182
  for i in range(audio_tokens.shape[-1]):
183
  # Extract single timestep tokens
184
  code_step = audio_tokens[:, :, i:i+1] # [B, 8, 1]
185
+ logger.info(f"πŸ” Step {i}: code_step shape: {code_step.shape}")
186
+
187
  # Generate tokens using step method
188
  tokens_out = lm_gen.step(code_step) # [B, 1 + 8, 1]
189
+ logger.info(f"πŸ” Step {i}: tokens_out type: {type(tokens_out)}, value: {tokens_out}")
190
+
191
+ if tokens_out is not None:
192
+ logger.info(f"πŸ” Step {i}: tokens_out shape: {tokens_out.shape}")
193
+ # Extract text token (index 1)
194
+ text_token = tokens_out[:, 1:2, :] # [B, 1, 1]
195
+ text_tokens.append(text_token)
196
+ logger.info(f"βœ… Step {i}: Added text token shape: {text_token.shape}")
197
+ else:
198
+ logger.error(f"❌ Step {i}: lm_gen.step() returned None!")
199
+ break
200
 
201
  # Concatenate all text tokens
202
  if text_tokens: