cpmpercussion / impsy

IMPSy - the Interactive Musical Prediction SYstem
MIT License
24 stars 6 forks source link

Error with TensorFlow Call #5

Closed Redarmy345 closed 7 months ago

Redarmy345 commented 4 years ago

I've tried running the predictive_music_model.py recently and got the error below. It was working at the NIME workshop in June, but suddenly kicked this up. I cloned the latest version and reinstalled all the requirements in a virtual environment.

Edit: I'm on Windows 10

`C:...\imps-master>python predictive_music_model.py --dimension=3 --log

Importing Keras and MDRNN. Using TensorFlow backend. Traceback (most recent call last): File "predictive_music_model.py", line 39, in import empi_mdrnn File "C:...\imps-master\empi_mdrnn__init__.py", line 16, in tf.logging.set_verbosity(tf.logging.INFO) # set logging. AttributeError: module 'tensorflow' has no attribute 'logging'`

cpmpercussion commented 4 years ago

Ok! That's bad! I think I remember having this but can't remember why. Could you check what your version of TensorFlow is?

Actually, I think I'm going to bump the version of TF to 1.15.0 (last of the V1s...) and remove the Keras requirement (because Keras is now completely within Tensorflow). I'll draft a release now of the current state, so that the NEXT release has the updated TF plan.

This seems like a distraction, but my experience has been that errors like the above are usually an issue with TensorFlow/Keras/Python versions---frustrating, but true. :-(

Redarmy345 commented 4 years ago

Hey Charles

It looks like I had 2.0 installed. I downgraded to 1.14.0 and that gave more errors because it wasn't compatible with tensorflow probability. So I upgraded to 1.15.0 and it worked! Sort of...

I was able to collect data, generate the dataset and train. However, on the last epoch of training, it spat out this:

Epoch 00100: val_loss improved from 14.47440 to 14.39295, saving model to models/musicMDRNN-dim3-layers2-units32-mixtures5-scale10-E100-VL14.39.hdf5 Traceback (most recent call last): File "train_predictive_music_model.py", line 159, in model.save_weights(model_dir + model_name + ".h5") File "C:\Users\lloyd\Documents\Projects\NN_Pedal\imps-master\lib\site-packages\keras\engine\saving.py", line 449, in save_wrapper save_function(obj, filepath, overwrite, *args, **kwargs) File "C:\Users\lloyd\Documents\Projects\NN_Pedal\imps-master\lib\site-packages\keras\engine\network.py", line 1184, in save_weights saving.save_weights_to_hdf5_group(f, self.layers) File "C:\Users\lloyd\Documents\Projects\NN_Pedal\imps-master\lib\site-packages\keras\engine\saving.py", line 761, in save_weights_to_hdf5_group dtype=val.dtype) File "C:\Users\lloyd\Documents\Projects\NN_Pedal\imps-master\lib\site-packages\h5py_hl\group.py", line 139, in create_dataset self[name] = dset File "C:\Users\lloyd\Documents\Projects\NN_Pedal\imps-master\lib\site-packages\h5py_hl\group.py", line 373, in setitem h5o.link(obj.id, self.id, name, lcpl=lcpl, lapl=self._lapl) File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py\h5o.pyx", line 202, in h5py.h5o.link OSError: Unable to create link (name already exists)

cpmpercussion commented 4 years ago

Ok, I'm not sure what the situation is with tensorflow 1.15, things have become a bit complicated with tf2.0 coming out, and I've still been using 1.14. I have a working setup on my machine with these versions:

Keras 2.2.5
tensorflow 1.14.0 tensorflow-probability 0.7.0
keras-mdn-layer 0.2.2

which you could install with this:

python3 -m pip install tensorflow==1.14.0 tensorflow-probability==0.7.0 keras==2.2.5 keras-mdn-layer==0.2.2

I'm trying to get 1.15 working this weekend :-)

Redarmy345 commented 4 years ago

Thanks so much Charles! I installed the versions of the libraries that you mentioned and it ran with no errors, a few warnings about TensorFlow not being compatible with GPUs but that's alright.

