MrMustard icon indicating copy to clipboard operation
MrMustard copied to clipboard

TensorFlow dependecy needs to be fixed <2.16.0

Open xvalcarce opened this issue 10 months ago • 2 comments

TensorFlow >=2.16.0 has been released a month ago. Installing MrMustard with pip install mrmustard will install TensorFlow 2.16.1 by default. This is problematic as new releases of TensorFlow dropped support for Keras 2.0 -- see the release note. Therefore, the following call

https://github.com/XanaduAI/MrMustard/blob/d31b70f5d68d36d471858c7cffe2382b5d200f55/mrmustard/math/backend_tensorflow.py#L403

will trigger an error. For a MWE, the error can easily be triggered with the optimization given in the README

https://github.com/XanaduAI/MrMustard/blob/d31b70f5d68d36d471858c7cffe2382b5d200f55/README.md?plain=1#L252-L285

As a temporary fix, I suggest to replace ^2.15.0 with ~2.15.0 in the following https://github.com/XanaduAI/MrMustard/blob/d31b70f5d68d36d471858c7cffe2382b5d200f55/pyproject.toml#L52-L59

xvalcarce avatar Apr 08 '24 15:04 xvalcarce

Thank you, nice find! Would you like to open a PR and add your name to the contributors for the next release?

ziofil avatar Apr 08 '24 19:04 ziofil

Hey @ziofil , thanks for the opportunity, I opened a PR with the quick-fix as you suggested!

xvalcarce avatar Apr 10 '24 08:04 xvalcarce

Hi @xvalcarce! Thanks for putting this all together, super detailed and made things easy. We didn't want to force a lower TensorFlow version upon our users, so I just merged a PR to add support for TensorFlow 2.16 - you can check out the details in the PR above, but the tl;dr is MrMustard now uses the non-legacy version of the Adam optimizer when you have TF 2.16+ installed. Lmk if you have any questions/concerns about things

timmysilv avatar Jun 03 '24 15:06 timmysilv