k1lib.schedule module

This essentially allows you to construct schedules intuitive and fast. Let's get into it:

A schedule is just a function with domain [0, 1] (input range of values). You can create anything you want like this:

You can still call the function like before:

There are several built-in schedules to help you out:

You can also combine them together, like this:

You can also combine them asymmetrically, like this:

Crazy ones like this works too!

ParamScheduler

You can also change a parameter inside a network while it's training according to a schedule. Here, the network is just trying to fit data for the function $x^2$:

Here is vanilla version, without changing optimizer's learning rate:

Let's define our lr schedule:

Note how here, we've added the term "lr" at the end of schedule.hump, to signify that this is a schedule for the "lr" hyperparameter. Let's train it:

Here, notice how we pass * to withParamScheduler(). This tells us that we want to apply the scheduling on the entire network.

And as you can see, it trains much quicker, and the resulting graph looks smoother than before! Let's try apply the schedule to the first layer only:

Loss seems to go down not as fast as the 2nd network. Nevertheless, this demonstrates how we can schedule parts of the network only.