I am running into a problem getting the predictions into Max though. I'm listening with a "udpreceive 5001" object and am getting nothing. I then manually specified a port in the call: python predictive_music_model.py --dimension=3 --modelsize=xs --log -cv --clientport=808 and am listening with "udpreceive 808" but still got nothing. It did seem that it was sending and receiving: .... User->RNN prediction: [-2.09107488e-04 8.43054844e+01 7.80294328e+01]
User->RNN prediction: [6.00040677e-03 8.49015706e+01 7.78994170e+01]
User: 1572812208.7867973 1.9221211945340876e-37,31.371971130371094
User: 1572812208.8046985 1.9221211945340876e-37,31.371971130371094

etc.

Any thoughts?

cpmpercussion commented 4 years ago

Hey Lloyd, it seems that the issue was messages going from IMPS-->Max, but that the other way was ok. I think I've found that this is an issue with latest python-osc, could you try:

python3 -m pip install python-osc==1.7.0

I was able to reproduce this on my system with Pd. If you send me your max patch I can try it in max as well.

Moving to pinned packages in the requirements.txt file...

Redarmy345 commented 4 years ago

Hi Charles

I installed python-osc 1.7.0 but still couldn't get IMPS to send things to Max. I've included my patch, please let me know if you manage to get it working or if there is something else I should do.

Have a great day!

Cheers, Lloyd

On Sun, Nov 3, 2019 at 9:45 PM Charles Martin notifications@github.com wrote:

Hey Lloyd, it seems that the issue was messages going from IMPS-->Max, but that the other way was ok. I think I've found that this is an issue with latest python-osc, could you try:

python3 -m pip install python-osc==1.7.0

I was able to reproduce this on my system with Pd. If you send me your max patch I can try it in max as well.

Moving to pinned packages in the requirements.txt file...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cpmpercussion/imps/issues/5?email_source=notifications&email_token=AMG5T4F44LHPC3KOYB4FR5DQR6EFJA5CNFSM4JHMSH7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC6ENYI#issuecomment-549209825, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMG5T4CLHDFNKUQH763ZVLTQR6EFJANCNFSM4JHMSH7A .

{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 8, "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", "rect" : [ 1954.0, 77.0, 1852.0, 929.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 1, "objectsnaponopen" : 1, "statusbarvisible" : 2, "toolbarvisible" : 1, "lefttoolbarpinned" : 0, "toptoolbarpinned" : 0, "righttoolbarpinned" : 0, "bottomtoolbarpinned" : 0, "toolbars_unpinned_last_save" : 0, "tallnewobj" : 0, "boxanimatetime" : 200, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "description" : "", "digest" : "", "tags" : "", "style" : "", "subpatcher_template" : "", "boxes" : [ { "box" : { "id" : "obj-8", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 883.64493453502655, 106.540000000000006, 150.0, 33.0 ], "presentation_linecount" : 2, "text" : "Recieve pitch and amplitude info from imps" }

        }

, { "box" : { "id" : "obj-7", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 393.0, 274.185702714920126, 150.0, 33.0 ], "text" : "Pitch and Amplitude from guitar, send to imps" }

        }

, { "box" : { "fontname" : "Arial", "fontsize" : 11.600006, "id" : "obj-2", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 3, "outlettype" : [ "float", "float", "" ], "patching_rect" : [ 129.909999999999997, 177.927277000000004, 166.0, 21.0 ], "text" : "sigmund~ @hop 512 pitch env" }

        }

, { "box" : { "id" : "obj-6", "maxclass" : "gain~", "multichannelvariant" : 0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "signal", "" ], "parameter_enable" : 0, "patching_rect" : [ 769.666666666666515, 575.326376137733405, 22.0, 140.0 ] }

        }

, { "box" : { "id" : "obj-5", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 1017.0, 180.54000000000002, 162.0, 22.0 ] }

        }

, { "box" : { "id" : "obj-3", "maxclass" : "gain~", "multichannelvariant" : 0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "signal", "" ], "parameter_enable" : 0, "patching_rect" : [ 654.909611503283031, 572.185702714920126, 22.0, 140.0 ] }

        }

, { "box" : { "id" : "obj-45", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "signal" ], "patching_rect" : [ 129.909999999999997, 344.355132699012756, 43.0, 22.0 ], "text" : "cycle~" }

        }

, { "box" : { "id" : "obj-46", "maxclass" : "gain~", "multichannelvariant" : 0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "signal", "" ], "parameter_enable" : 0, "patching_rect" : [ 217.409999999999968, 274.185702714920126, 22.0, 140.0 ] }

        }

