Skip to content

Conversation

@jeipollack
Copy link
Contributor

@jeipollack jeipollack commented Nov 12, 2025

This PR addresses the issue of TensorFlow Addons functions (e.g. RectifiedAdam and interpolate_spline) being incompatible with the EDEN 3.1 (TF 2.11) environment by removing TFA as a required dependency and introducing a fully configurable optimizer selection system.

Closes #179

Key changes:

  • New optimizer.py module with get_optimizer function to centralise optimizer creation.
  • get_optimizer supports multiple input types:
    • RecursiveNamespace from configs,
    • dict of hyperparameters, or
    • string optimizer names ("Adam" or "rectified_adam").
  • Optional RectifiedAdam: dynamically imports TensorFlow Addons only if rectified_adam is defined in the config file.
  • Legacy TensorFlow handling: automatically uses tf.keras.optimizers.legacy.Adam for TF < 2.11 and standard Adam otherwise.
  • Supports hyperparameter overrides: learning rate, beta1/beta2, epsilon, amsgrad.
  • Updated build_PSF_model to accept either a Keras optimizer instance or a config passed through get_optimizer.
  • Removed TFA from required dependencies; training now runs on TF 2.11 without Addons.
  • Optional optimizer parameters configurable via YAML or programmatically for reproducibility.
  • New interpolation.py and types.py modules with copied code from the TFA repo
  • Replaced tfa.image.interpolate_spline with local equivalent renamed totfa_interpolate_spline_rbf
  • Added unit tests:
    • test_optimizer.py: covers legacy/non-legacy handling, RectifiedAdam import logic, overrides, and input normalization.
    • test_interpolation.py: basic validation for the local tfa_interpolate_spline_rbf wrapper.
  • Updates to README, License and new THIRD_PARTY_LICENSE directory with the TFA license
  • Fully backwards compatible; existing unit tests remain valid

@jeipollack jeipollack force-pushed the feature/179/configurable-optimizer branch from 4cffe99 to 1a53193 Compare November 13, 2025 16:23
…erformance

- Add `is_optimizer_instance` helper to detect if argument is a Keras optimizer instance
- Ensure get_optimizer is called once per cycle and the instance is passed to build_PSF_model
@jeipollack jeipollack added the documentation Improvements or additions to documentation label Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

Remove TensorFlow Addons dependency and introduce configurable optimizer

2 participants