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

Unable to run render_piece #4

Open
eoinroe opened this issue Apr 17, 2024 · 5 comments
Open

Unable to run render_piece #4

eoinroe opened this issue Apr 17, 2024 · 5 comments
Assignees

Comments

@eoinroe
Copy link

eoinroe commented Apr 17, 2024

I am unable to generate an expressive performance using the instructions provided. I have tried setting up the project using the instructions for both pip and conda but it makes no difference.

It isn't possible to run the following executable since it does not exists:

./bin/render_piece

@CarlosCancino-Chacon
Copy link
Member

Hi @eoinroe!

Thanks for pointing this out. There were some changes in the code sometime last year, and they were not properly documented in the README. The code needed some updates to keep up with the latest changes in Partitura (some of the code for computing features in the basismixer repository was moved to partitura).

A few months ago, I made some updates (which are not fully finished) to have a more general way of training and evaluating the model. I would suggest that you use the update_training branch. In this branch, I updated the requirements and the conda environment, and the render_piece script was renamed to be BasisMixerRender. In that branch, I updated the README to reflect these changes.

To render a piece you need to do the following:

# make sure that the basismixer environment is the latest version, which should use Partitura>=1.4.1
conda activate basismixer
cd path/to/basismixer
python ./bin/BasisMixerRender [OPTIONS] score_file midi_file.mid

Unfortunately, I don't have time right now to fix all issues and merge everything into the main branch (probably not until after the summer or so), but hopefully you can use the update_training branch for the time being.

Hope this helps!

@eoinroe
Copy link
Author

eoinroe commented Apr 19, 2024

Hi @neosatrapahereje, thanks for this!

I have followed your instructions and am not using the update_training branch. However, unfortunately I am running into the following error:

(basismixer) eoinroe@Eoins-MacBook-Pro basismixer % python ./bin/BasisMixerRender score_file /Users/eoinroe/Desktop/soundtrack_2_my_life/musicxml_cleaned.musicxml
Traceback (most recent call last):
File "/Users/eoinroe/PycharmProjects/basismixer/./bin/BasisMixerRender", line 270, in
preds, model, part = predict(
^^^^^^^^
File "/Users/eoinroe/PycharmProjects/basismixer/./bin/BasisMixerRender", line 199, in predict
model, predicted_parameter_names = load_model(
^^^^^^^^^^^
File "/Users/eoinroe/PycharmProjects/basismixer/./bin/BasisMixerRender", line 77, in load_model
model_config = json.load(open(con))
^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/eoinroe/anaconda3/envs/basismixer/lib/python3.12/site-packages/basismixer/assets/sample_models/vienna_4x22_velocity_trend-beat_period_standardized-onsetwise/config.json'

It appears that it is looking for the config file in the anaconda environment for some reason... I am unsure why this has happened since I followed your instructions carefully. Do you have any idea why?

@eoinroe
Copy link
Author

eoinroe commented Apr 19, 2024

I deleted the conda environment because I had created it with the .yml file from the main branch which is slightly different. Then I set up the project from scratch.

For some reason when I run ./bin/BasisMixerRender -h I get the following error:

(basismixer) eoinroe@Eoins-MacBook-Pro basismixer % /Users/eoinroe/PycharmProjects/basismixer/bin/BasisMixerRender -h
Traceback (most recent call last):
File "/Users/eoinroe/PycharmProjects/basismixer/bin/BasisMixerRender", line 29, in
from basismixer import TOY_MODEL_CONFIG
ModuleNotFoundError: No module named 'basismixer'

I was able to successfully generate a performance by editing BasisMixerRender inside of PyCharm and hard coding the paths to the musical file I am using and the desired output for the midi file.

But worth noting it does not seem to work out of the box just following the instructions you have given!

@CarlosCancino-Chacon
Copy link
Member

That sounds like the basismixer package itself is not installed in the new environment. Can you check whether this is the case? You can try the following snippet in a terminal

conda activate basismixer
python -c "import basismixer; print('basismixer is installed')"

If the package is installed, you will simply see 'basismixer is installed'. Otherwise you will get an ImportError. If the package is not installed, you can simply install it with pip

cd path/to/basismixer
pip install .

After deleting the old environment and creating the new one, you need to install the package again inside the basismixer environment (since this is not done directly by conda).

@eoinroe
Copy link
Author

eoinroe commented Apr 21, 2024

When running that command I get the following:

(basismixer) eoinroe@Eoins-MacBook-Pro basismixer % python -c "import basismixer; print('basismixer is installed')"
basismixer is installed

So I guess it is installed...

These are the full list of commands I use to setup the project:

git clone -b update_training https://github.com/CPJKU/basismixer.git
cd basismixer
conda env create -f environment.yml
pip install .
conda activate basismixer

On macOS you need to change the permissions to run the shell script so I do:

chmod +x ./bin/BasisMixerRender

And then to test:

./bin/BasisMixerRender -h

Still getting the following, however:

Traceback (most recent call last):
File "/Users/eoinroe/PycharmProjects/basismixer/./bin/BasisMixerRender", line 29, in
from basismixer import TOY_MODEL_CONFIG
ModuleNotFoundError: No module named 'basismixer'

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