diff --git a/404.html b/404.html index bd801c47..64da1a3e 100644 --- a/404.html +++ b/404.html @@ -91,7 +91,7 @@ diff --git a/LICENSE-text.html b/LICENSE-text.html index 24b26acf..18a16416 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -71,7 +71,7 @@ diff --git a/LICENSE.html b/LICENSE.html index 42cd6e76..850c6ed0 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -60,6 +60,7 @@
+

Copyright (c) 2021 luz authors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

@@ -74,7 +75,7 @@
diff --git a/articles/accelerator.html b/articles/accelerator.html index 08b0f4c8..93d70eb9 100644 --- a/articles/accelerator.html +++ b/articles/accelerator.html @@ -77,7 +77,8 @@ -
+ +
@@ -143,7 +156,7 @@

Example

-

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/articles/accelerator_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/accelerator_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/accelerator_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/articles/checkpoints.html b/articles/checkpoints.html index ec51faf5..6d11dcfa 100644 --- a/articles/checkpoints.html +++ b/articles/checkpoints.html @@ -77,7 +77,8 @@ -
+ +
-

When fitting models take too long you might want to save intermediate state to disk, if something goes wrong during training (eg. process is killed, network fails, etc) you can recover from where it stopped.

-

You might also want to recover intermediate results to evaluate the model in different moments of the training, like comparing results after 10 epochs and after 30 epochs.

-

This article describes luz features that are built to handle those cases. These features are optional and are enabled once you add specific callbacks to your fit call.

+

When fitting models take too long you might want to save intermediate +state to disk, if something goes wrong during training (eg. process is +killed, network fails, etc) you can recover from where it stopped.

+

You might also want to recover intermediate results to evaluate the +model in different moments of the training, like comparing results after +10 epochs and after 30 epochs.

+

This article describes luz features that are built to handle those +cases. These features are optional and are enabled once you add specific +callbacks to your fit call.

Resuming training runs that crashed

-

If you have a long training run that can crash for whatever reason (computer turned off, process kileed in cluster, etc), we recommend you to add luz_callback_autoresume() to your list of callbacks.

-

luz_callback_autoresume() will automatically checkpoint the whole state of your model at the end of each epoch. If something fails during training you can simply rerun the same script, whithout any code changes and the checkpoint will be reloaded and the training will start from where it stopped.

-

For example, lets’s take a randomly generated training dataset and a linear model to show how autoresume works.

+

If you have a long training run that can crash for whatever reason +(computer turned off, process kileed in cluster, etc), we recommend you +to add luz_callback_autoresume() to your list of +callbacks.

+

luz_callback_autoresume() will automatically checkpoint +the whole state of your model at the end of each epoch. If something +fails during training you can simply rerun the same script, whithout any +code changes and the checkpoint will be reloaded and the training will +start from where it stopped.

+

For example, lets’s take a randomly generated training dataset and a +linear model to show how autoresume works.

Here’s the training data:

 x <- torch_randn(1000, 10)
@@ -112,7 +127,9 @@ 

Resuming training runs that crashed setup(optimizer = optim_sgd, loss = nnf_mse_loss) %>% set_hparams(in_features = 10, out_features = 1) %>% set_opt_hparams(lr = 0.01)

-

Let’s now create a callback that simulates a random failure that could happen. This callback will just raise an R error on the 5th epoch.

+

Let’s now create a callback that simulates a random failure that +could happen. This callback will just raise an R error on the 5th +epoch.

 interrupt <- luz_callback(
   "interrupt",
@@ -124,7 +141,8 @@ 

Resuming training runs that crashed } } )

-

Let’s now start training adding the luz_callback_auto_resume():

+

Let’s now start training adding the +luz_callback_auto_resume():

 autoresume <- luz_callback_auto_resume(path = "state.pt")
 inter <- interrupt()
@@ -140,14 +158,17 @@ 

Resuming training runs that crashed #> on_epoch_end. #> Caused by error in `self[[callback_nm]]()`: #> ! Error on epoch 5

-

To resume model training exactly from where it stopped you just need to restart fitting, using the exact same model, callbacks, etc:

+

To resume model training exactly from where it stopped you just need +to restart fitting, using the exact same model, callbacks, etc:

 results <- model %>% fit(
   list(x, y),
   callbacks = list(inter, autoresume),
   verbose = FALSE
 )
-

With this, the model fitting process will be continued exactly from where it stopped. Records, optimizer and model state are recovered from the previous run so you can have the full results:

+

With this, the model fitting process will be continued exactly from +where it stopped. Records, optimizer and model state are recovered from +the previous run so you can have the full results:

 plot(results)

@@ -155,8 +176,12 @@

Resuming training runs that crashed

Checkpointing

-

Sometimes you want to have more control over how checkpoints are handled. In this case you can use luz_callback_model_checkpoint() to save checkpoints to a specified file or directory.

-

Let’s use the same example as in the resuming section: We first generate some data.

+

Sometimes you want to have more control over how checkpoints are +handled. In this case you can use +luz_callback_model_checkpoint() to save checkpoints to a +specified file or directory.

+

Let’s use the same example as in the resuming section: We first +generate some data.

 x <- torch_randn(1000, 10)
 y <- torch_randn(1000, 1)
@@ -166,7 +191,8 @@

Checkpointingsetup(optimizer = optim_sgd, loss = nnf_mse_loss) %>% set_hparams(in_features = 10, out_features = 1) %>% set_opt_hparams(lr = 0.01)

-

Let’s now fit the model using luz_callback_model_checkpoint().

+

Let’s now fit the model using +luz_callback_model_checkpoint().

 checkpoint <- luz_callback_model_checkpoint(
   path = "checkpoints/", 
@@ -178,7 +204,12 @@ 

Checkpointing= list(checkpoint), verbose = FALSE )

-

You can see now that the checkpoints directory contains files with state dumps for each epoch. By default, luz_callback_model_checkpoint will save the state for each epochs and format the name including the resulting loss. This can be configured withing the path parameter, see ?luz_callback_model_checkpoint for details.

+

You can see now that the checkpoints directory contains +files with state dumps for each epoch. By default, +luz_callback_model_checkpoint will save the state for each +epochs and format the name including the resulting loss. This can be +configured withing the path parameter, see +?luz_callback_model_checkpoint for details.

 fs::dir_ls("checkpoints")
 #> checkpoints/epoch-01-train_loss-1.237.pt
@@ -191,11 +222,21 @@ 

Checkpointing#> checkpoints/epoch-08-train_loss-0.998.pt #> checkpoints/epoch-09-train_loss-1.001.pt #> checkpoints/epoch-10-train_loss-1.002.pt

-

Finally, you can load a specific checkpoint to the fitted result using luz_load_checkpoint. Note that loading the checkpoint into a a luz_fitted_module is going to modify the model weights in-place.

+

Finally, you can load a specific checkpoint to the +fitted result using luz_load_checkpoint. Note +that loading the checkpoint into a a luz_fitted_module is +going to modify the model weights in-place.

 luz_load_checkpoint(results, fs::dir_ls("checkpoints")[1])
-

You can then start making predictions, or evaluate your model using the reloeded weights.

-

You might also want to start a new training run from a checkpoint. For this, you can use the luz_callback_resume_from_checkpoint(). By default, it will only recover the model weights from the checkpoint file, but you can configure it to restore records, callback and optimizer state too. If a checkpoint directory is passed then training will resume from the last checkpoint file as returned by fs::dir_ls.

+

You can then start making predictions, or evaluate your model using +the reloeded weights.

+

You might also want to start a new training run from a checkpoint. +For this, you can use the +luz_callback_resume_from_checkpoint(). By default, it will +only recover the model weights from the checkpoint file, but you can +configure it to restore records, callback and optimizer state too. If a +checkpoint directory is passed then training will resume from the last +checkpoint file as returned by fs::dir_ls.

Here’s how you would use this callback:

 resume <- luz_callback_resume_from_checkpoint(path = "checkpoints/")
@@ -209,8 +250,15 @@ 

Checkpointing

Custom callbacks state

-

Sometimes callbacks also need to keep their internal state in order to allow continuing training exactly from where it stopped. In this case, callbacks can implement the state_dict() and the load_state_dict() methods that are automatically called when saving and reloading checkpoints.

-

For example, suppose that you have a callback that tracks gradients for weights at every epoch. You want to use the tracked weights to further analyse the training procedure. It could be implemented like:

+

Sometimes callbacks also need to keep their internal state in order +to allow continuing training exactly from where it stopped. In this +case, callbacks can implement the state_dict() and the +load_state_dict() methods that are automatically called +when saving and reloading checkpoints.

+

