You can use Weights & Biases with Skorch to automatically log the model with the best performance – along with all model performance metrics, the model topology and compute resources after each epoch. Every file saved in wandb_run.dir is automatically logged to W&B servers.
See example run.
Parameter | Description |
wandb_run: wandb.wandb_run.Run | wandb run used to log data. |
save_model bool (default=True) | Whether to save a checkpoint of the best model and upload it to your Run on W&B servers. |
keys_ignored str or list of str (default=None) | Key or list of keys that should not be logged to tensorboard. Note that in addition to the keys provided by the user, keys such as those starting with ‘event_’ or ending on ‘_best’ are ignored by default. |
We've created a few examples for you to see how the integration works:
Colab: A simple demo to try the integration
A step by step guide: to tracking your Skorch model performance
# Install wandb... pip install wandbimport wandbfrom skorch.callbacks import WandbLogger# Create a wandb Runwandb_run = wandb.init()# Alternative: Create a wandb Run without a W&B accountwandb_run = wandb.init(anonymous="allow")# Log hyper-parameters (optional)wandb_run.config.update({"learning rate": 1e-3, "batch size": 32})net = NeuralNet(..., callbacks=[WandbLogger(wandb_run)])net.fit(X, y)
Method | Description |
| (Re-)Set the initial state of the callback. |
| Called at the beginning of each batch. |
| Called at the end of each batch. |
| Called at the beginning of each epoch. |
| Log values from the last history step and save best model |
| Called once per batch after gradients have been computed but before an update step was performed. |
| Log model topology and add a hook for gradients |
| Called at the end of training. |