Skip to content

Commit dda09d6

Browse files
feat(examples): added torch.compile to examples of pytorch and local
Signed-off-by: Ishtiyaque-Alam <[email protected]>
1 parent 0f80b33 commit dda09d6

File tree

3 files changed

+68
-478
lines changed

3 files changed

+68
-478
lines changed

examples/local/local-container-mnist.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
{
5454
"cell_type": "code",
55-
"execution_count": 1,
55+
"execution_count": null,
5656
"id": "train-function",
5757
"metadata": {},
5858
"outputs": [],
@@ -102,7 +102,9 @@
102102
"\n",
103103
" # Create the model and load it into the device.\n",
104104
" device = torch.device(f\"{device}:{local_rank}\")\n",
105-
" model = nn.parallel.DistributedDataParallel(Net().to(device))\n",
105+
" model=Net().to(device)\n",
106+
" model=torch.compile(model)\n",
107+
" model = nn.parallel.DistributedDataParallel(model)\n",
106108
" optimizer = optim.SGD(model.parameters(), lr=0.01, momentum=0.5)\n",
107109
"\n",
108110
" # Download FashionMNIST dataset only on local_rank=0 process.\n",

0 commit comments

Comments
 (0)