-
Notifications
You must be signed in to change notification settings - Fork 370
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
CNN model cannot be loaded with latest keras
and tensorflow
#1332
Comments
Interesting; conda-forge has had packages of 3.x available for 3 months: https://anaconda.org/conda-forge/keras/files but I don't have any environments with them. It looks like conda packages of tensorflow pin keras down very precisely: https://github.com/conda-forge/tensorflow-feedstock/blob/main/recipe/meta.yaml#L153C7-L153C12 How did you end up running into this? Is this a pure-pip install? |
Just chiming in that I also ran into this on my latest Windows dev install, for which I installed all requirements except tensorflow using conda and then switched to pip. This seemed like the most hassle-free way given that tensorflow 2 for Windows isn't on conda-forge. I think the recommended method on other issues has been to install tf from the defaults channel instead on Windows, but I know mixing conda-forge and defaults is also strongly discouraged and I had some difficulty when I tried this method previously. Will try downgrading keras and cross my fingers! |
Hello, |
Yeah, pip's failure to take the compatibility of previously-installed packages into account (in this case keras) is frustrating. Anyway, my attempt to fix this failed because the environment had Python 3.12 and there isn't an old enough version of tensorflow available (2.16+ is not compatible with keras version 2, apparently). Will try to stick to your recommendation in the future. Edit: I confirmed that keras 3.1 does not work; I assume we need 2.x. |
For future reference (or maybe updating documentation?) here are the steps that currently works for me to install tensorflow without pip on Windows:
Also maybe worth noting, installing in WSL2 is also possible and simpler, but I found it to be intolerably slower (not sure why exactly but could be because I am loading/saving data from/to a NAS). |
I would expect usually the I made a branch with these changes: I'm hoping it will work correctly right out of the box, removing at least the need for the separate tensorflow install step and the need to edit the environment.yml |
Ah OK. I have been using Miniforge (which excludes the defaults channel and strongly discourages using it), and I thought that's what you recommended too, but now I see that the install page actually links to Miniconda. I would probably have had an easier time if I started from a Miniconda or Anaconda install. |
No worries; it'd be good for people to be able to install caiman more easily with Miniforge too; I think this change will hopefully make that so. Let me know if you get a chance to try it (with miniforge). One of the reasons I don't want to be limited to miniconda is that people install conda for a variety of software, and if someone has 4 environments they use for other software and they want to add a caiman environment, it'd be a bit antisocial for me to ever tell someone to remove their conda install and get a different one; it'd mess up all those other environments. Obviously that's less of a problem if caiman is the only reason they're using conda, but we can't depend on that being the case. |
My bad; apparently channel_priority is not settable in environment.yml; the example snippet I found for it was actually for conda configs. There are proposals to add it but they haven't happened yet. |
If conda/conda#8675 ever gets implemented, we'll have a way, but at least for now the best we can do is just add defaults and hope that strict channel priority doesn't mess us up too much (we can add instructions to disable it). This is just for people building caiman anyhow, which is the minority of our users. |
Component evaluation fails with latest tensorflow & keras since it cannot load the CNN model file,
cnn_model.json
. This is with keras v3.2.1 which was released 3 days ago and tensorflow v2.16.1 released on March 7.This does not occur with keras v2.12.0 and tensorflow v2.12.0 (I'm not sure what's the last version in which the models can be loaded). Rolling back to these versions also allows the model file to be loaded.
Here is the traceback in-place when you try to use evaluate_components in caiman:
I think that the reason is because the latest keras/tensorflow can no longer load the model file. If I do:
I get:
The text was updated successfully, but these errors were encountered: