Skip to content

Commit

Permalink
Merge pull request #531 from graphemecluster/checkpoints
Browse files Browse the repository at this point in the history
Fix Checkpoints Location
  • Loading branch information
AliaksandrSiarohin committed Dec 8, 2022
2 parents 83b8692 + 0fa13f7 commit 3d152de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"from shutil import copyfileobj\n",
"from skimage import img_as_ubyte\n",
"from tempfile import NamedTemporaryFile\n",
"from tqdm.auto import tqdm\n",
"warnings.filterwarnings(\"ignore\")\n",
"os.makedirs(\"user\", exist_ok=True)\n",
"\n",
Expand Down Expand Up @@ -467,9 +468,12 @@
"\tloading.layout.display = ''\n",
"\tfilename = model.value + ('' if model.value == 'fashion' else '-cpk') + '.pth.tar'\n",
"\tif not os.path.isfile(filename):\n",
"\t\tdownload = requests.get(requests.get('https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key=https://yadi.sk/d/lEw8uRm140L_eQ&path=/' + filename).json().get('href'))\n",
"\t\twith open(filename, 'wb') as checkpoint:\n",
"\t\t\tcheckpoint.write(download.content)\n",
"\t\tresponse = requests.get('https://github.com/graphemecluster/first-order-model-demo/releases/download/checkpoints/' + filename, stream=True)\n",
"\t\twith progress_bar:\n",
"\t\t\twith tqdm.wrapattr(response.raw, 'read', total=int(response.headers.get('Content-Length', 0)), unit='B', unit_scale=True, unit_divisor=1024) as raw:\n",
"\t\t\t\twith open(filename, 'wb') as file:\n",
"\t\t\t\t\tcopyfileobj(raw, file)\n",
"\t\tprogress_bar.clear_output()\n",
"\treader = imageio.get_reader(selected_video, mode='I', format='FFMPEG')\n",
"\tfps = reader.get_meta_data()['fps']\n",
"\tdriving_video = []\n",
Expand Down

0 comments on commit 3d152de

Please sign in to comment.