Skip to content

Changed Method design - #163

Open
lorenzo-consoli wants to merge 16 commits into
mainfrom
refactor/methods
Open

lorenzo-consoli wants to merge 16 commits into
mainfrom
refactor/methods

Conversation

@lorenzo-consoli

@lorenzo-consoli lorenzo-consoli commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Abandoned the design with BaseMethod and GenerativeFlow in favor of a more flexible, protocol-based, approach.

The core.methods._base was restructured significantly. The main objects there are the following:

  • SupportsProtocol, SupportsTraining, SupportsInference: Protocols that define the structural behavior of the protocols.
  • ProtocolSpecs and FlowSpecs are used to hold the specification for general and flow-based protocols.
  • Abstract protocols, defining the contracts for compute_loss, predict and matching protocols.
  • Public base classes, simply wrapping around the abstract ones.
  • Mixin and wrapped protocols: These are needed to wrap around the protocols -- for example, as for matched training steps (eg: the ones that need to call match_fn before compute_loss)

The core.methods.library is then structured in two subfolders core.methods.training and core.methods.inference. I implemented the CFMTrainingProtocol and the ODEInference in the respective folders.

Now the Model class will be instantiated using a module, a training_protocol and an inference_protocol. They have to be set at initialization, but can be overridden at call-time.

@selmanozleyen
selmanozleyen changed the base branch from main to refactor/type-names September 21, 2026 12:12
@selmanozleyen
selmanozleyen added this pull request to stack #165 September 21, 2026 12:24
@selmanozleyen
selmanozleyen removed this pull request from stack #165 September 28, 2026 12:56
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@selmanozleyen
selmanozleyen changed the base branch from refactor/type-names to main October 2, 2026 13:07
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

Successfully merging this pull request may close these issues.

2 participants