yoyolicoris commited on
Commit
e298d4c
·
1 Parent(s): 13b9d6a

fix: ensure input tensor has a single channel by averaging if necessary

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -323,6 +323,9 @@ def render(y, remove_approx, ratio, vec):
323
  loudness = meter.integrated_loudness(y)
324
  y = pyln.normalize.loudness(y, loudness, -18.0)
325
  y = torch.from_numpy(y).float().T.unsqueeze(0).to(device)
 
 
 
326
  if remove_approx:
327
  infer_fx = instantiate(rt_config).to(device)
328
  else:
 
323
  loudness = meter.integrated_loudness(y)
324
  y = pyln.normalize.loudness(y, loudness, -18.0)
325
  y = torch.from_numpy(y).float().T.unsqueeze(0).to(device)
326
+ if y.shape[1] != 1:
327
+ y = y.mean(dim=1, keepdim=True)
328
+
329
  if remove_approx:
330
  infer_fx = instantiate(rt_config).to(device)
331
  else: