atong01 / conditional-flow-matching

TorchCFM: a Conditional Flow Matching library
https://arxiv.org/abs/2302.00482
MIT License
1.25k stars 101 forks source link

I have a simple question for generating samples... #133

Open KinamSalad opened 3 months ago

KinamSalad commented 3 months ago

I am getting a lot of help from this project. Thank you! I have one question. Is the method for generating samples(ex images) with models trained using the FM framework the same as that of basic CFM and Exact OT CFM? I wonder if it is possible to sample in the same way (e.g., Euler or Midpoint) even when using Exact OT CFM. Currently, this project seems to be using something called NeuralODE from torchdyn, but it's difficult to understand because it's wrapped like this. If I use Exact OT CFM, do I need to start with noise that has been sampled using the Exact OT sampler?

kilianFatras commented 3 months ago

1) The FM method (detnoted TargetConditionalFlowMatcher) has to be trained between a Gaussian and your data distribution. CFM and OT-CFM can be trained between any p_0 distribution and your data distribution.

2) You can generate data from any source samples with OT-CFM. See the turotial https://github.com/atong01/conditional-flow-matching/blob/main/examples/2D_tutorials/Flow_matching_tutorial.ipynb.