wav2vec2-service icon indicating copy to clipboard operation
wav2vec2-service copied to clipboard

ONNXRuntimeError]

Open Mouniraithammadi opened this issue 7 months ago • 0 comments

Hi , I have a problem with ONNXRuntime it shows me this error

[ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: input for the following indices index: 0 Got: 196320 Expected: 1 Please fix either the inputs or the model.

this is the function

def predict(file):
  speech_array, sr = sf.read(file)
  features = processor(speech_array, sampling_rate=16000, return_tensors="pt")
  input_values = features.input_values
  print(input_values.numpy())
  onnx_outputs = session.run(None, {session.get_inputs()[0].name: input_values.numpy()})[0]
  prediction = np.argmax(onnx_outputs, axis=-1)
  return processor.decode(prediction.squeeze().tolist())

Mouniraithammadi avatar Nov 17 '23 23:11 Mouniraithammadi