Skip to content

Instantly share code, notes, and snippets.

@neelindresh
Created July 18, 2022 14:58
Show Gist options
  • Save neelindresh/35cb0836c650e384edd62623cb5a6670 to your computer and use it in GitHub Desktop.
Save neelindresh/35cb0836c650e384edd62623cb5a6670 to your computer and use it in GitHub Desktop.
with mlp.run():
mlp.register_artifact("churndata.csv",df)
mlp.log_params({
"lr":0.01,
"optimizer":"SGD",
"loss_fuction":"BCEloss"
})
for epoch in range(epochs):
loss_batch=0
for batch in range(1000,5000,1000):
optimizer.zero_grad()
train_data=train_x[batch-1000:batch]
output=model(train_data)
loss=criterion(output,train_y[batch-1000:batch].unsqueeze(1))
loss.backward()
optimizer.step()
loss_batch+=loss.item()
metrics=validate(model,test_x,test_y)
metrics["loss"]=loss_batch
metrics["epoch"]=epoch
mlp.log_metrics_continious(metrics)
mlp.pytorch.register_model("pytorch_example1", model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment