Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: predict() missing 1 required positional argument: 'model_or_model_path' #121

Closed
drscotthawley opened this issue Apr 16, 2024 · 3 comments

Comments

@drscotthawley
Copy link

drscotthawley commented Apr 16, 2024

Describe the bug
When I executed the suggested Python code on the README.md file...

from basic_pitch.inference import predict
from basic_pitch import ICASSP_2022_MODEL_PATH

model_output, midi_data, note_events = predict('my_audio.wav')

I receive this Error message:

    model_output, midi_data, note_events = predict(tmp_audio_file)
TypeError: predict() missing 1 required positional argument: 'model_or_model_path'

Looking at line 416 of inference.py, it appears the Python REPL is not wrong: model_or_model_path is a required argument for predict():

def predict(
    audio_path: Union[pathlib.Path, str],
    model_or_model_path: Union[Model, pathlib.Path, str],
...

How then is the documentation on the README to be applied?

To Reproduce
Steps to reproduce the behavior:

  1. Try to use the code from the README
  2. Supply an audio file
  3. Execute the code
  4. See error

Expected behavior
No error, execution would be smooth

Screenshots
Screenshot 2024-04-15 at 9 00 17 PM

Desktop (please complete the following information):

  • OS: MacOs
  • Browser n/a
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

$ pip list | grep basic
basic-pitch               0.3.0

$ python --version
Python 3.10.12

@drscotthawley
Copy link
Author

Unrelated but it affects my ability to verify the Python functionality:
the demo website appears to be broken.

Try uploading or recording any audio, in Brave, Chrome or Safari. After the audio loads, the upload pane resets without any MIDI appearing. JavaScript Console shows many uncaught "promises", for things like "gain":

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'gain')
    at index-5eb44d2184e903c2.js:1:10164
    at new Promise (<anonymous>)
    at index-5eb44d2184e903c2.js:1:10132
    at main-7428d4a68ea7713f.js:1:103649
    at Object.next (main-7428d4a68ea7713f.js:1:103754)
    at r (438-4691f28b16d7fe94.js:1:54465)
    at c (438-4691f28b16d7fe94.js:1:54668)
    at 438-4691f28b16d7fe94.js:1:54727
    at new Promise (<anonymous>)
    at 438-4691f28b16d7fe94.js:1:54608

No proxies, ad blockers, or extensions in use.

@drubinstein
Copy link
Contributor

Hi. Looks like this is related to the recent 0.3.0 release. I was away for a bit, but plan to prioritize fixing this ASAP.

@drubinstein
Copy link
Contributor

Fixed, merged and uploaded to pypi as v0.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants