No project description provided
Project description
nekograd
Fast & Flexible (just like a catgirl) deep learning framework.
All frameworks require vast manuscripts of code to be written in order to
create the simplest trainable model configuration.
We propose nekograd as a convenient way of creating such pipelines
with the least amount of code needed to be written.
Installation
pip install nekograd
or
git clone https://github.com/arseniybelkov/nekograd.git
cd nekograd && pip install -e .
Example
CoreModel inherits everything from LightningModule
and just implements it basic methods so you don't have to.
import torch
import torch.nn as nn
import pytorch_lightning as pl
from nekograd.model import CoreModel
from nekograd.model.policy import Multiply
from sklearn.metrics import accuracy_score
# Simplest use case, which covers many DL tasks.
# You just define architecture, loss function, metrics,
# optimizer and lr_scheduler.
architecture: nn.Module = nn.Sequential(nn.Flatten(), nn.Linear(28 * 28, 10))
criterion: Callable = nn.CrossEntropyLoss()
metrics: Dict[str, Callable] = {"accuracy": accuracy_score}
optimizer = torch.optim.Adam(architecture.parameters())
lr_scheduler = torch.optim.lr_scheduler.LambdaLR(optimizer,
Multiply({10: 0.1}))
model = CoreModel(architecture, criterion, metrics,
optimizer=optimizer, lr_scheduler=lr_scheduler)
device = "gpu" if torch.cuda.is_available() else "cpu"
trainer = pl.Trainer(max_epochs=20, accelerator=device)
trainer.fit(model, datamodule=...)
trainer.test(model, datamodule=...)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nekograd-0.2.0.tar.gz.
File metadata
- Download URL: nekograd-0.2.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f401b40da542cd0889364b18c73edc479e916cb6fd73ae376ec1a27a54110286
|
|
| MD5 |
887fc94d69a648bed2ad066cb81da882
|
|
| BLAKE2b-256 |
372ad2f6bce1a0068fa2a9f531b82ec0e64484675c7ce4e0ea2b55a341aecc40
|
File details
Details for the file nekograd-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nekograd-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aa8c2b39e74edbfe140f2625b2307fb7a6efc8f8ccfab8276de89901eb2f569
|
|
| MD5 |
5233a23603a473bc89218ae4f35ec149
|
|
| BLAKE2b-256 |
c7a8c16386564b3e4df4fbc2661bd3b2f73b19b30aea25875d34c0186a2d2848
|