fixed model download

This commit is contained in:
root
2019-11-01 20:11:21 +00:00
parent b0a0ba5f2b
commit 2fb71d4e5c
3 changed files with 5 additions and 25 deletions
-20
View File
@@ -1,20 +0,0 @@
import os
import sys
import requests
from tqdm import tqdm
for filename in ['checkpoint','model.ckpt-417400.data-00001-of-00002', 'model.ckpt-413000.index',
'model.ckpt-417400.meta', 'model.ckpt-417400.data-00001-of-00002']:
subdir = "finetuned_model"
r = requests.get("https://storage.googleapis.com/aidungeon2model/" + subdir + "/" + filename, stream=True)
with open(os.path.join(subdir, filename), 'wb') as f:
file_size = int(r.headers["content-length"])
chunk_size = 1000
with tqdm(ncols=100, desc="Fetching " + filename, total=file_size, unit_scale=True) as pbar:
# 1k for chunk_size, since Ethernet packet size is around 1500 bytes
for chunk in r.iter_content(chunk_size=chunk_size):
f.write(chunk)
pbar.update(chunk_size)
+2 -5
View File
@@ -1,7 +1,4 @@
cd model
curl -sSL https://sdk.cloud.google.com | bash
gsutil -m cp gs://aidungeon2model/finetuned_model.tar.gz
URL="gs://aidungeon2model"
tar -xvzf finetuned_model.tar.gz
cd ..
gsutil -m cp -r "$URL" model
+3
View File
@@ -0,0 +1,3 @@
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init