From 622dbab9867ed9579384eeccf5f4ca8aa1f39cd4 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 6 Apr 2026 21:06:12 +0100 Subject: [PATCH 1/2] docs: add VRAM timing notes to print_vram_use comments Add "takes about 20-30 seconds" note to all print_vram_use comments that were missing it (3 scripts), matching the pattern already used in imaging/modeling.py and interferometer/modeling.py. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../imaging/features/pixelization/modeling.py | 5 +- .../features/pixelization/modeling.py | 3 + scripts/multi/modeling.py | 5 +- scripts/path/to/model/json/model.json | 168 ++++++++++++++++++ 4 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 scripts/path/to/model/json/model.json diff --git a/scripts/imaging/features/pixelization/modeling.py b/scripts/imaging/features/pixelization/modeling.py index 6edbbce7..94159f60 100644 --- a/scripts/imaging/features/pixelization/modeling.py +++ b/scripts/imaging/features/pixelization/modeling.py @@ -288,8 +288,11 @@ This is why the `batch_size` above is 20, lower than other examples, because reducing the batch size ensures a more modest amount of VRAM is used. If you have a GPU with more VRAM, increasing the batch size will lead to faster run times. -Given VRAM use is an important consideration, we print out the estimated VRAM required for this +Given VRAM use is an important consideration, we print out the estimated VRAM required for this model-fit and advise you do this for your own pixelization model-fits. + +The method below prints the VRAM usage estimate for the analysis and model with the specified batch size, +it takes about 20-30 seconds to run so you may want to comment it out once you are familiar with your GPU's VRAM limits. """ analysis.print_vram_use(model=model, batch_size=search.batch_size) diff --git a/scripts/interferometer/features/pixelization/modeling.py b/scripts/interferometer/features/pixelization/modeling.py index 1f45e177..1a426d94 100644 --- a/scripts/interferometer/features/pixelization/modeling.py +++ b/scripts/interferometer/features/pixelization/modeling.py @@ -337,6 +337,9 @@ VRAM does scale with batch size though, and for high resoluiton datasets may require you to reduce from the value of 20 set above if your GPU does not have too much VRAM (e.g. < 4GB). + +The method below prints the VRAM usage estimate for the analysis and model with the specified batch size, +it takes about 20-30 seconds to run so you may want to comment it out once you are familiar with your GPU's VRAM limits. """ analysis.print_vram_use(model=model, batch_size=search.batch_size) diff --git a/scripts/multi/modeling.py b/scripts/multi/modeling.py index b2f8b9b1..657dc356 100644 --- a/scripts/multi/modeling.py +++ b/scripts/multi/modeling.py @@ -272,8 +272,11 @@ When multiple datasets are fitted simultaneously, as in this example, VRAM usage increases with each dataset, as their data structures must all be stored in VRAM. -Given VRAM use is an important consideration, we print out the estimated VRAM required for this +Given VRAM use is an important consideration, we print out the estimated VRAM required for this model-fit and advise you do this for your own pixelization model-fits. + +The method below prints the VRAM usage estimate for the analysis and model with the specified batch size, +it takes about 20-30 seconds to run so you may want to comment it out once you are familiar with your GPU's VRAM limits. """ factor_graph.print_vram_use( model=factor_graph.global_prior_model, batch_size=search.batch_size diff --git a/scripts/path/to/model/json/model.json b/scripts/path/to/model/json/model.json new file mode 100644 index 00000000..39e901e3 --- /dev/null +++ b/scripts/path/to/model/json/model.json @@ -0,0 +1,168 @@ +{ + "type": "collection", + "assertions": [ + { + "type": "compound", + "compound_type": "GreaterThanLessThanAssertion", + "left": { + "type": "Uniform", + "id": 71, + "lower_limit": 0.0, + "upper_limit": 30.0 + }, + "right": { + "type": "compound", + "compound_type": "SumPrior", + "left": { + "type": "Uniform", + "id": 71, + "lower_limit": 0.0, + "upper_limit": 30.0 + }, + "right": 0.1 + } + }, + { + "type": "compound", + "compound_type": "GreaterThanLessThanAssertion", + "left": { + "type": "compound", + "compound_type": "SumPrior", + "left": { + "type": "Uniform", + "id": 71, + "lower_limit": 0.0, + "upper_limit": 30.0 + }, + "right": 0.1 + }, + "right": 3.0 + } + ], + "arguments": { + "galaxies": { + "type": "collection", + "arguments": { + "galaxy": { + "class_path": "autogalaxy.galaxy.galaxy.Galaxy", + "type": "model", + "arguments": { + "redshift": { + "type": "Constant", + "value": 0.5 + }, + "bulge": { + "class_path": "autogalaxy.profiles.light.linear.sersic.Sersic", + "type": "model", + "arguments": { + "centre": { + "type": "tuple_prior", + "arguments": { + "centre_0": { + "type": "Gaussian", + "id": 67, + "mean": 0.0, + "sigma": 0.3 + }, + "centre_1": { + "type": "Gaussian", + "id": 68, + "mean": 0.0, + "sigma": 0.3 + } + } + }, + "ell_comps": { + "type": "tuple_prior", + "arguments": { + "ell_comps_0": { + "type": "TruncatedGaussian", + "id": 63, + "mean": 0.0, + "sigma": 0.3, + "lower_limit": -1.0, + "upper_limit": 1.0 + }, + "ell_comps_1": { + "type": "TruncatedGaussian", + "id": 64, + "mean": 0.0, + "sigma": 0.3, + "lower_limit": -1.0, + "upper_limit": 1.0 + } + } + }, + "effective_radius": { + "type": "compound", + "compound_type": "SumPrior", + "left": { + "type": "Uniform", + "id": 71, + "lower_limit": 0.0, + "upper_limit": 30.0 + }, + "right": 0.1 + }, + "sersic_index": { + "type": "Constant", + "value": 4.0 + } + } + }, + "disk": { + "class_path": "autogalaxy.profiles.light.linear.exponential.Exponential", + "type": "model", + "arguments": { + "centre": { + "type": "tuple_prior", + "arguments": { + "centre_0": { + "type": "Gaussian", + "id": 67, + "mean": 0.0, + "sigma": 0.3 + }, + "centre_1": { + "type": "Gaussian", + "id": 68, + "mean": 0.0, + "sigma": 0.3 + } + } + }, + "ell_comps": { + "type": "tuple_prior", + "arguments": { + "ell_comps_0": { + "type": "TruncatedGaussian", + "id": 69, + "mean": 0.0, + "sigma": 0.3, + "lower_limit": -1.0, + "upper_limit": 1.0 + }, + "ell_comps_1": { + "type": "TruncatedGaussian", + "id": 70, + "mean": 0.0, + "sigma": 0.3, + "lower_limit": -1.0, + "upper_limit": 1.0 + } + } + }, + "effective_radius": { + "type": "Uniform", + "id": 71, + "lower_limit": 0.0, + "upper_limit": 30.0 + } + } + } + } + } + } + } + } +} \ No newline at end of file From 86eea7b0110d58b2a7bc9025f22e31216aaecfe4 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 6 Apr 2026 21:06:34 +0100 Subject: [PATCH 2/2] fix: remove stray test artifact scripts/path/ Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/path/to/model/json/model.json | 168 -------------------------- 1 file changed, 168 deletions(-) delete mode 100644 scripts/path/to/model/json/model.json diff --git a/scripts/path/to/model/json/model.json b/scripts/path/to/model/json/model.json deleted file mode 100644 index 39e901e3..00000000 --- a/scripts/path/to/model/json/model.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "type": "collection", - "assertions": [ - { - "type": "compound", - "compound_type": "GreaterThanLessThanAssertion", - "left": { - "type": "Uniform", - "id": 71, - "lower_limit": 0.0, - "upper_limit": 30.0 - }, - "right": { - "type": "compound", - "compound_type": "SumPrior", - "left": { - "type": "Uniform", - "id": 71, - "lower_limit": 0.0, - "upper_limit": 30.0 - }, - "right": 0.1 - } - }, - { - "type": "compound", - "compound_type": "GreaterThanLessThanAssertion", - "left": { - "type": "compound", - "compound_type": "SumPrior", - "left": { - "type": "Uniform", - "id": 71, - "lower_limit": 0.0, - "upper_limit": 30.0 - }, - "right": 0.1 - }, - "right": 3.0 - } - ], - "arguments": { - "galaxies": { - "type": "collection", - "arguments": { - "galaxy": { - "class_path": "autogalaxy.galaxy.galaxy.Galaxy", - "type": "model", - "arguments": { - "redshift": { - "type": "Constant", - "value": 0.5 - }, - "bulge": { - "class_path": "autogalaxy.profiles.light.linear.sersic.Sersic", - "type": "model", - "arguments": { - "centre": { - "type": "tuple_prior", - "arguments": { - "centre_0": { - "type": "Gaussian", - "id": 67, - "mean": 0.0, - "sigma": 0.3 - }, - "centre_1": { - "type": "Gaussian", - "id": 68, - "mean": 0.0, - "sigma": 0.3 - } - } - }, - "ell_comps": { - "type": "tuple_prior", - "arguments": { - "ell_comps_0": { - "type": "TruncatedGaussian", - "id": 63, - "mean": 0.0, - "sigma": 0.3, - "lower_limit": -1.0, - "upper_limit": 1.0 - }, - "ell_comps_1": { - "type": "TruncatedGaussian", - "id": 64, - "mean": 0.0, - "sigma": 0.3, - "lower_limit": -1.0, - "upper_limit": 1.0 - } - } - }, - "effective_radius": { - "type": "compound", - "compound_type": "SumPrior", - "left": { - "type": "Uniform", - "id": 71, - "lower_limit": 0.0, - "upper_limit": 30.0 - }, - "right": 0.1 - }, - "sersic_index": { - "type": "Constant", - "value": 4.0 - } - } - }, - "disk": { - "class_path": "autogalaxy.profiles.light.linear.exponential.Exponential", - "type": "model", - "arguments": { - "centre": { - "type": "tuple_prior", - "arguments": { - "centre_0": { - "type": "Gaussian", - "id": 67, - "mean": 0.0, - "sigma": 0.3 - }, - "centre_1": { - "type": "Gaussian", - "id": 68, - "mean": 0.0, - "sigma": 0.3 - } - } - }, - "ell_comps": { - "type": "tuple_prior", - "arguments": { - "ell_comps_0": { - "type": "TruncatedGaussian", - "id": 69, - "mean": 0.0, - "sigma": 0.3, - "lower_limit": -1.0, - "upper_limit": 1.0 - }, - "ell_comps_1": { - "type": "TruncatedGaussian", - "id": 70, - "mean": 0.0, - "sigma": 0.3, - "lower_limit": -1.0, - "upper_limit": 1.0 - } - } - }, - "effective_radius": { - "type": "Uniform", - "id": 71, - "lower_limit": 0.0, - "upper_limit": 30.0 - } - } - } - } - } - } - } - } -} \ No newline at end of file