, { "box" : { "format" : 6, "id" : "obj-43", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 203.409999999999997, 227.224297285079956, 50.0, 22.0 ] }

        }

, { "box" : { "id" : "obj-42", "linecount" : 2, "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 430.909611503283031, 317.0, 91.121497631072998, 35.0 ], "text" : "/interface 0. 33.256071" }

        }

, { "box" : { "format" : 6, "id" : "obj-40", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 129.909999999999997, 306.943928480148315, 50.0, 22.0 ] }

        }

, { "box" : { "format" : 6, "id" : "obj-39", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 129.909999999999997, 221.224297285079956, 50.0, 22.0 ] }

        }

, { "box" : { "id" : "obj-33", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 129.909999999999997, 258.177569150924683, 32.0, 22.0 ], "text" : "mtof" }

        }

, { "box" : { "id" : "obj-31", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 997.64493453502655, 258.177569150924683, 50.0, 22.0 ] }

        }

, { "box" : { "id" : "obj-29", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 634.579497218132019, 210.33442310333254, 50.0, 22.0 ] }

        }

, { "box" : { "id" : "obj-27", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "signal" ], "patching_rect" : [ 764.666666666666515, 220.726912536621114, 43.0, 22.0 ], "text" : "cycle~" }

        }

, { "box" : { "id" : "obj-25", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "float" ], "patching_rect" : [ 764.666666666666515, 180.54000000000002, 61.0, 22.0 ], "text" : "unpack f f" }

        }

, { "box" : { "id" : "obj-21", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 851.33022634188319, 180.54000000000002, 156.0, 22.0 ] }

        }

, { "box" : { "id" : "obj-22", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], "patching_rect" : [ 764.666666666666515, 148.54000000000002, 95.0, 22.0 ], "text" : "route /prediction" }

        }

, { "box" : { "id" : "obj-23", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 760.0, 106.540000000000006, 97.0, 22.0 ], "text" : "udpreceive 5000" }

        }

, { "box" : { "fontface" : 0, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-74", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 278.0, 288.420564413070679, 105.0, 22.0 ], "text" : "prepend /interface" }

        }

, { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-58", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 278.0, 258.177569150924683, 55.0, 22.0 ], "text" : "pak 1. 1." }

        }

, { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-53", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 278.0, 317.0, 138.0, 22.0 ], "text" : "udpsend 127.0.0.1 5001" }

        }

, { "box" : { "id" : "obj-19", "maxclass" : "gain~", "multichannelvariant" : 0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "signal", "" ], "parameter_enable" : 0, "patching_rect" : [ 878.395641247431286, 361.716359329223735, 22.0, 140.0 ] }

        }

, { "box" : { "id" : "obj-17", "maxclass" : "ezadc~", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "signal", "signal" ], "patching_rect" : [ 129.909999999999997, 106.540000000000006, 45.0, 45.0 ] }

        }

