Skip to content

Error in Roundtrip Tutorial: "Checkpoint was expecting d_optimizer to be a trackable object” #18

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

Open
rnayebi21 opened this issue Feb 24, 2025 · 9 comments

Comments

@rnayebi21
Copy link

Description:

I encountered an error while running the Roundtrip tutorial from the repository (cloned directly from GitHub). The error suggests that d_optimizer is not trackable when used in a TensorFlow Checkpoint. It seems to be related to Keras optimizers.

Steps to reproduce:

Running the file Roundtrip/src/tutorial.ipynb

Specifically the cell that produces the error is the third one at line:

model = pyrt.Roundtrip(params=params,random_seed=123)

Error:

ValueError: Checkpointwas expecting d_optimizer to be a trackable object (an object derived fromTrackable), got <keras.src.optimizers.adam.Adam object at 0x7f8abedf72c0>. If you believe this object should be trackable (i.e. it is part of the TensorFlow Python API and manages state), please open an issue.

Any guidance on this issue would be greatly appreciated!

@kimmo1019
Copy link
Owner

Hi, could you let me know your python and tensorflow versions? So that I could further look into this issue. Thanks!

@rnayebi21
Copy link
Author

Hi yes, I am using python 3.7.16 and tensorflow 2.8.0.

However after adjusting the package versions to align with those specified in requirements.txt, it switched back to tensorflow 1.13.1, and still resulted in the same error.

@kimmo1019
Copy link
Owner

  1. Are you able to sucessfully install the Pypi for pyroundtrip?
  2. Did you try to directly run python3 main.py -c configs/config_[DATASET].yaml ? THen you should know which line produce the error.

Since g_e_optimizer and d_optimizer are instantiated with the same code, it is strange why d_optimizer caused the error

@kimmo1019
Copy link
Owner

If you run main.py (https://github.com/kimmo1019/Roundtrip/blob/master/src/main.py) please try datasets such as “indep_gmm”, “eight_octagon_gmm” or “involute”. Are you able to run on these non-image datasets?

@rnayebi21
Copy link
Author

rnayebi21 commented Mar 17, 2025

Yes, regarding the first two questions, which we discussed in email:

  1. Yes I am able to install the Pypi for pyroundrip through pip install
  2. I hadn't tried running the main file, since I was just trying to get the tutorial running first.

Previously I was running into errors with trying #2, but using the non-image datasets, specifically "involute" (and "indep_gmm" which is currently running in the background), works well! I didn't see the "eight_octagon_gmm" .yaml file.

@kimmo1019
Copy link
Owner

Yes, regarding the first two questions, which we discussed in email:

  1. Yes I am able to install the Pypi for pyroundrip through pip install
  2. I hadn't tried running the main file, since I was just trying to get the tutorial running first.

Previously I was running into errors with trying #2, but using the non-image datasets, specifically "involute" (and "indep_gmm" which is currently running in the background), works well! I didn't see the "eight_octagon_gmm" .yaml file.

Great! since main.py can be run well using "involute" dataset, you can find that the 15 line is exactly model = Roundtrip(params, random_seed=123). The same as shown in the tutorial. There is no reason for the tutorial to raise an error if the main.py can be directly run.

@kimmo1019
Copy link
Owner

Considering your demand on adapting Roundtrip to single cell applications, it might be more flexible to directly use main.py. What do you think? Please let me know if you have further questions.

@rnayebi21
Copy link
Author

Okay, sounds good. Thank you so much for your help! Just to clarify, the main.py file runs different code depending on the input dataset, but ultimately, they all serve the same purpose: computing the necessary inputs for model.train. The variation is due to differences in the input data, right?

@kimmo1019
Copy link
Owner

Okay, sounds good. Thank you so much for your help! Just to clarify, the main.py file runs different code depending on the input dataset, but ultimately, they all serve the same purpose: computing the necessary inputs for model.train. The variation is due to differences in the input data, right?

Yes, the main different is the input. If the input is image, which is 2D, then the architecture may need change from FFN to Conv2D. As long as you input is a vector (1D) for each sample, then it is fine. Once you run model = Roundtrip(params, random_seed=123) without error, you can just follow the tutorial for the rest. Feel free to let me know if you have further questions.

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