AutoLoss
AutoLoss is an optimizer that uses Artificial Intelligence to optimize your neural networks as well as possible.
Usage
First, import the package and other dependencies:
from autoloss import *
import torch
import torch.nn as nn
Then, create your AI Model. For the sake of simplicity, let's just name it model for this example.
Next, initialize a loss function. For this example, we'll use CrossEntropyLoss:
loss_fn = nn.CrossEntropyLoss()
Afterwards, create an instance of the AutoLoss optimizer
optimizer = AutoLoss(model, loss_fn, patience=25)
Note: For more advanced details on the patience argument, check Internal Functioning.
Now, to train the model, just call optimizer.step(x, target), where x is the input data and target is the expected output data.
Internal Functioning
- AutoLoss uses its own AI model to predict what parameters would work best for your neural network, therefore constantly getting better at predicting better parameters and training your AI better.
- If AutoLoss's AI can not find any better parameters, it switches to SGD (Stochastic Gradient Descent).
- The amount of tries AutoLoss's AI has at finding better parameters until it switches to SGD is equal to the
patienceparameter from earlier.
Metadata
Release files for autoloss 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autoloss-1.1.0.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autoloss-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / autoloss-1.1.0.tar.gz
| Download URL | autoloss-1.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3c3b9d96c4acc8deb86da70bd84c714fa431b61cf3e9cf45e08e1016aaaa81c
|
|
BLAKE2b-256 checksum How to use checksums |
cdb9e1bce7ebccad633379852810c39e7b45ab2f296bc0c9cc5c48cb9ac5f0f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Windows/11
|
Release files / autoloss-1.1.0-py3-none-any.whl
| Download URL | autoloss-1.1.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be8740e2fcf3ad9103515187beb6dcc589538643c28a198a007f22ca8eb95038
|
|
BLAKE2b-256 checksum How to use checksums |
254425ef55d822d0107bafc723643419244887d11abf826d06b52de19ed4738f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Windows/11
|