import wandb
import random
class test:
def __init__(self, team, proj, name):
self.run = wandb.init(entity=team, project=proj,name=name)
def config(self):
config={
"learning_rate": 0.02,
"architecture": "CNN",
"dataset": "CIFAR-100",
"epochs": 10,
}
self.run.config.update(config)
def train(self):
# simulate training
epochs = 10
offset = random.random() / 5
for epoch in range(2, epochs):
acc = 1 - 2 ** -epoch - random.random() / epoch - offset
loss = 2 ** -epoch + random.random() / epoch + offset
# log metrics to wandb
self.run.log({"acc": acc, "loss": loss})
# [optional] finish the wandb run, necessary in notebooks
self.run.finish()
a = test("wandb_practice", "kitti_train_test", "2")
a.config()
a.train()
wandb demo
最新推荐文章于 2024-08-23 16:53:34 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)