For example, suppose that you have a callback that tracks gradients +for weights at every epoch. You want to use the tracked weights to +further analyse the training procedure. It could be implemented +like:

 cb_weight_grad <- luz_callback(
   "weight_grad",
@@ -225,7 +273,14 @@ 

Custom callbacks state } } )

-

In the above example, the gradients field is a state in the callback. If training fails for some reason, gradients will be lost. If it’s important for you to also checkpoint the callback state, you can implement the state_dict() method must returning a named list of objects that compose the state of the callback and load_state_dict() taking the same named list returned by state_dict() and restoring the callback state.

+

In the above example, the gradients field is a +state in the callback. If training fails for some +reason, gradients will be lost. If it’s important for you +to also checkpoint the callback state, you can implement the +state_dict() method must returning a named list of objects +that compose the state of the callback and +load_state_dict() taking the same named list returned by +state_dict() and restoring the callback state.

The callback above could be reimplemented with:

 cb_weight_grad <- luz_callback(
@@ -262,7 +317,7 @@ 

Custom callbacks state

-

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/articles/checkpoints_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/checkpoints_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/checkpoints_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/articles/custom-loop.html b/articles/custom-loop.html index b27b17d8..658563a7 100644 --- a/articles/custom-loop.html +++ b/articles/custom-loop.html @@ -77,7 +77,8 @@ -
+ +
@@ -248,7 +317,7 @@

Next steps

-

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/articles/custom-loop_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/custom-loop_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/custom-loop_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/articles/examples/chargpt.html b/articles/examples/chargpt.html index 98f09978..270e7efa 100644 --- a/articles/examples/chargpt.html +++ b/articles/examples/chargpt.html @@ -77,7 +77,8 @@ -
+ +
+
+
+
+
+
+Training a causal language model from scratch +
+advanced +

+Implements datasets and trains a causal language model from scratch +using R source code. +

+See code +
+
+
+
@@ -274,7 +299,7 @@
diff --git a/articles/examples/index_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/examples/index_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/examples/index_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/articles/examples/mnist-autoencoder.html b/articles/examples/mnist-autoencoder.html index 4e2ff1e5..8827238a 100644 --- a/articles/examples/mnist-autoencoder.html +++ b/articles/examples/mnist-autoencoder.html @@ -77,7 +77,8 @@ -
+ +

-

In this article we discuss how to find a good learning rate for your model. Finding a good learning rate is essential to be able to fit your model. If it’s too low, you will need too many iterations for your loss to converge, and that might be impractical if your model takes too long to run. If it’s too high, the loss can explode and you might never be able to minimize the loss.

-

The learning rate can be considered another hyperparameter of your model that needs to be tuned but, there are techniques that allow you to select a good learning rate for your model without having to use the costly strategy of fitting many models with different learning rates and then choosing the one with better results.

-

This article by Leslie Smith that became popular once their approach had been implemented in the popular FastAI framework, proposes that we should start with a very small learning rate and slowly increase it until we reach a high learning rate. At each iteration we record the loss value and in the end we plot it against the learning rate. We can then use these results to decide on a good learning rate. That’s what lr_finder does, and we will show how to use it.

+

In this article we discuss how to find a good learning rate for your +model. Finding a good learning rate is essential to be able to fit your +model. If it’s too low, you will need too many iterations for your loss +to converge, and that might be impractical if your model takes too long +to run. If it’s too high, the loss can explode and you might never be +able to minimize the loss.

+

The learning rate can be considered another hyperparameter of your +model that needs to be tuned but, there are techniques that allow you to +select a good learning rate for your model without having to use the +costly strategy of fitting many models with different learning rates and +then choosing the one with better results.

+

This article by Leslie +Smith that became popular once their approach had been implemented in +the popular FastAI framework, proposes that we should start with a very +small learning rate and slowly increase it until we reach a high +learning rate. At each iteration we record the loss value and in the end +we plot it against the learning rate. We can then use these results to +decide on a good learning rate. That’s what lr_finder does, +and we will show how to use it.

First let’s download and prepare the MNIST dataset:

 dir <- "~/Downloads/mnist" # caching directory
@@ -108,7 +125,8 @@ 
 )
 #> Processing...
 #> Done!
-

We can now define our model. We are going to use a small, straightforward CNN in the LeNet style.

+

We can now define our model. We are going to use a small, +straightforward CNN in the LeNet style.

 net <- nn_module(
   "net",
@@ -135,7 +153,11 @@ 
       self$classifier()
   }
 )
-

