Enchanter is a library for machine learning tasks for comet.ml users.
Project description
Enchanter
Enchanter is a library for machine learning tasks for comet.ml users.
Installation
pip install enchanter
or
pip install git+https://github.com/khirotaka/enchanter.git
Documentation
Getting Started
Try your first Enchanter Program
Training Neural Network
from comet_ml import Experiment
import torch
import enchanter
model = torch.nn.Linear(6, 10)
optimizer = torch.optim.Adam(model.parameters())
runner = enchanter.wrappers.ClassificationRunner(
model,
optimizer,
criterion=torch.nn.CrossEntropyLoss(),
experiment=Experiment()
)
runner.add_loader("train", train_loader)
runner.train_config(epochs=10)
runner.run()
Hyper parameter searching using Comet.ml
from comet_ml import Optimizer
import torch
import torch.nn as nn
import torch.optim as optim
from sklearn.datasets import load_iris
import enchanter.wrappers as wrappers
import enchanter.addons as addons
import enchanter.addons.layers as layers
from enchanter.utils import comet
config = comet.TunerConfigGenerator(
algorithm="bayes",
metric="train_avg_loss",
objective="minimize",
seed=0,
trials=5
)
config.suggest_categorical("activation", ["addons.mish", "torch.relu", "torch.sigmoid"])
opt = Optimizer(config.generate())
x, y = load_iris(return_X_y=True)
x = x.astype("float32")
y = y.astype("int64")
for experiment in opt.get_experiments():
model = layers.MLP([4, 512, 128, 3], eval(experiment.get_parameter("activation")))
optimizer = optim.Adam(model.parameters())
runner = wrappers.ClassificationRunner(
model, optimizer=optimizer, criterion=nn.CrossEntropyLoss(), experiment=experiment
)
runner.fit(x, y, epochs=1, batch_size=32)
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
enchanter-0.5.1rc2.tar.gz
(23.5 kB
view details)
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 enchanter-0.5.1rc2.tar.gz.
File metadata
- Download URL: enchanter-0.5.1rc2.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b74162487c2f3d431fe2d67d8c41ea3a107489480de6ceeb1188986af617fce8
|
|
| MD5 |
5453635aea986056e72f35a7fe3fbf2e
|
|
| BLAKE2b-256 |
dbaa96f978184600f2ebb7f7e7e7bb8547d4bdeaa647a3de056cad637ced05af
|
File details
Details for the file enchanter-0.5.1rc2-py3-none-any.whl.
File metadata
- Download URL: enchanter-0.5.1rc2-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a96e7f7c577f821bca39866c99f8c746209c5665cab4b41b4f272522db057fde
|
|
| MD5 |
d9afd404df6abc02eed32ba67897d75e
|
|
| BLAKE2b-256 |
32fc232c1f5d23177fccab582a38143e64085babb6e2c1ce508fea73bcff14e3
|