StatBiomed / UniTVelo

UniTVelo, Temporally Unified RNA Velocity for single cell trajectory inference
https://unitvelo.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
25 stars 9 forks source link

'KeyError: 'The optimizer cannot recognize variable log_gamma:0. #20

Closed Mnew1288 closed 1 year ago

Mnew1288 commented 1 year ago

Hi,

Thank you a lot for developing this great tool! I got the following error when I run the Mouse Erythroid dataset under UniTVelo mode. No problem under scVelo stochastic or scVelo dynamic mode.

'KeyError: 'The optimizer cannot recognize variable log_gamma:0. This usually means you are trying to call the optimizer to update different parts of the model separately. Please call optimizer.build(variables) with the full list of trainable variables before the training loop or use legacy optimizer `tf.keras.optimizers.legacy.{self.class.name}.''

Best

michaelgmz commented 1 year ago

Hi there,

Thx for spotting this out and it seems this error is related to a newer version of Tensorflow.

Quote from official website, "This is the default Keras optimizer base class until v2.10 (included). In v2.11 and later, tf.keras.optimizers.Optimizer points to a new base class implementation. The legacy class won't be deleted in the future and will continue to be available at tf.keras.optimizers.legacy.Optimizer."

I've fixed this issue and feel free to update UniTVelo to v0.2.5.

Bests

Mnew1288 commented 1 year ago

Thanks for the quick update!!

It seems to be working now.

Best