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

Tf1.15/deep galaxy model #16

Draft
wants to merge 20 commits into
base: gaussiansinf
Choose a base branch
from
Draft

Conversation

b-remy
Copy link
Owner

@b-remy b-remy commented Jun 27, 2022

It turns out we can use edward2 within Tensorflow Probability (0.7.0) compatible with TensorFlow 1.15. So I was able to run the latests scripts after a few updates of the code :-)

Thanks to this, I think that there is no need to change the PPL to tfp.JointDistributionCoroutine since I am used to edward2 and everything seems compatible.

I can now shift to the deep morphological model using the same framework as before.

This is still a draft pull request, I don't really know how to merge this since there is still a lot of TF2 code in the repo... Here is the code already converted to TF 1.15 (and tfp==0.7.0), compared to the latest version of the code (https://github.com/b-remy/gems/tree/gaussiansinf , ab506ca)

Also note that it requires to install GalFlow from https://github.com/b-remy/GalFlow/tree/tf1

@b-remy b-remy changed the base branch from main to gaussiansinf June 27, 2022 10:46
@b-remy
Copy link
Owner Author

b-remy commented Jun 27, 2022

For the illustration, here are some plots using the tf-1.15 version of the code:
image
image

For longer chains, see #11 (comment)

@b-remy
Copy link
Owner Author

b-remy commented Jun 27, 2022

A simple first task to test the deep_galaxy_model is to fit the latent variables to a set of observations. This is the aim of MAP_dgm.py using edward2.

Generating observations with the COSMOS-25.2 catalog and a gaussian noise level of 0.01 we get the following fit and residuals (displayed using np.arcsinh(img/s)*s, s=1e-3):

  • Reconstruction from MAP

image

  • Residuals (observations-reconstruction_MAP)

image

Note that I don't fit the centroid here.

It looks like there is a very few residuals when optimizing on the latent variable :-)

However, I was not able to use tf.function with the way I imported the hub Module, because of the following error:

RuntimeError: Module must be applied in the graph it was instantiated for.

Maybe you know the right way to import the models within TensorFlow graphs @EiffL ?

@b-remy b-remy mentioned this pull request Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using deep_galaxy_models in our framework
1 participant