diff --git a/Disco_Diffusion.ipynb b/Disco_Diffusion.ipynb index 7e35c64..c0a455b 100644 --- a/Disco_Diffusion.ipynb +++ b/Disco_Diffusion.ipynb @@ -1102,9 +1102,7 @@ " skip_steps = args.calc_frames_skip_steps\n", "\n", " if args.animation_mode == \"3D\":\n", - " if frame_num == 0:\n", - " pass\n", - " else:\n", + " if frame_num > 0:\n", " seed += 1 \n", " if resume_run and frame_num == start_frame:\n", " img_filepath = batchFolder+f\"/{batch_name}({batchNum})_{start_frame-1:04}.png\"\n", @@ -1409,7 +1407,7 @@ " image.save(f'{batchFolder}/{filename}')\n", " if args.animation_mode == \"3D\":\n", " # If turbo, save a blended image\n", - " if turbo_mode:\n", + " if turbo_mode and frame_num > 0:\n", " # Mix new image with prevFrameScaled\n", " blend_factor = (1)/int(turbo_steps)\n", " newFrame = cv2.imread('prevFrame.png') # This is already updated..\n", @@ -1820,15 +1818,14 @@ " 'use_scale_shift_norm': True,\n", " })\n", "\n", - "secondary_model_ver = 2\n", "model_default = model_config['image_size']\n", "\n", "\n", "\n", - "if secondary_model_ver == 2:\n", + "if use_secondary_model:\n", " secondary_model = SecondaryDiffusionImageNet2()\n", " secondary_model.load_state_dict(torch.load(f'{model_path}/secondary_model_imagenet_2.pth', map_location='cpu'))\n", - "secondary_model.eval().requires_grad_(False).to(device)\n", + " secondary_model.eval().requires_grad_(False).to(device)\n", "\n", "clip_models = []\n", "if ViTB32 is True: clip_models.append(clip.load('ViT-B/32', jit=False)[0].eval().requires_grad_(False).to(device)) \n", @@ -2688,4 +2685,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/disco.py b/disco.py index 31e6115..d25daed 100644 --- a/disco.py +++ b/disco.py @@ -1066,9 +1066,7 @@ def do_run(): skip_steps = args.calc_frames_skip_steps if args.animation_mode == "3D": - if frame_num == 0: - pass - else: + if frame_num > 0: seed += 1 if resume_run and frame_num == start_frame: img_filepath = batchFolder+f"/{batch_name}({batchNum})_{start_frame-1:04}.png" @@ -1373,7 +1371,7 @@ def do_run(): image.save(f'{batchFolder}/{filename}') if args.animation_mode == "3D": # If turbo, save a blended image - if turbo_mode: + if turbo_mode and frame_num > 0: # Mix new image with prevFrameScaled blend_factor = (1)/int(turbo_steps) newFrame = cv2.imread('prevFrame.png') # This is already updated.. @@ -1774,15 +1772,14 @@ elif diffusion_model == '256x256_diffusion_uncond': 'use_scale_shift_norm': True, }) -secondary_model_ver = 2 model_default = model_config['image_size'] -if secondary_model_ver == 2: +if use_secondary_model: secondary_model = SecondaryDiffusionImageNet2() secondary_model.load_state_dict(torch.load(f'{model_path}/secondary_model_imagenet_2.pth', map_location='cpu')) -secondary_model.eval().requires_grad_(False).to(device) + secondary_model.eval().requires_grad_(False).to(device) clip_models = [] if ViTB32 is True: clip_models.append(clip.load('ViT-B/32', jit=False)[0].eval().requires_grad_(False).to(device))