We can now use the lr_finder function to record the loss with different learning rates. It’s important to use the learning rate finder with all other hyperparameters of the model fixed because they can influence the choice of the learning rate. For example, depending on the batch size, you might want to choose different learning rates.

+

We can now use the lr_finder function to record the loss +with different learning rates. It’s important to use the learning rate +finder with all other hyperparameters of the model fixed because they +can influence the choice of the learning rate. For example, depending on +the batch size, you might want to choose different learning rates.

 model <- net %>% setup(
   loss = torch::nn_cross_entropy_loss(),
@@ -155,15 +177,26 @@ 
 #> Classes 'lr_records' and 'data.frame':   100 obs. of  2 variables:
 #>  $ lr  : num  1.15e-06 1.32e-06 1.51e-06 1.74e-06 2.00e-06 ...
 #>  $ loss: num  2.31 2.3 2.29 2.3 2.31 ...
-

The result is a data frame with the losses and the learning rate in each step. You can use the built-in plot method to display the exact results, along with a exponentially smoothed value of the loss.

+

The result is a data frame with the losses and the learning rate in +each step. You can use the built-in plot method to display the exact +results, along with a exponentially smoothed value of the loss.

 plot(records) +
   ggplot2::coord_cartesian(ylim = c(NA, 5))

-

We can see that with small learning rates the loss doesn’t decrease. At some point the loss starts decreasing until it reaches a point where it starts increasing and explodes.

-

And how do we choose the learning rate using this plot? Sylvain Gugger asked the same question in this blog post and we are quoting his answer:

+

We can see that with small learning rates the loss doesn’t decrease. +At some point the loss starts decreasing until it reaches a point where +it starts increasing and explodes.

+

And how do we choose the learning rate using this plot? Sylvain +Gugger asked the same question in this blog +post and we are quoting his answer:

-

Not the one corresponding to the minimum. Why? Well the learning rate that corresponds to the minimum value is already a bit too high, since we are at the edge between improving and getting all over the place. We want to go one order of magnitude before, a value that’s still aggressive (so that we train quickly) but still on the safe side from an explosion.

+

Not the one corresponding to the minimum. Why? Well the learning rate +that corresponds to the minimum value is already a bit too high, since +we are at the edge between improving and getting all over the place. We +want to go one order of magnitude before, a value that’s still +aggressive (so that we train quickly) but still on the safe side from an +explosion.

In the above example we would choose 1e-3 instead of 1e-2.

@@ -178,7 +211,7 @@ diff --git a/articles/lr-finder_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/lr-finder_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/lr-finder_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/authors.html b/authors.html index 91358a77..60012493 100644 --- a/authors.html +++ b/authors.html @@ -95,7 +95,7 @@

Citation

diff --git a/index.html b/index.html index 6d2484de..02b9dcd1 100644 --- a/index.html +++ b/index.html @@ -5,14 +5,24 @@ - + Higher Level API for torch • luz - + +

Luz is a higher level API for torch providing abstractions to allow for much less verbose training loops.

This package is still under development.

It is heavily inspired by other higher level frameworks for deep learning, to cite a few:

@@ -190,7 +201,7 @@

Dev status

diff --git a/news/index.html b/news/index.html index 1caa70f2..488f9cb4 100644 --- a/news/index.html +++ b/news/index.html @@ -101,7 +101,8 @@

Bug fixes

luz 0.3.1

CRAN release: 2022-09-06

-
  • Re-submission to fix vignette rendering.
+
  • Re-submission to fix vignette rendering.
  • +

luz 0.3.0

CRAN release: 2022-08-19

@@ -113,7 +114,8 @@

Breaking changes

Documentation

-

+

New features

  • Added MixUp callback and helper loss function and functional logic. (#82, @skeydan).
  • @@ -151,7 +153,8 @@

    Internal changes

    luz 0.1.0

    CRAN release: 2021-06-17

    -
    • Added a NEWS.md file to track changes to the package.

+
  • Added a NEWS.md file to track changes to the package.
  • +
@@ -161,7 +164,7 @@

luz 0.1.0 -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/pkgdown.yml b/pkgdown.yml index 3b8ad870..5832483b 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -1,15 +1,14 @@ -pandoc: 2.7.3 -pkgdown: 2.0.7.9000 -pkgdown_sha: c9206802f2888992de92aa41f517ba7812f05331 +pandoc: 2.19.2 +pkgdown: 2.0.7 +pkgdown_sha: ~ articles: accelerator: accelerator.html - chargpt: examples/chargpt.html checkpoints: checkpoints.html + lr-finder: lr-finder.html custom-loop: custom-loop.html + chargpt: examples/chargpt.html dogs-vs-cats-binary-classification: examples/dogs-vs-cats-binary-classification.html - get-started: get-started.html index: examples/index.html - lr-finder: lr-finder.html mnist-autoencoder: examples/mnist-autoencoder.html mnist-cnn-virtual-batch-size: examples/mnist-cnn-virtual-batch-size.html mnist-cnn: examples/mnist-cnn.html @@ -18,5 +17,7 @@ articles: mnist-triplet: examples/mnist-triplet.html pets-unet: examples/pets-unet.html text-classification: examples/text-classification.html -last_built: 2023-09-15T17:29Z + text-generation: examples/text-generation.html + get-started: get-started.html +last_built: 2023-10-17T16:26Z diff --git a/reference/accelerator.html b/reference/accelerator.html index 6e94c1a0..ad0990cf 100644 --- a/reference/accelerator.html +++ b/reference/accelerator.html @@ -99,7 +99,7 @@

Arguments -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/as_dataloader.html b/reference/as_dataloader.html index e9bfbfe2..404c070e 100644 --- a/reference/as_dataloader.html +++ b/reference/as_dataloader.html @@ -159,7 +159,7 @@

Overriding -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/context.html b/reference/context.html index 9c598532..a377b0d8 100644 --- a/reference/context.html +++ b/reference/context.html @@ -517,7 +517,7 @@

Arguments -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/ctx.html b/reference/ctx.html index fe747f6a..0e921c9b 100644 --- a/reference/ctx.html +++ b/reference/ctx.html @@ -90,7 +90,7 @@

See also diff --git a/reference/evaluate.html b/reference/evaluate.html index 9bdcad2d..9ef5c86f 100644 --- a/reference/evaluate.html +++ b/reference/evaluate.html @@ -141,12 +141,12 @@

Details

evaluation <- fitted %>% evaluate(data = valid_dl)
 metrics <- get_metrics(evaluation)
 print(evaluation)

-

## A `luz_module_evaluation`
-## -- Results ---------------------------------------------------------------------
-## loss: 1.5146
-## mae: 1.0251
-## mse: 1.5159
-## rmse: 1.2312

+

## A `luz_module_evaluation`
+## -- Results ---------------------------------------------------------------------
+## loss: 1.5146
+## mae: 1.0251
+## mse: 1.5159
+## rmse: 1.2312

See also

@@ -165,7 +165,7 @@

See also

diff --git a/reference/fit.luz_module_generator.html b/reference/fit.luz_module_generator.html index 3850f33c..885905d8 100644 --- a/reference/fit.luz_module_generator.html +++ b/reference/fit.luz_module_generator.html @@ -170,7 +170,7 @@

See also diff --git a/reference/get_metrics.html b/reference/get_metrics.html index 2add3e85..692a7bf7 100644 --- a/reference/get_metrics.html +++ b/reference/get_metrics.html @@ -103,7 +103,7 @@

Methods (by class) -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/index.html b/reference/index.html index 29fd15f7..5c6cf36f 100644 --- a/reference/index.html +++ b/reference/index.html @@ -359,7 +359,7 @@

Serialization -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/lr_finder-1.png b/reference/lr_finder-1.png index 6801c27f..2b724bd4 100644 Binary files a/reference/lr_finder-1.png and b/reference/lr_finder-1.png differ diff --git a/reference/lr_finder.html b/reference/lr_finder.html index 382b47f7..6cdb2739 100644 --- a/reference/lr_finder.html +++ b/reference/lr_finder.html @@ -146,7 +146,7 @@

Examples -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/luz_callback.html b/reference/luz_callback.html index fdcd20ed..a2d9fdae 100644 --- a/reference/luz_callback.html +++ b/reference/luz_callback.html @@ -152,41 +152,41 @@

DetailsCallbacks can be called in many different positions of the training loop, including combinations of them. Here’s an overview of possible callback breakpoints:

-

Start Fit
-   - on_fit_begin
-  Start Epoch Loop
-     - on_epoch_begin
-    Start Train
-       - on_train_begin
-      Start Batch Loop
-         - on_train_batch_begin
-          Start Default Training Step
-            - on_train_batch_after_pred
-            - on_train_batch_after_loss
-            - on_train_batch_before_backward
-            - on_train_batch_before_step
-            - on_train_batch_after_step
-          End Default Training Step:
-         - on_train_batch_end
-      End Batch Loop
-       - on_train_end
-    End Train
-    Start Valid
-       - on_valid_begin
-      Start Batch Loop
-         - on_valid_batch_begin
-          Start Default Validation Step
-            - on_valid_batch_after_pred
-            - on_valid_batch_after_loss
-          End Default Validation Step
-         - on_valid_batch_end
-      End Batch Loop
-       - on_valid_end
-    End Valid
-      - on_epoch_end
-  End Epoch Loop
-   - on_fit_end
-End Fit

+

Start Fit
+   - on_fit_begin
+  Start Epoch Loop
+     - on_epoch_begin
+    Start Train
+       - on_train_begin
+      Start Batch Loop
+         - on_train_batch_begin
+          Start Default Training Step
+            - on_train_batch_after_pred
+            - on_train_batch_after_loss
+            - on_train_batch_before_backward
+            - on_train_batch_before_step
+            - on_train_batch_after_step
+          End Default Training Step:
+         - on_train_batch_end
+      End Batch Loop
+       - on_train_end
+    End Train
+    Start Valid
+       - on_valid_begin
+      Start Batch Loop
+         - on_valid_batch_begin
+          Start Default Validation Step
+            - on_valid_batch_after_pred
+            - on_valid_batch_after_loss
+          End Default Validation Step
+         - on_valid_batch_end
+      End Batch Loop
+       - on_valid_end
+    End Valid
+      - on_epoch_end
+  End Epoch Loop
+   - on_fit_end
+End Fit

Every step market with on_* is a point in the training procedure that is available for callbacks to be called.

The other important part of callbacks is the ctx (context) object. See @@ -208,14 +208,14 @@

Prediction callbackspredict(). In this case the supported callback methods are detailed above.

-

Start predict
- - on_predict_begin
- Start prediction loop
-  - on_predict_batch_begin
-  - on_predict_batch_end
- End prediction loop
- - on_predict_end
-End predict

+

Start predict
+ - on_predict_begin
+ Start prediction loop
+  - on_predict_batch_begin
+  - on_predict_batch_end
+ End prediction loop
+ - on_predict_end
+End predict

Evaluate callbacks

@@ -224,18 +224,18 @@

Evaluate callbacksevaluate(), in this case, the callbacks that are used are equivalent to those of the validation loop when using fit():

-

Start Valid
- - on_valid_begin
- Start Batch Loop
-  - on_valid_batch_begin
-  Start Default Validation Step
-   - on_valid_batch_after_pred
-   - on_valid_batch_after_loss
-  End Default Validation Step
-  - on_valid_batch_end
- End Batch Loop
- - on_valid_end
-End Valid

+

Start Valid
+ - on_valid_begin
+ Start Batch Loop
+  - on_valid_batch_begin
+  Start Default Validation Step
+   - on_valid_batch_after_pred
+   - on_valid_batch_after_loss
+  End Default Validation Step
+  - on_valid_batch_end
+ End Batch Loop
+ - on_valid_end
+End Valid

See also

@@ -278,7 +278,7 @@

Examples -

Site built with pkgdown 2.0.7.9000.

+

Site built with pkgdown 2.0.7.

diff --git a/reference/luz_callback_auto_resume.html b/reference/luz_callback_auto_resume.html index 2013b39d..b853084c 100644 --- a/reference/luz_callback_auto_resume.html +++ b/reference/luz_callback_auto_resume.html @@ -177,16 +177,16 @@

Examples#> Caused by error in `self[[callback_nm]]()`: #> ! Error on epoch 5 #> set metric epoch value -#> 1 train loss 1 1.302326 -#> 2 train loss 2 1.141849 -#> 3 train loss 3 1.094023 -#> 4 train loss 4 1.082328 -#> 5 train loss 5 1.083923 -#> 6 train loss 6 1.072870 -#> 7 train loss 7 1.083111 -#> 8 train loss 8 1.079866 -#> 9 train loss 9 1.074621 -#> 10 train loss 10 1.075743 +#> 1 train loss 1 1.217334 +#> 2 train loss 2 1.079304 +#> 3 train loss 3 1.040630 +#> 4 train loss 4 1.027106 +#> 5 train loss 5 1.023069 +#> 6 train loss 6 1.017577 +#> 7 train loss 7 1.016829 +#> 8 train loss 8 1.020484 +#> 9 train loss 9 1.022464 +#> 10 train loss 10 1.025988