Apply missed disco.py changes for import changes to .ipynb

pull/30/head
Adam Letts 3 years ago
parent 4acb77c2e6
commit a3e0d1f6b4
  1. 10
      Disco_Diffusion.ipynb

@ -444,8 +444,6 @@
"id": "InstallDeps" "id": "InstallDeps"
}, },
"source": [ "source": [
"#@title ### 1.3 Install and import dependencies\n",
"\n",
"import pathlib, shutil, os, sys\n", "import pathlib, shutil, os, sys\n",
"\n", "\n",
"if not is_colab:\n", "if not is_colab:\n",
@ -474,11 +472,11 @@
" subprocess.run(['apt', 'install', 'imagemagick'], stdout=subprocess.PIPE).stdout.decode('utf-8')\n", " subprocess.run(['apt', 'install', 'imagemagick'], stdout=subprocess.PIPE).stdout.decode('utf-8')\n",
"\n", "\n",
"try:\n", "try:\n",
" import clip\n", " import CLIP\n",
"except:\n", "except:\n",
" if os.path.exists(\"CLIP\") is not True:\n", " if os.path.exists(\"CLIP\") is not True:\n",
" gitclone(\"https://github.com/openai/CLIP\")\n", " gitclone(\"https://github.com/openai/CLIP\")\n",
" sys.path.append(f'{root_path}/CLIP')\n", " sys.path.append(f'{PROJECT_DIR}/CLIP')\n",
"\n", "\n",
"try:\n", "try:\n",
" from guided_diffusion.script_util import create_model_and_diffusion\n", " from guided_diffusion.script_util import create_model_and_diffusion\n",
@ -544,7 +542,7 @@
"import torchvision.transforms as T\n", "import torchvision.transforms as T\n",
"import torchvision.transforms.functional as TF\n", "import torchvision.transforms.functional as TF\n",
"from tqdm.notebook import tqdm\n", "from tqdm.notebook import tqdm\n",
"import clip\n", "import CLIP\n",
"from resize_right import resize\n", "from resize_right import resize\n",
"from guided_diffusion.script_util import create_model_and_diffusion, model_and_diffusion_defaults\n", "from guided_diffusion.script_util import create_model_and_diffusion, model_and_diffusion_defaults\n",
"from datetime import datetime\n", "from datetime import datetime\n",
@ -575,7 +573,7 @@
" except:\n", " except:\n",
" if os.path.exists(\"AdaBins\") is not True:\n", " if os.path.exists(\"AdaBins\") is not True:\n",
" gitclone(\"https://github.com/shariqfarooq123/AdaBins.git\")\n", " gitclone(\"https://github.com/shariqfarooq123/AdaBins.git\")\n",
" if not path_exists(f'{model_path}/pretrained/AdaBins_nyu.pt'):\n", " if not os.path.exists(f'{model_path}/pretrained/AdaBins_nyu.pt'):\n",
" os.makedirs(f'{model_path}/pretrained')\n", " os.makedirs(f'{model_path}/pretrained')\n",
" wget(\"https://cloudflare-ipfs.com/ipfs/Qmd2mMnDLWePKmgfS8m6ntAg4nhV5VkUyAydYBp8cWWeB7/AdaBins_nyu.pt\", f'{model_path}/pretrained')\n", " wget(\"https://cloudflare-ipfs.com/ipfs/Qmd2mMnDLWePKmgfS8m6ntAg4nhV5VkUyAydYBp8cWWeB7/AdaBins_nyu.pt\", f'{model_path}/pretrained')\n",
" sys.path.append(f'{os.getcwd()}/AdaBins')\n", " sys.path.append(f'{os.getcwd()}/AdaBins')\n",

Loading…
Cancel
Save