Skip to content

Commit 8d5eb16

Browse files
committed
fix ci
Signed-off-by: YunLiu <[email protected]>
1 parent 6ec3a0a commit 8d5eb16

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

generation/image_to_image_translation/tutorial_segmentation_with_ddpm.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
" seg = data_val[\"label\"].to(device) # this is the ground truth segmentation\n",
394394
" timesteps = torch.randint(0, 1000, (len(images),)).to(device)\n",
395395
" with torch.no_grad():\n",
396-
" with autocast(enabled=True):\n",
396+
" with autocast(\"cuda\", enabled=True):\n",
397397
" noise = torch.randn_like(seg).to(device)\n",
398398
" noisy_seg = scheduler.add_noise(original_samples=seg, noise=noise, timesteps=timesteps)\n",
399399
" combined = torch.cat((images, noisy_seg), dim=1)\n",

modules/interpretability/cats_and_dogs.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
" for data in dl:\n",
318318
" inputs, labels = data[\"image\"].to(device), data[\"label\"].to(device)\n",
319319
" optimizer.zero_grad()\n",
320-
" with torch.autocast(\"cuda\", enabled=use_amp):\n",
320+
" with torch.autocast(\"cuda\", enabled=use_amp) if use_amp else nullcontext():\n",
321321
" outputs = model(inputs)\n",
322322
" train_loss = criterion(outputs, labels)\n",
323323
" acc += get_num_correct(outputs, labels)\n",
@@ -350,7 +350,7 @@
350350
"\n",
351351
" for data in tqdm(dl):\n",
352352
" images, labels = data[\"image\"].to(device), data[\"label\"].to(device)\n",
353-
" with torch.autocast(\"cuda\", enabled=use_amp):\n",
353+
" with torch.autocast(\"cuda\", enabled=use_amp) if use_amp else nullcontext():\n",
354354
" outputs = model(images).detach()\n",
355355
" y_pred = torch.cat([y_pred, outputs], dim=0)\n",
356356
" y = torch.cat([y, labels], dim=0)\n",

0 commit comments

Comments
 (0)