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

Problem executing callback.py #34

Open
drillkicker opened this issue Apr 20, 2024 · 3 comments
Open

Problem executing callback.py #34

drillkicker opened this issue Apr 20, 2024 · 3 comments

Comments

@drillkicker
Copy link

drillkicker commented Apr 20, 2024

I'm trying to train samplernn in Arch Linux in a venv in my home folder instead of running it inside Google Colab and I get the following error when running train.py:

Traceback (most recent call last):
  File "/home/vasya/work/prism/prism-samplernn/train.py", line 335, in <module>
    main()
  File "/home/vasya/work/prism/prism-samplernn/train.py", line 278, in main
    TrainingStepCallback(
  File "/home/vasya/work/prism/prism-samplernn/callbacks.py", line 17, in __init__
    self.model = model
    ^^^^^^^^^^
AttributeError: property 'model' of 'TrainingStepCallback' object has no setter

I used the default train command in the colab notebook for prism samplernn with a roughly 22 minute mono .wav file that has 48000 samples per second, chunked into 175 8 second chunks. I have tried running both python and python3.

@relativeflux
Copy link
Member

Hi @drillkicker,

I am the original author of the code, unfortunately I no longer work at PRiSM so I can only offer limited support. I suspect this is due to what looks like a recent change in TensorFlow/Keras - it seems the Callback class no longer has a model attribute, instead it's been renamed to _model. Hence the complaint about there being no setter.

Did the Notebook run OK, or did you just experience this issue on your own machine?

@drillkicker
Copy link
Author

@relativeflux I didn't test the command in the notebook because I'm not familiar with Colab and couldn't figure out how to import a wav file into it. However, I tried running the code after editing the line with the error to say self._model instead of self.model and ran the same command. I get a different error message this time:

Traceback (most recent call last):
  File "/home/vasya/work/prism/prism-samplernn/train.py", line 335, in <module>
    main()
  File "/home/vasya/work/prism/prism-samplernn/train.py", line 285, in main
    ModelCheckpointCallback(
  File "/home/vasya/work/prism/prism-samplernn/callbacks.py", line 79, in __init__
    super(ModelCheckpointCallback, self).__init__(*args, **kwargs)
  File "/home/vasya/work/prism/lib/python3.11/site-packages/keras/src/callbacks/model_checkpoint.py", line 183, in __init__
    raise ValueError(
ValueError: When using `save_weights_only=True` in `ModelCheckpoint`, the filepath provided must end in `.weights.h5` (Keras weights format). Received: filepath=./logdir/default/21.04.2024_14.36.58/model.ckpt-{epoch}

@relativeflux
Copy link
Member

relativeflux commented Apr 21, 2024

@drillkicker Hi - yes, it looks as if the new version of Keras (Keras 3) has a lot of breaking changes for the library. Keras 3 is a complete rewrite. As I said I no longer work as PRiSM, and it doesn't look as if anyone there is maintaining this code now, but I'll get in touch with them and see if I can update it. My apologies. I certainly want to get the library back into a useable condition.

Here is someone highlighting the very error you found, it's definitely due to Keras 3 incompatibility.

If there isn't too much to work on I'll fork the library and update it myself. :)

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