Skip to content

Instantly share code, notes, and snippets.

@nanguoyu
Last active November 5, 2024 13:42
Show Gist options
  • Save nanguoyu/48eef102b73575fc3ba455e1a2063873 to your computer and use it in GitHub Desktop.
Save nanguoyu/48eef102b73575fc3ba455e1a2063873 to your computer and use it in GitHub Desktop.
weigt and bias
import wandb
model_profile_str = f'{args.model}_{args.wider_factor}Xwider_{args.dataset}'
wandb_proiject_name = "model folding"
experiment_name = f"train_{model_profile_str}"
run = wandb.init(project=wandb_proiject_name, name=experiment_name, entity="naguoyu",
config={"dataset":args.dataset},
)
for epoch in range(epochs):
train_acc, train_loss = train(train_loader, model, criterion, optimizer, epoch, device=device)
scheduler.step()
test_acc, test_loss = test(test_loader, model, criterion, epoch, device=device)
run.log({"train/acc": train_acc, "train/loss": train_loss, "test/acc": test_acc, "test/loss": test_loss})
test_acc = test(test_loader, model, criterion, epoch, device=device)
print(f'Test accuracy: {test_acc}')
print('\n')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment