ales commited on
Commit
0952218
1 Parent(s): abfa68a

removed redundant torch tensor copy

Browse files
Files changed (1) hide show
  1. pipeline.py +3 -2
pipeline.py CHANGED
@@ -53,9 +53,10 @@ class PreTrainedPipeline():
53
  sampling_rate=self.sampling_rate
54
  )['input_values']
55
 
 
 
56
  with torch.no_grad():
57
- # input_values should be a 1D numpy array by now
58
- input_values = torch.tensor(input_values, device=self.device)
59
  model_outs = self.model(input_values)
60
  logits = model_outs.logits.cpu().detach().numpy()
61
 
 
53
  sampling_rate=self.sampling_rate
54
  )['input_values']
55
 
56
+ input_values = input_values.to(self.device)
57
+
58
  with torch.no_grad():
59
+ # input_values should be a 2D tensor by now. 1st dim represents audio channels.
 
60
  model_outs = self.model(input_values)
61
  logits = model_outs.logits.cpu().detach().numpy()
62