Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions MONAICore/3. End-To-End Workflow with MONAI - Solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@
" print(f\"epoch {epoch + 1}/{epoch_num}\")\n",
"\n",
" epoch_loss = 0\n",
" step = 1\n",
" step = 0\n",
" total_items = 0\n",
"\n",
" steps_per_epoch = len(train_ds) // train_loader.batch_size\n",
"\n",
Expand Down Expand Up @@ -478,11 +479,12 @@
" # and its internal optimisation strategy\n",
" optimizer.step()\n",
"\n",
" epoch_loss += loss.item()\n",
" print(f\"{step}/{len(train_ds) // train_loader.batch_size + 1}, training_loss: {loss.item():.4f}\")\n",
" epoch_loss += loss.item() * outputs.shape[0]\n",
" total_items += outputs.shape[0]\n",
" print(f\"{step + 1}/{len(train_ds) // train_loader.batch_size + 1}, training_loss: {loss.item():.4f}\")\n",
" step += 1\n",
"\n",
" epoch_loss /= step\n",
" epoch_loss /= total_items\n",
" epoch_loss_values.append(epoch_loss)\n",
" print(f\"epoch {epoch + 1} average loss: {epoch_loss:.4f}\")\n",
"\n",
Expand Down
10 changes: 6 additions & 4 deletions MONAICore/3. End-To-End Workflow with MONAI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@
" print(f\"epoch {epoch + 1}/{epoch_num}\")\n",
"\n",
" epoch_loss = 0\n",
" step = 1\n",
" step = 0\n",
" total_items = 0\n",
"\n",
" steps_per_epoch = len(train_ds) // train_loader.batch_size\n",
"\n",
Expand Down Expand Up @@ -478,11 +479,12 @@
" # and its internal optimisation strategy\n",
" optimizer.step()\n",
"\n",
" epoch_loss += loss.item()\n",
" print(f\"{step}/{len(train_ds) // train_loader.batch_size + 1}, training_loss: {loss.item():.4f}\")\n",
" epoch_loss += loss.item() * outputs.shape[0]\n",
" total_items += outputs.shape[0]\n",
" print(f\"{step + 1}/{len(train_ds) // train_loader.batch_size + 1}, training_loss: {loss.item():.4f}\")\n",
" step += 1\n",
"\n",
" epoch_loss /= step\n",
" epoch_loss /= total_items\n",
" epoch_loss_values.append(epoch_loss)\n",
" print(f\"epoch {epoch + 1} average loss: {epoch_loss:.4f}\")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@
"source": [
"## MONAI Bundle\n",
"\n",
"The objective of the MONAI bundle is to define a packaged model which includes the critical information necessary to allow users and programs to understand how the model is used and what purpose it is for. A bundle includes the stored weights of a single network as a pickled state dictionary plus optionally a Torchscript object and/or an ONNX object. Additional JSON files are included to store metadata about the model, information for constructing training, inference, and post-processing transform sequences, plain-text description, legal information, and other data the model creator wishes to include."
"MONAI bundles define a packaged model which includes the critical information necessary to allow users and programs to understand how the model is used and what purpose it is for. \n",
"\n",
"* Stored weights of a single network as a pickled state dictionary are included, plus optional Torchscript and/or ONNX object. \n",
"\n",
"* Additional JSON files store metadata about the model, information for constructing training, inference, and post-processing transform sequences, plain-text description, legal information, and other data the model creator wishes to include."
]
},
{
Expand Down Expand Up @@ -210,7 +214,7 @@
}
},
"source": [
"or alternatively, in `YAML` format (`demo_config.yaml`):\n",
"Alternatively, in `YAML` format (`demo_config.yaml`):\n",
"\n",
"```yaml\n",
"demo_net:\n",
Expand Down