Skip to content
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

Request to Update TensorFlow Import for Compatibility in train.py and test.py Scripts #569

Open
VishalBalajiSivaraman opened this issue Nov 26, 2023 · 2 comments

Comments

@VishalBalajiSivaraman
Copy link

Kindly update the import line in your train.py and test.py scripts to use import tensorflow.compat.v1 as tf to mitigate compatibility errors during code execution in TensorFlow 2.x versions.

@adalca
Copy link
Collaborator

adalca commented Nov 27, 2023

Could you describe what this would do? We haven't worked with tf v1 for a while and I'm not sure what this is trying to fix.

@VishalBalajiSivaraman
Copy link
Author

Hello,

I was working on a study using your GitHub code and encountered an issue with compatibility when running your example Colab notebook with your suggested method. I initially thought the problem was related to model saving, but I managed to resolve that by using a different model-saving approach. However, I continued to encounter unusual errors with your code, which, in my opinion, appeared to be well-structured. After investigating further, I realized that the code was originally implemented using Tensorflow 1.x, which is no longer current. To restore the functionality of the code and fix all errors, including the model saving issue, I found a simple solution: replacing the Tensorflow import commands with import tensorflow.compat.v1 as tf, especially in your train and test TensorFlow scripts. In short, this command allows us to use code originally designed for TensorFlow 1.x while benefiting from the newer TensorFlow versions, which currently is TensorFlow 2.x. I have attached screenshots for your reference.

Thanks

model.save Issue

model_save_issue

Adam Optimizer Issue

adam_opt_issue

Overall Fix

issue_fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants