XanaduAI / MrMustard

A differentiable bridge between phase space and Fock space
https://mrmustard.readthedocs.io/
Apache License 2.0
78 stars 27 forks source link

TensorFlow dependecy needs to be fixed <2.16.0 #381

Closed xvalcarce closed 5 months ago

xvalcarce commented 7 months ago

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

ziofil commented 7 months ago

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

xvalcarce commented 7 months ago

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

timmysilv commented 5 months ago

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