SciGenML
Documentation for SciGenML.
SciGenML.Config.ConditionalFlowMatchingHyperparameters
SciGenML.Config.DenseNeuralNetworkHyperparameters
SciGenML.Config.FlowMatchingHyperparameters
SciGenML.Config.FollmerStochasticInterpolantHyperparameters
SciGenML.Config.Hyperparameters
SciGenML.Config.KNMIDataHyperparameters
SciGenML.Config.KolmogorovDataHyperparameters
SciGenML.Config.OptimizerHyperparameters
SciGenML.Config.PlaceholderDataHyperparameters
SciGenML.Config.ScoreBasedDiffusionModelHyperparameters
SciGenML.Config.StochasticInterpolantHyperparameters
SciGenML.Config.SuperResKolmogorovDataHyperparameters
SciGenML.Config.TrainingHyperparameters
SciGenML.Config.UNetHyperparameters
SciGenML.Models.ConditionalFlowMatching
SciGenML.Models.ConditionalGenerativeModel
SciGenML.Models.DeterministicInterpolantCoefs
SciGenML.Models.FlowMatching
SciGenML.Models.FollmerStochasticInterpolant
SciGenML.Models.GenerativeModel
SciGenML.Models.ScoreBasedDiffusionModel
SciGenML.Models.StochasticInterpolant
SciGenML.Models.StochasticInterpolantCoefs
SciGenML.Preprocessing.MinMaxScaler
SciGenML.Preprocessing.Preprocessor
SciGenML.Preprocessing.StandardScaler
SciGenML.Training.Checkpoint
SciGenML.Architectures.DenseNeuralNetwork
SciGenML.Architectures.UNet
SciGenML.Architectures.UNet
SciGenML.Architectures.UNet
SciGenML.Architectures.UNet
SciGenML.Architectures.get_model
SciGenML.Data.load_knmi_data
SciGenML.Data.load_knmi_data
SciGenML.Data.load_kolmogorov_data
SciGenML.Data.load_super_res_kolmogorov_data
SciGenML.Layers.conv_next_block
SciGenML.Layers.conv_next_block_no_conditioning
SciGenML.Layers.get_padding
SciGenML.Layers.multiple_conv_next_blocks
SciGenML.Layers.multiple_conv_next_blocks_no_conditioning
SciGenML.Layers.sinusoidal_embedding
SciGenML.Models.compute_interpolant
SciGenML.Models.compute_interpolant
SciGenML.Models.compute_interpolant_diff
SciGenML.Models.diffusion_interpolant_coefs
SciGenML.Models.drift_term
SciGenML.Models.drift_term
SciGenML.Models.drift_term
SciGenML.Models.drift_term
SciGenML.Models.drift_term
SciGenML.Models.drift_term
SciGenML.Models.drift_term
SciGenML.Models.get_interpolant_coefs
SciGenML.Models.linear_interpolant_coefs
SciGenML.Models.posterior_drift_term
SciGenML.Models.quadratic_interpolant_coefs
SciGenML.Plotting.animate_field
SciGenML.Plotting.animate_velocity_magitude
SciGenML.Preprocessing.get_dims_to_reduce
SciGenML.Preprocessing.min_max_scaler_inverse_transform
SciGenML.Preprocessing.min_max_scaler_transform
SciGenML.Preprocessing.reshape_scalar
SciGenML.Preprocessing.standard_scaler_inverse_transform
SciGenML.Preprocessing.standard_scaler_transform
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.Sampling.sample
SciGenML.TimeIntegrators.RK4_step
SciGenML.TimeIntegrators.RK4_step
SciGenML.TimeIntegrators.euler_maruyama_step
SciGenML.TimeIntegrators.euler_maruyama_step
SciGenML.TimeIntegrators.forward_euler_step
SciGenML.TimeIntegrators.forward_euler_step
SciGenML.TimeIntegrators.heun_step
SciGenML.TimeIntegrators.heun_step
SciGenML.TimeIntegrators.ode_integrator
SciGenML.TimeIntegrators.ode_integrator
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training._train_step
SciGenML.Training.compute_score_loss
SciGenML.Training.compute_velocity_loss
SciGenML.Training.get_dataloader
SciGenML.Training.get_dataloader
SciGenML.Training.get_dataloader
SciGenML.Training.get_gradients
SciGenML.Training.get_interpolated_samples
SciGenML.Training.get_interpolated_samples
SciGenML.Training.get_optimizer
SciGenML.Training.load_train_state
SciGenML.Training.save_train_state
SciGenML.Training.split_data
SciGenML.Training.train
SciGenML.Training.train
SciGenML.Training.train
SciGenML.Training.train
SciGenML.Training.train
SciGenML.Training.train
SciGenML.Training.train
SciGenML.Models.ConditionalFlowMatching
— TypeConditionalFlowMatching
A conditional flow matching generative model.
The conditional flow matching generative model is a generative model that uses a flow matching approach to generate data.
It is a special case of the conditional stochastic interpolant generative model where there is no noise in the interpolant.
SciGenML.Models.ConditionalGenerativeModel
— TypeAbstract type for all conditional generative models.
SciGenML.Models.DeterministicInterpolantCoefs
— TypeDeterministicInterpolantCoefs
A struct that contains the alpha and beta function coefficients and their derivatives.
The interpolant is defined as:
x(t) = α(t) * x0 + β(t) * x1
The derivatives are:
dx/dt = α'(t) * x0 + β'(t) * x1
SciGenML.Models.FlowMatching
— TypeFlowMatching
A flow matching generative model.
The flow matching generative model is a generative model that uses a flow matching approach to generate data.
It is a special case of the stochastic interpolant generative model where there is no noise in the interpolant.
SciGenML.Models.FollmerStochasticInterpolant
— TypeFollmerStochasticInterpolant
A follmer stochastic interpolant generative model.
SciGenML.Models.GenerativeModel
— TypeAbstract type for all generative models.
SciGenML.Models.ScoreBasedDiffusionModel
— TypeScoreBasedDiffusionModel
A score-based diffusion model generative model.
The score-based diffusion model generative model is a generative model that uses a score-based diffusion model approach to generate data.
It is a special case of the stochastic interpolant generative model where there is no noise in the interpolant.
SciGenML.Models.StochasticInterpolant
— TypeStochasticInterpolant
A stochastic interpolant generative model.
SciGenML.Models.StochasticInterpolantCoefs
— TypeStochasticInterpolantCoefs
A struct that contains the alpha and beta function coefficients and their derivatives.
The interpolant is defined as:
x(t) = α(t) * x0 + β(t) * x1 + γ(t) * Z
The derivatives are:
dx/dt = α'(t) * x0 + β'(t) * x1 + γ'(t) * Z
SciGenML.Models.compute_interpolant
— Methodcompute_interpolant(x0, x1, z, t, interpolant_coefs::StochasticInterpolantCoefs)
Computes the stochastic interpolant at a given time.
Args:
x0: The starting point.
x1: The ending point.
z: The noise.
t: The time.
interpolant_coefs: The interpolant coefficients.
SciGenML.Models.compute_interpolant
— MethodComputes the deterministic interpolant at a given time.
Args:
x0: The starting point.
x1: The ending point.
t: The time.
interpolant_coefs: The interpolant coefficients.
SciGenML.Models.compute_interpolant_diff
— Methodcompute_interpolant_diff
Computes the derivative of the interpolant at a given time.
Args:
x0: The starting point.
x1: The ending point.
interpolant_coefs: The interpolant coefficients.
t: The time.
SciGenML.Models.diffusion_interpolant_coefs
— Functiondiffusion_interpolant_coefs(trait::Models.Deterministic)
Returns the quadratic interpolant.
The quadratic interpolant is defined as:
α(t) = exp(-multiplier * t)
β(t) = sqrt(1 - exp(-2 * multiplier * t))
The derivatives are:
α'(t) = -multiplier * exp(-multiplier * t)
β'(t) = multiplier * exp(-multiplier * t) / sqrt(1 - exp(-2 * multiplier * t))
SciGenML.Models.drift_term
— Functiondrift_term(
model::FollmerGenerativeModel,
)
Compute the drift term for a stochsatic interpolant.
SciGenML.Models.drift_term
— Methoddrift_term(
::Models.Stochastic,
model::Models.ConditionalFlowMatching,
)
SciGenML.Models.drift_term
— Methoddrift_term(
::Models.Deterministic,
model::Models.ConditionalFlowMatching,
)
Get the drift term for the conditional flow matching generative model.
SciGenML.Models.drift_term
— Methoddrift_term(
model::FollmerGenerativeModel,
diffusion_fn
)
Compute the drift term for a stochsatic interpolant.
SciGenML.Models.drift_term
— Methoddrift_term(
::Models.Stochastic,
model::StochasticInterpolant,
diffusion_fn,
)
Compute the drift term for a stochsatic interpolant.
SciGenML.Models.drift_term
— Methoddrift_term(
::Models.Stochastic,
model::StochasticInterpolant,
diffusion_fn,
)
Compute the drift term for a stochsatic interpolant.
SciGenML.Models.drift_term
— Methoddrift_term(
::Models.Stochastic,
model::StochasticInterpolant,
diffusion_fn,
x,
ps,
st
)
Compute the drift term for a stochastic interpolant.
SciGenML.Models.get_interpolant_coefs
— Methodget_interpolant_coefs(type::String)
Get the interpolant coefficients for a given type.
Supported types are:
- "linear"
- "quadratic"
SciGenML.Models.linear_interpolant_coefs
— Functionlinear_interpolant_coefs(trait::Models.Deterministic)
Returns the linear interpolant.
The linear interpolant is defined as:
α(t) = 1 - t
β(t) = t
γ(t) = 1 - t, if trait == Models.Stochastic
The derivatives are:
α'(t) = -1
β'(t) = 1
γ'(t) = -1, if trait == Models.Stochastic
SciGenML.Models.posterior_drift_term
— Methodposterior_drift_term(
model::FollmerGenerativeModel,
diffusion_fn
)
Compute the drift term for a stochsatic interpolant.
SciGenML.Models.quadratic_interpolant_coefs
— Functionquadratic_interpolant_coefs(trait::Models.Deterministic)
Returns the quadratic interpolant.
The quadratic interpolant is defined as:
α(t) = 1 - t
β(t) = t^2
γ(t) = 1 - t, if trait == Models.Stochastic
The derivatives are:
α'(t) = -1
β'(t) = 2t
γ'(t) = -1, if trait == Models.Stochastic
SciGenML.Preprocessing.MinMaxScaler
— TypeMinMaxScaler
A min-max scaler for data.
SciGenML.Preprocessing.Preprocessor
— TypePreprocessor
A preprocessor for data.
SciGenML.Preprocessing.StandardScaler
— TypeStandardScaler
A scaler for data.
SciGenML.Preprocessing.get_dims_to_reduce
— Functionget_dims_to_reduce(data)
Get the dimensions to reduce from the data. Outputs a tuple of dimensions to reduce.
SciGenML.Preprocessing.min_max_scaler_inverse_transform
— Methodmin_max_scaler_inverse_transform(
data,
min_val::Float32,
max_val::Float32
)
Inverse transform for the min-max scaler.
SciGenML.Preprocessing.min_max_scaler_transform
— Methodmin_max_scaler_transform(
data,
min_val::Float32,
max_val::Float32
)
A scaler for data.
SciGenML.Preprocessing.reshape_scalar
— Methodreshape_scalar(scalar, new_dims)
Reshape a scalar to a new dimension.
SciGenML.Preprocessing.standard_scaler_inverse_transform
— Methodstandard_scaler_inverse_transform(
data,
mean,
std
)
Inverse transform for the standard scaler.
SciGenML.Preprocessing.standard_scaler_transform
— Methodstandard_scaler_transform(
data,
mean,
std
)
A scaler for data.
SciGenML.Architectures.DenseNeuralNetwork
— MethodDenseNN(
in_features::Tuple,
out_features::Int,
hidden_features::Vector{Int};
activation_function = DEFAULT_ACTIVATION_FUNCTION,
dropout = DEFAULT_DROPOUT
)
in_features: A tuple of the number of input features
out_features: The number of output features.
hidden_features: The number of hidden features.
activation_function: The activation function.
A dense neural network with `in_features` input features,
`out_features` output features, and `hidden_features` hidden features.
The input is a tuple that are concatenated to form a single input.
SciGenML.Architectures.UNet
— MethodUNet(
in_channels::Int,
out_channels::Int,
hidden_channels,
time_embedding_dim::Int
padding::String,
)
A UNet model.
# Arguments
- `in_channels::Int`: The number of input channels.
- `out_channels::Int`: The number of output channels.
- `hidden_channels::List{Int}`: The number of hidden channels in each layer.
- `time_embedding_dim::Int`: The dimension of the time embedding.
- `scalar_in_conditioning_dim::Int`: The dimension of the scalar input conditioning.
- `scalar_hidden_conditioning_dim::Int`: The dimension of the hidden scalar conditioning.
- `padding::String`: The padding type.
SciGenML.Architectures.UNet
— MethodUNet(
in_channels::Int,
out_channels::Int,
hidden_channels,
time_embedding_dim::Int
padding::String,
)
A UNet model.
# Arguments
- `in_channels::Int`: The number of input channels.
- `out_channels::Int`: The number of output channels.
- `hidden_channels::List{Int}`: The number of hidden channels in each layer.
- `time_embedding_dim::Int`: The dimension of the time embedding.
- `padding::String`: The padding type.
- `field_in_conditioning_dim::Int`: The dimension of the field input conditioning.
- `field_hidden_conditioning_dim::Int`: The dimension of the hidden field conditioning.
- `field_conditioning_combination::String`: The combination method for the field conditioning.
SciGenML.Architectures.UNet
— MethodUNet(
in_channels::Int,
out_channels::Int,
hidden_channels,
time_embedding_dim::Int
padding::String,
)
A UNet model.
# Arguments
- `in_channels::Int`: The number of input channels.
- `out_channels::Int`: The number of output channels.
- `hidden_channels::List{Int}`: The number of hidden channels in each layer.
- `time_embedding_dim::Int`: The dimension of the time embedding.
- `padding::String`: The padding type.
SciGenML.Architectures.UNet
— MethodUNet(config::Config.UNetHyperparameters)
A UNet model.
# Arguments
- `config::Config.UNetHyperparameters`: The configuration for the UNet model.
SciGenML.Architectures.get_model
— Methodget_model(
in_features,
out_features,
hidden_features,
activation_function = DEFAULT_ACTIVATION_FUNCTION,
dropout = DEFAULT_DROPOUT
)
in_features: The number of input features.
out_features: The number of output features.
hidden_features: The number of hidden features.
activation_function: The activation function.
dropout: The dropout rate.
Returns a model that can be used to predict the output from the input.
SciGenML.Layers.conv_next_block
— Methodconv_next_block(
in_channels::Int,
out_channels::Int,
multiplier::Int = 1,
pars_embed_dim::Int = 1,
imsize::Tuple{Int, Int} = (64, 128)
)
Create a conv next block with the given number of input and output channels. The block consists of two convolutional layers with kernel size kernel_size
. The first layer has the same number of input and output channels, while the second layer has the same number of output channels as the block. The block also includes batch normalization and a skip connection.
https://arxiv.org/abs/2201.03545
Based on https://github.com/tum-pbs/autoreg-pde-diffusion/blob/b9b33913b99ede88d9452c5ab470c5d7f5da5c56/src/turbpred/modeldiffusionblocks.py#L60
SciGenML.Layers.conv_next_block_no_conditioning
— Methodconv_next_block_no_conditioning(
in_channels::Int,
out_channels::Int,
multiplier::Int = 1,
imsize::Tuple{Int, Int} = (64, 128)
)
Create a conv next block with the given number of input and output channels. The block consists of two convolutional layers with kernel size kernel_size
. The first layer has the same number of input and output channels, while the second layer has the same number of output channels as the block. The block also includes batch normalization and a skip connection.
https://arxiv.org/abs/2201.03545
Based on https://github.com/tum-pbs/autoreg-pde-diffusion/blob/b9b33913b99ede88d9452c5ab470c5d7f5da5c56/src/turbpred/modeldiffusionblocks.py#L60
SciGenML.Layers.get_padding
— Methodget_padding(padding::String, padding_size::Int)
Get the padding function for the given padding type and size.
SciGenML.Layers.multiple_conv_next_blocks
— Methodmultiple_conv_next_blocks(
in_channels::Int,
out_channels::Int,
multiplier::Int = 1,
conditioning_dim::Int = 1,
imsize::Tuple{Int, Int} = (64, 128)
)
Create a chain of two conv next blocks with the given number of input and output channels. The first block has the same number of input and output
SciGenML.Layers.multiple_conv_next_blocks_no_conditioning
— Methodmultiple_conv_next_blocks_no_conditioning(
in_channels::Int,
out_channels::Int,
multiplier::Int = 1,
padding="constant"
)
Create a chain of two conv next blocks with the given number of input and output channels. The first block has the same number of input and output
SciGenML.Layers.sinusoidal_embedding
— Functionsinusoidal_embedding(
x::AbstractArray{AbstractFloat, 4},
min_freq::AbstractFloat,
max_freq::AbstractFloat,
embedding_dims::Int
)
Embed the noise variances to a sinusoidal embedding with the given frequency range and embedding dimensions.
Based on https://yng87.page/en/blog/2022/lux-ddim/.
SciGenML.TimeIntegrators.RK4_step
— MethodRK4_step(rhs, x, t, dt, ps, st)
Perform a 4th order Runge-Kutta step.
SciGenML.TimeIntegrators.RK4_step
— MethodRK4_step(rhs, x, conditioning, t, dt, ps, st)
Perform a 4th order Runge-Kutta step.
SciGenML.TimeIntegrators.euler_maruyama_step
— MethodEuler Maruyama step for SDEs.
SciGenML.TimeIntegrators.euler_maruyama_step
— MethodEuler Maruyama step for SDEs.
SciGenML.TimeIntegrators.forward_euler_step
— Methodforward_euler_step(model, x, t, dt)
Perform a forward Euler step.
SciGenML.TimeIntegrators.forward_euler_step
— Methodforward_euler_step(model, x, scalar_conditioning, t, dt)
Perform a forward Euler step.
SciGenML.TimeIntegrators.heun_step
— MethodHeun step for SDEs.
SciGenML.TimeIntegrators.heun_step
— MethodHeun step for SDEs.
SciGenML.TimeIntegrators.ode_integrator
— Methodode_integrator(
stepper,
rhs,
x,
num_steps,
ps,
st;
t_interval=[0.0, 1.0],
verbose::Bool = true
)
Generic ODE integrator.
SciGenML.TimeIntegrators.ode_integrator
— Methodode_integrator(
stepper,
rhs,
x,
scalar_conditioning,
num_steps,
ps,
st;
t_interval=[0.0, 1.0],
verbose::Bool = true
)
Generic ODE integrator.
SciGenML.Data.load_knmi_data
— Methodload_knmi_data(
num_steps
)
Loads the KNMI data for the given number of steps.
SciGenML.Data.load_knmi_data
— Methodload_knmi_data(
config::Config.KNMIDataHyperparameters;
kwargs...
)
Loads the KNMI data for the given configuration.
SciGenML.Data.load_kolmogorov_data
— Functionload_kolmogorov_data(;
num_trajectories = 5,
num_skip_steps = 5,
num_steps = 100,
start_step = 500
)
Load the Kolmogorov data.
Outputs a named tuple with the following fields:
- `base`: The base data. [H, W, C, (T-1)*N]
- `target`: The target data. [H, W, C, (T-1)*N]
- `field_conditioning`: The field conditioning data. [H, W, C, (T-1)*N]
SciGenML.Data.load_super_res_kolmogorov_data
— Functionload_super_res_kolmogorov_data(;
num_trajectories = 5,
num_skip_steps = 5,
num_steps = 100,
start_step = 500
)
Load the super-resolution Kolmogorov data.
Outputs a named tuple with the following fields:
- `base`: The base data. [H, W, C, (T-1)*N]
- `target`: The target data. [H, W, C, (T-1)*N]
- `field_conditioning`: The field conditioning data. [H, W, C, (T-1)*N]
SciGenML.Sampling.sample
— Methodsample(
model,
args...;
kwargs...
)
Generic training function for all models.
SciGenML.Sampling.sample
— Methodsample(
::Models.Deterministic,
model::Models.FlowMatching,
num_samples::Int,
num_steps::Int,
rng::Random.AbstractRNG = Random.default_rng()
)
Sample from a stochastic interpolant generative model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Deterministic,
model::Models.FlowMatching,
num_samples::Int,
num_steps::Int,
rng::Random.AbstractRNG = Random.default_rng()
)
Sample from a stochastic interpolant generative model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Deterministic,
model::Models.ScoreBasedDiffusionModel,
num_samples::Int,
num_steps::Int,
rng::Random.AbstractRNG = Random.default_rng()
)
Sample from a denoising diffusion model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Deterministic,
model::Models.StochasticInterpolantGenerativeModel,
num_samples::Int,
num_steps::Int,
rng::Random.AbstractRNG = Random.default_rng()
)
Sample from a stochastic interpolant generative model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Stochastic,
model::Models.FollmerStochasticInterpolant,
scalar_conditioning,
num_steps::Int,
num_samples::Int,
prior_samples = nothing,
diffusion_fn = nothing,
rng::Random.AbstractRNG = Random.default_rng(),
verbose::Bool = true,
stepper = TimeIntegrators.heun_step
)
Sample from a stochastic interpolant generative model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Stochastic,
model::Models.ScoreBasedDiffusionModel,
num_samples::Int,
num_steps::Int,
rng::Random.AbstractRNG = Random.default_rng()
)
Sample from a denoising diffusion model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Stochastic,
model::Models.ScoreBasedDiffusionModel,
num_samples::Int,
num_steps::Int,
num_samples::Int,
prior_samples,
diffusion_fn,
rng::Random.AbstractRNG = Random.default_rng(),
verbose::Bool = true,
stepper = TimeIntegrators.heun_step
)
Sample from a denoising diffusion model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Stochastic,
model::Models.StochasticInterpolant,
scalar_conditioning,
num_steps::Int,
num_samples::Int,
prior_samples = nothing,
diffusion_fn = nothing,
rng::Random.AbstractRNG = Random.default_rng(),
verbose::Bool = true,
stepper = TimeIntegrators.heun_step
)
Sample from a stochastic interpolant generative model using the forward Euler method.
SciGenML.Sampling.sample
— Methodsample(
::Models.Stochastic,
model::Models.StochasticInterpolantGenerativeModel,
num_samples::Int,
num_steps::Int,
rng::Random.AbstractRNG = Random.default_rng()
)
Sample from a stochastic interpolant generative model using the forward Euler method.
SciGenML.Training.Checkpoint
— TypeCheckpoint
A checkpoint for a model and other data.
SciGenML.Training._train_step
— Method_train_step(
::Models.Deterministic,
model::Models.ConditionalFlowMatching,
base_samples,
target_samples,
scalar_conditioning_samples,
train_state,
rng
)
Train a stochastic interpolant generative model for one step.
SciGenML.Training._train_step
— Method_train_step(
::Models.Deterministic,
model::Models.FlowMatching,
base_samples,
target_samples,
train_state,
rng
)
Train a flow matching generative model for one step.
SciGenML.Training._train_step
— Method_train_step(
::Models.Deterministic,
model::Models.FlowMatching,
base_samples,
target_samples,
field_conditioning,
train_state,
rng
)
Train a flow matching generative model for one step.
SciGenML.Training._train_step
— Method_train_step(
::Models.Deterministic,
model::Models.StochasticInterpolant,
base_samples,
target_samples,
train_state,
rng
)
Train a stochastic interpolant generative model for one step.
SciGenML.Training._train_step
— Method_train_step(
::Models.Deterministic,
model::Models.ScoreBasedDiffusionModel,
base_samples,
target_samples,
train_state,
rng
)
Train a score-based diffusion generative model for one step via flow matching.
SciGenML.Training._train_step
— Method_train_step(
::Models.Deterministic,
model::Models.ScoreBasedDiffusionModel,
base_samples,
target_samples,
conditioning,
train_state,
rng
)
Train a score-based diffusion generative model for one step via flow matching.
SciGenML.Training._train_step
— Method_train_step(
::Models.Stochastic,
model::Models.FollmerStochasticInterpolant,
base_samples,
target_samples,
field_conditioning,
train_state,
rng
)
Train a stochastic interpolant generative model for one step.
SciGenML.Training._train_step
— Method_train_step(
::Models.Stochastic,
model::Models.StochasticInterpolant,
base_samples,
target_samples,
train_state,
rng
)
Train a stochastic interpolant generative model for one step.
SciGenML.Training._train_step
— Method_train_step(
::Models.Stochastic,
model::Models.StochasticInterpolant,
base_samples,
target_samples,
scalar_conditioning,
train_state,
rng
)
Train a stochastic interpolant generative model for one step.
SciGenML.Training.compute_score_loss
— Methodcompute_score_loss(model, ps, st, (x, z, gamma))
Compute the loss for a stochastic interpolant generative model.
SciGenML.Training.compute_velocity_loss
— Methodcompute_velocity_loss(model, ps, st, (x, y))
Compute the loss for a stochastic interpolant generative model.
SciGenML.Training.get_dataloader
— Functionget_dataloader(
base,
target,
batch_size::Int,
match_base_and_target::Bool=false
)
Get a dataloader from a base and target.
SciGenML.Training.get_dataloader
— Functionget_dataloader(
data::NamedTuple,
batch_size::Int,
match_base_and_target::Bool=false
)
Get a dataloader from a named tuple.
SciGenML.Training.get_dataloader
— Functionget_dataloader(
base,
target,
scalar_conditioning,
batch_size::Int,
match_base_and_target::Bool=false
)
Get a dataloader from a base, target, and conditioning.
SciGenML.Training.get_gradients
— Methodget_gradients(
batch,
train_state,
loss_fn,
)
Get gradients from a batch, train state, and loss function.
SciGenML.Training.get_interpolated_samples
— Methodget_interpolated_samples(
base_samples,
target_samples,
t_samples,
interpolant_coefs
)
Get interpolated samples from a base, target, and time.
SciGenML.Training.get_interpolated_samples
— Methodget_interpolated_samples(
base_samples,
target_samples,
z_samples,
t_samples,
interpolant_coefs
)
Get interpolated samples from a base, target, and time.
SciGenML.Training.get_optimizer
— Methodget_optimizer(type::String, lr, lambda)
Get an optimizer from a string.
SciGenML.Training.load_train_state
— Methodload_train_state(
checkpoint::Checkpoint
)
Load a train state from a checkpoint.
SciGenML.Training.save_train_state
— Methodsave_train_state(
ps,
st,
checkpoint::Checkpoint
)
Save a train state to a checkpoint.
SciGenML.Training.split_data
— Functionsplit_data(data, split_ratio, rng = Random.default_rng())
Split data into train and validation sets.
SciGenML.Training.train
— Functiontrain(
::Models.Deterministic,
model::Models.ScoreBasedDiffusionModel,
data,
config,
rng = Random.default_rng();
verbose = true,
checkpoint = nothing
)
Train a score-based diffusion generative model vis flow matching.
SciGenML.Training.train
— Functiontrain(
::Models.Deterministic,
model::Models.FlowMatching,
data,
config,
rng = Random.default_rng();
verbose = true,
checkpoint = nothing
)
Train a stochastic interpolant generative model.
SciGenML.Training.train
— Functiontrain(
::Models.Stochastic,
model::Models.FollmerStochasticInterpolant,
data,
config,
rng = Random.default_rng();
verbose = true,
checkpoint = nothing
)
Train a Follmer stochastic interpolant generative model.
SciGenML.Training.train
— Functiontrain(
::Models.Stochastic,
model::Models.StochasticInterpolantGenerativeModel,
data,
config,
rng = Random.default_rng();
verbose = true
)
Train a stochastic interpolant generative model.
SciGenML.Training.train
— Functiontrain(
::Models.Deterministic,
model::Models.StochasticInterpolantGenerativeModel,
data,
config,
rng = Random.default_rng();
verbose = true,
checkpoint = nothing
)
Train a stochastic interpolant generative model.
SciGenML.Training.train
— Functiontrain(
::Models.Deterministic,
model::Models.ConditionalFlowMatching,
data,
config,
rng = Random.default_rng();
verbose = true
)
Train a stochastic interpolant generative model.
SciGenML.Training.train
— Methodtrain(
model,
args...;
kwargs...
)
Generic training function for all models.
SciGenML.Config.ConditionalFlowMatchingHyperparameters
— TypeConditionalFlowMatchingHyperparameters
Hyperparameters for the conditional flow matching generative model.
SciGenML.Config.DenseNeuralNetworkHyperparameters
— TypeDenseNeuralNetworkHyperparameters
Hyperparameters for the dense neural network.
SciGenML.Config.FlowMatchingHyperparameters
— TypeFlowMatchingHyperparameters
Hyperparameters for the flow matching generative model.
SciGenML.Config.FollmerStochasticInterpolantHyperparameters
— TypeFollmerStochasticInterpolantHyperparameters
Hyperparameters for the follmer stochastic interpolant generative model.
SciGenML.Config.Hyperparameters
— TypeHyperparameters
Hyperparameters for the architecture, training, and optimizer.
SciGenML.Config.KNMIDataHyperparameters
— TypeKNMIDataHyperparameters
Hyperparameters for the KNMI data.
SciGenML.Config.KolmogorovDataHyperparameters
— TypeKolmogorovDataHyperparameters
Hyperparameters for the kolmogorov data.
SciGenML.Config.OptimizerHyperparameters
— TypeOptimizerHyperparameters
Hyperparameters for the optimizer.
SciGenML.Config.PlaceholderDataHyperparameters
— TypePlaceholderDataHyperparameters
Hyperparameters for the placeholder.
SciGenML.Config.ScoreBasedDiffusionModelHyperparameters
— TypeScoreBasedDiffusionModelHyperparameters
Hyperparameters for the score-based diffusion model generative model.
SciGenML.Config.StochasticInterpolantHyperparameters
— TypeStochasticInterpolantHyperparameters
Hyperparameters for the stochastic interpolant generative model.
SciGenML.Config.SuperResKolmogorovDataHyperparameters
— TypeSuperResKolmogorovDataHyperparameters
Hyperparameters for the super res kolmogorov data.
SciGenML.Config.TrainingHyperparameters
— TypeTrainingHyperparameters
Hyperparameters for the training.
SciGenML.Config.UNetHyperparameters
— TypeUNetHyperparameters
Hyperparameters for the UNet.
SciGenML.Plotting.animate_field
— Methodanimate_field(field_list, filename, plot_titles)
Animate a list of fields.
SciGenML.Plotting.animate_velocity_magitude
— Methodanimate_velocity_field(field_list, filename, plot_titles; velocity_channels = (1, 2))
Animate a list of velocity fields.