luz_callback_train_valid: Train-eval callback

luz_callback_train_validR Documentation

Train-eval callback

Description

Switches important flags for training and evaluation modes.

Usage

luz_callback_train_valid()

Details

It takes care of the three ctx attributes:

  • ctx$model: Responsible for calling ctx$model$train() and ctx$model$eval(), when appropriate.

  • ctx$training: Sets this flag to TRUE when training and FALSE when in validation mode.

  • ctx$loss: Resets the loss attribute to list() when finished training/ or validating.

Value

A luz_callback

Note

In general you won't need to explicitly use the train_valid callback as it's used by default in fit.luz_module_generator().

See Also

Other luz_callbacks: luz_callback(), luz_callback_auto_resume(), luz_callback_csv_logger(), luz_callback_early_stopping(), luz_callback_interrupt(), luz_callback_keep_best_model(), luz_callback_lr_scheduler(), luz_callback_metrics(), luz_callback_mixed_precision(), luz_callback_mixup(), luz_callback_model_checkpoint(), luz_callback_profile(), luz_callback_progress(), luz_callback_resume_from_checkpoint()


mlverse/torchlight documentation built on Sept. 19, 2024, 11:22 p.m.