wandb demo

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()

你可能感兴趣的:(python,深度学习,人工智能,pytorch)