Skip to content

Commit

Permalink
faster download in colab
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEMUSHKA committed Aug 4, 2018
1 parent 3c78b6f commit 7abcafc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion download_resources.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"download_utils.download_all_keras_resources()"
"download_utils.download_all_keras_resources(\"readonly/keras/models\", \"readonly/keras/datasets\")"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def link_all_files_from_dir(src_dir, dst_dir):
os.symlink(os.path.abspath(src_file), dst_file)


def download_all_keras_resources():
def download_all_keras_resources(keras_models, keras_datasets):
# Originals:
# http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz
# https://github.com/fchollet/deep-learning-models/releases/download/v0.5/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5
Expand All @@ -100,15 +100,15 @@ def download_all_keras_resources():
[
"inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5"
],
"readonly/keras/models"
keras_models
)
sequential_downloader(
"v0.2",
[
"cifar-10-batches-py.tar.gz",
"mnist.npz"
],
"readonly/keras/datasets"
keras_datasets
)


Expand Down
15 changes: 12 additions & 3 deletions setup_google_colab.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,23 @@ def setup_week2():
download_github_code("week2/submit.py")
download_github_code("week2/util.py")
download_github_code("week2/validation_predictons.txt")
setup_keras()


def setup_week2_v2():
setup_common()
download_github_code("week2/v2/grading_utils.py")
download_github_code("week2/v2/matplotlib_utils.py")
download_github_code("week2/v2/preprocessed_mnist.py")
setup_keras()


def setup_week3():
setup_common()
download_github_code("week3/grading_utils.py")
import download_utils
download_utils.download_week_3_resources(".")
download_utils.download_week_3_resources("../readonly/week3")
setup_keras()


def setup_week4():
Expand All @@ -52,7 +55,7 @@ def setup_week4():
download_github_code("week4/submit.py")
download_github_code("week4/submit_honor.py")
import download_utils
download_utils.download_week_4_resources(".")
download_utils.download_week_4_resources("../readonly/week4")


def setup_week5():
Expand All @@ -68,4 +71,10 @@ def setup_week6():
download_github_code("week6/grading_utils.py")
download_github_code("week6/utils.py")
import download_utils
download_utils.download_week_6_resources(".")
download_utils.download_week_6_resources("../readonly/week6")
setup_keras()


def setup_keras():
import download_utils
download_utils.download_all_keras_resources("../readonly/keras/models", "../readonly/keras/datasets")

0 comments on commit 7abcafc

Please sign in to comment.