pub struct Trainer {
Show 21 fields pub environment: Environment, pub training_images_repeat: usize, pub regularization_images_repeat: usize, pub pretrained_model_name_or_path: String, pub resolution: (usize, usize), pub save_model_as: ModelFileFormat, pub network_module: String, pub text_encoder_lr: f32, pub unet_lr: f32, pub lr_scheduler_num_cycles: usize, pub learning_rate: f32, pub lr_warmup_steps: usize, pub train_batch_size: usize, pub max_train_steps: usize, pub save_every_n_epochs: usize, pub mixed_precision: FloatPrecision, pub save_precision: FloatPrecision, pub max_grad_norm: f32, pub max_data_loader_n_workers: usize, pub bucket_reso_steps: usize, pub noise_offset: f32,
}
Expand description

The Trainer structure.

Fields§

§environment: Environment

The environment to use for the training process.

§training_images_repeat: usize

The number of times to repeat the training images.

§regularization_images_repeat: usize

The number of times to repeat the regularization images.

§pretrained_model_name_or_path: String

The name or path of the pretrained model to use for the training process.

§resolution: (usize, usize)

The maximum resolution of the images to use for the training process.

§save_model_as: ModelFileFormat

The format to save the model as.

§network_module: String

The module to use for the network.

§text_encoder_lr: f32

The learning rate for the text encoder.

§unet_lr: f32

The learning rate for the unet.

§lr_scheduler_num_cycles: usize

The number of cycles for the learning rate scheduler.

§learning_rate: f32

The learning rate for the training process.

§lr_warmup_steps: usize

The number of warmup steps for the learning rate.

§train_batch_size: usize

The batch size for the training process.

§max_train_steps: usize

The maximum number of training steps.

§save_every_n_epochs: usize

The frequency to

§mixed_precision: FloatPrecision

The precision to use for mixed precision training.

§save_precision: FloatPrecision

The precision to use for saving the model.

§max_grad_norm: f32

The maximum gradient norm.

§max_data_loader_n_workers: usize

The maximum number of data loader workers.

§bucket_reso_steps: usize

The number of steps for the bucket resolution.

§noise_offset: f32

The noise offset.

Implementations§

source§

impl Trainer

source

pub fn new() -> Self

Create a new Trainer.

source

pub fn start(&self, parameters: &Parameters)

Start the training process.

Trait Implementations§

source§

impl Default for Trainer

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.