Skip to content

Commit

Permalink
Update wandb101
Browse files Browse the repository at this point in the history
  • Loading branch information
scottire committed Apr 4, 2023
1 parent 156c828 commit 4799ae0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ models/
artifact/
artifacts/
model-dev-course/lesson1/artifacts/
wandb101/cifar_net.pth
wandb101/data/
*.csv
*.json
*.png
Expand Down
35 changes: 14 additions & 21 deletions wandb101/get_started.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "7ff28cc7",
"metadata": {},
"outputs": [],
"source": [
"!pip install -r requirements.txt"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -29,7 +39,7 @@
" def forward(self, x):\n",
" x = self.pool(F.relu(self.conv1(x)))\n",
" x = self.pool(F.relu(self.conv2(x)))\n",
" x = torch.flatten(x, 1) # flatten all dimensions except batch\n",
" x = torch.flatten(x, 1)\n",
" x = F.relu(self.fc1(x))\n",
" x = F.relu(self.fc2(x))\n",
" x = self.fc3(x)\n",
Expand Down Expand Up @@ -62,23 +72,6 @@
" torch.save(model.state_dict(), path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "97235635-8d62-4c04-94a5-9b86e344ed23",
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true,
"source_hidden": true
},
"tags": []
},
"outputs": [],
"source": [
"!pip install wandb"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -125,8 +118,8 @@
" \n",
" # train model\n",
" for epoch in range(config.epochs): \n",
" for i, data in enumerate(data, 0):\n",
" loss = update_model(data, model, criterion, optimizer)\n",
" for i, batch in enumerate(data, 0):\n",
" loss = update_model(batch, model, criterion, optimizer)\n",
" \n",
" # log results\n",
" wandb.log({'epoch': epoch, 'loss': loss})\n",
Expand All @@ -153,7 +146,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.9.16"
}
},
"nbformat": 4,
Expand Down
4 changes: 4 additions & 0 deletions wandb101/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
torch>=1.9
torchvision
wandb

0 comments on commit 4799ae0

Please sign in to comment.