brain-score / model-tools

Helper functions to extract model activations and translate from Machine Learning to Neuroscience
MIT License
8 stars 27 forks source link

cannot use python 3.9 with tensorflow==1.15 #47

Open mschrimpf opened 3 years ago

mschrimpf commented 3 years ago

We're currently still on TensorFlow 1: https://github.com/brain-score/model-tools/blob/291970092ce439569b9e063324254c1d8c4702d3/setup.py#L18 Python 3.9 so far does not seem to work with 1.15, we should upgrade to TensorFlow 2 to avoid specifying versions directly

raj-magesh commented 2 years ago

Is there a timeline for this upgrade? I need some TensorFlow 2 functionality that I can't easily access in the same environment because model-tools forces TensorFlow 1.15.

mschrimpf commented 2 years ago

So far, we did not have this planned until mid 2022, but if there's a necessity we will prioritize it sooner.

Can you please describe your use case? Is there a way to get away with tf1 and e.g. re-defining the functionality you're using?

martinosorb commented 2 years ago

For what is tensorflow used in the library? I had the same problem and I simply told pip to ignore the tensorflow dependency while installing model-tools. The tests seem to work. Of course it may be needed for other things which I'm not currently using...

mschrimpf commented 2 years ago

It's actually only used in the OST metric which isn't included in the competition (as well as the mask_regression metric which currently isn't used at all for the standard benchmarks). Did you already submit? It might be that the model fails on the Kar2019-ost benchmark but should work on the others.

raj-magesh commented 2 years ago

Sorry for the late reply! I needed a TF2 utility to convert pretrained TF models to PyTorch. I decided to just create a separate environment for that step of my workflow, so this isn't urgent. Closing the issue; thanks for the responses!

YudiXie commented 1 year ago

I got an issue related to this when installing this repo on a MacBook with Apple Silicon. It seems that the issue originated from the fact that this package only uses tensorflow==1.15, which is not compatible with Python 3.8 or higher.

However, the newer Anaconda distribution for the M1 MacOS system only has Python 3.8 and higher, making it hard to run this repo on the laptop. So to install this package, I may have to reinstall Anaconda or switch to another machine that supports Python 3.7.

It would be really great if this repo could support newer versions of TensorFlow and Python.

nikparth commented 1 year ago

to add to this, there are a lot of models these days that only have weights in TF2. Unless there is an easy way to convert these to previous TF versions or pytorch (which I haven't seen a general way to do), this limits the models that can be evaluated.

IanCarrasco commented 1 year ago

Any updates on this dependency? I've been interested in getting this up and running and have gone through various python versions/venvs with no luck. Thank you!

IanCarrasco commented 1 year ago

It appears that this PR updated the two files in question to use TF2 (https://github.com/brain-score/brain-score/pull/196/commits/04b01f52414553c18961d06e2acec93d78f76968), but it may just be an old dependency in model-tools? If those were the last two TF1 references.

Potentially Old Dependency in Question: https://github.com/brain-score/model-tools/blob/master/setup.py#L18C5-L18C24

mschrimpf commented 9 months ago

hi all, as an update to this: we have just released a major refactor which combines model-tools and models into brain-score: https://github.com/brain-score/vision

This should make it a lot easier to fix the tensorflow issues and potentially upgrade python.