, { "box" : { "id" : "obj-12", "maxclass" : "ezdac~", "numinlets" : 2, "numoutlets" : 0, "patching_rect" : [ 698.761721253395081, 670.326376137733405, 45.0, 45.0 ] }

        }

], "lines" : [ { "patchline" : { "destination" : [ "obj-2", 0 ], "source" : [ "obj-17", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-6", 0 ], "midpoints" : [ 887.895641247431286, 522.176359329223715, 888.895641247431286, 522.176359329223715, 888.895641247431286, 576.176359329223715, 779.166666666666515, 576.176359329223715 ], "source" : [ "obj-19", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-39", 0 ], "source" : [ "obj-2", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-43", 0 ], "source" : [ "obj-2", 1 ] }

        }

, { "patchline" : { "destination" : [ "obj-21", 1 ], "midpoints" : [ 774.166666666666515, 173.441869237422964, 997.83022634188319, 173.441869237422964 ], "order" : 0, "source" : [ "obj-22", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-25", 0 ], "order" : 1, "source" : [ "obj-22", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-5", 1 ], "midpoints" : [ 850.166666666666515, 172.152148642539998, 1169.5, 172.152148642539998 ], "source" : [ "obj-22", 1 ] }

        }

, { "patchline" : { "destination" : [ "obj-22", 0 ], "source" : [ "obj-23", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-19", 0 ], "midpoints" : [ 816.166666666666515, 301.628179664611878, 887.895641247431286, 301.628179664611878 ], "order" : 1, "source" : [ "obj-25", 1 ] }

        }

, { "patchline" : { "destination" : [ "obj-27", 0 ], "order" : 0, "source" : [ "obj-25", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-29", 1 ], "order" : 1, "source" : [ "obj-25", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-31", 1 ], "order" : 0, "source" : [ "obj-25", 1 ] }

        }

, { "patchline" : { "destination" : [ "obj-19", 0 ], "midpoints" : [ 774.166666666666515, 301.721635932922425, 887.895641247431286, 301.721635932922425 ], "source" : [ "obj-27", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-12", 1 ], "order" : 0, "source" : [ "obj-3", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-12", 0 ], "order" : 1, "source" : [ "obj-3", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-40", 0 ], "order" : 2, "source" : [ "obj-33", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-45", 0 ], "order" : 1, "source" : [ "obj-33", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-58", 0 ], "midpoints" : [ 139.409999999999997, 290.177569150924683, 213.454999999999984, 290.177569150924683, 213.454999999999984, 251.177569150924683, 287.5, 251.177569150924683 ], "order" : 0, "source" : [ "obj-33", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-33", 0 ], "source" : [ "obj-39", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-46", 0 ], "order" : 1, "source" : [ "obj-43", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-58", 1 ], "midpoints" : [ 212.909999999999997, 253.200933218002319, 323.5, 253.200933218002319 ], "order" : 0, "source" : [ "obj-43", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-46", 0 ], "midpoints" : [ 139.409999999999997, 376.355132699012756, 211.159999999999968, 376.355132699012756, 211.159999999999968, 263.185702714920126, 226.909999999999968, 263.185702714920126 ], "source" : [ "obj-45", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-3", 0 ], "midpoints" : [ 226.909999999999968, 492.685702714920126, 664.409611503283031, 492.685702714920126 ], "source" : [ "obj-46", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-74", 0 ], "midpoints" : [ 287.5, 282.420564413070679, 287.5, 282.420564413070679 ], "source" : [ "obj-58", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-12", 1 ], "order" : 0, "source" : [ "obj-6", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-12", 0 ], "order" : 1, "source" : [ "obj-6", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-42", 1 ], "midpoints" : [ 287.5, 313.210282206535339, 512.531109134356029, 313.210282206535339 ], "order" : 0, "source" : [ "obj-74", 0 ] }

        }

, { "patchline" : { "destination" : [ "obj-53", 0 ], "order" : 1, "source" : [ "obj-74", 0 ] }

        }

], "dependency_cache" : [ { "name" : "sigmund~.mxe64", "type" : "mx64" } ], "autosave" : 0 }

}

Redarmy345 commented 4 years ago

Hi Charles

Hope you're doing well!

Just wanted to make sure this didn't drop through the cyber cracks. Absolutely no rush though!

Cheers, Lloyd

On Mon, Nov 4, 2019 at 11:02 AM Lloyd May lloydmaydart@gmail.com wrote:

Hi Charles

I installed python-osc 1.7.0 but still couldn't get IMPS to send things to Max. I've included my patch, please let me know if you manage to get it working or if there is something else I should do.

Have a great day!

Cheers, Lloyd

On Sun, Nov 3, 2019 at 9:45 PM Charles Martin notifications@github.com wrote:

Hey Lloyd, it seems that the issue was messages going from IMPS-->Max, but that the other way was ok. I think I've found that this is an issue with latest python-osc, could you try:

python3 -m pip install python-osc==1.7.0

I was able to reproduce this on my system with Pd. If you send me your max patch I can try it in max as well.

Moving to pinned packages in the requirements.txt file...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cpmpercussion/imps/issues/5?email_source=notifications&email_token=AMG5T4F44LHPC3KOYB4FR5DQR6EFJA5CNFSM4JHMSH7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC6ENYI#issuecomment-549209825, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMG5T4CLHDFNKUQH763ZVLTQR6EFJANCNFSM4JHMSH7A .

cpmpercussion commented 4 years ago

Hey, It seems to work on my machine (not much comfort, I know!) with the following IMPS call:

python3 predictive_music_model.py -d=3 --modelsize=s --log -c

Messages go from Max to IMPS and back. I'm on MacOS 10.14.6 with Max 7.3.6

One thing to remember is that messages to IMPS should have values strictly between 0-1, I wasn't sure what values you were intended to send and get back.

Did you get any further?