justus-tobias commited on
Commit
dd7a48c
1 Parent(s): 43e6c08

mimi codes shape warning

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -26,8 +26,10 @@ def compute_codes(wav):
26
  for offset in tqdm(range(0, wav.shape[-1], frame_size), desc="computing Codes"):
27
  frame = wav[:, :, offset: offset + frame_size]
28
  codes = mimi.encode(frame)
29
- assert codes.shape[-1] == 1, codes.shape
30
- all_codes.append(codes)
 
 
31
  return all_codes
32
 
33
  @spaces.GPU
@@ -100,8 +102,8 @@ def truncate_audio(wav, max_length):
100
 
101
  def process_audio(audio, instream):
102
  log_out = ""
103
- outwav = torch.randn(1, 1, 24000 * 10)
104
- stream = torch.randn(1, 1, 24000 * 10)
105
 
106
 
107
  print("Audio recieved")
 
26
  for offset in tqdm(range(0, wav.shape[-1], frame_size), desc="computing Codes"):
27
  frame = wav[:, :, offset: offset + frame_size]
28
  codes = mimi.encode(frame)
29
+ if codes.shape[-1] == 1:
30
+ all_codes.append(codes)
31
+ else:
32
+ print(f"Warning: Empty codes for frame at offset {offset}")
33
  return all_codes
34
 
35
  @spaces.GPU
 
102
 
103
  def process_audio(audio, instream):
104
  log_out = ""
105
+ outwav = torch.randn(1, 1, 24000 * 2)
106
+ stream = torch.randn(1, 1, 24000 * 2)
107
 
108
 
109
  print("Audio recieved")