|
|
|
@ -459,10 +459,13 @@ |
|
|
|
|
"id": "InstallDeps" |
|
|
|
|
}, |
|
|
|
|
"source": [ |
|
|
|
|
"#@title ### 1.3 Install and import dependencies\n", |
|
|
|
|
"#@title ### 1.3 Install, import dependencies and set up runtime devices\n", |
|
|
|
|
"\n", |
|
|
|
|
"import pathlib, shutil, os, sys\n", |
|
|
|
|
"\n", |
|
|
|
|
"#@markdown Check this if you want to use CPU\n", |
|
|
|
|
"useCPU = False #@param {type:\"boolean\"}\n", |
|
|
|
|
"\n", |
|
|
|
|
"if not is_colab:\n", |
|
|
|
|
" # If running locally, there's a good chance your env will need this in order to not crash upon np.matmul() or similar operations.\n", |
|
|
|
|
" os.environ['KMP_DUPLICATE_LIB_OK']='TRUE'\n", |
|
|
|
@ -597,7 +600,8 @@ |
|
|
|
|
"print('Using device:', DEVICE)\n", |
|
|
|
|
"device = DEVICE # At least one of the modules expects this name..\n", |
|
|
|
|
"\n", |
|
|
|
|
"if torch.cuda.get_device_capability(DEVICE) == (8,0): ## A100 fix thanks to Emad\n", |
|
|
|
|
"if not useCPU:\n", |
|
|
|
|
" if torch.cuda.get_device_capability(DEVICE) == (8,0): ## A100 fix thanks to Emad\n", |
|
|
|
|
" print('Disabling CUDNN for A100 gpu', file=sys.stderr)\n", |
|
|
|
|
" torch.backends.cudnn.enabled = False" |
|
|
|
|
], |
|
|
|
@ -1864,7 +1868,7 @@ |
|
|
|
|
" 'num_res_blocks': 2,\n", |
|
|
|
|
" 'resblock_updown': True,\n", |
|
|
|
|
" 'use_checkpoint': use_checkpoint,\n", |
|
|
|
|
" 'use_fp16': True,\n", |
|
|
|
|
" 'use_fp16': not useCPU,\n", |
|
|
|
|
" 'use_scale_shift_norm': True,\n", |
|
|
|
|
" })\n", |
|
|
|
|
"elif diffusion_model == '256x256_diffusion_uncond':\n", |
|
|
|
@ -1882,7 +1886,7 @@ |
|
|
|
|
" 'num_res_blocks': 2,\n", |
|
|
|
|
" 'resblock_updown': True,\n", |
|
|
|
|
" 'use_checkpoint': use_checkpoint,\n", |
|
|
|
|
" 'use_fp16': True,\n", |
|
|
|
|
" 'use_fp16': not useCPU,\n", |
|
|
|
|
" 'use_scale_shift_norm': True,\n", |
|
|
|
|
" })\n", |
|
|
|
|
"\n", |
|
|
|
|