From 19f691d3426894215f4d7b0287072a2a2b39c432 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Fri, 2 Mar 2018 10:27:16 -0800 Subject: [PATCH 1/2] Use `cache.julialang.org` to store ML models It's annoying that when third party servers go down our tests break. Let's at least make sure that if our tests break due to server outages it's our fault. --- src/data/cmudict.jl | 2 +- src/data/mnist.jl | 2 +- src/data/sentiment.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/cmudict.jl b/src/data/cmudict.jl index 4307f211..33ad45fa 100644 --- a/src/data/cmudict.jl +++ b/src/data/cmudict.jl @@ -10,7 +10,7 @@ function load() isdir(deps("cmudict")) && return mkpath(deps("cmudict")) for x in ["", ".phones", ".symbols"] - download("http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-$version$x", + download("https://cache.julialang.org/http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-$version$x", deps("cmudict", "cmudict$x")) end end diff --git a/src/data/mnist.jl b/src/data/mnist.jl index d4c733ce..132bf219 100644 --- a/src/data/mnist.jl +++ b/src/data/mnist.jl @@ -14,7 +14,7 @@ function load() "t10k-images-idx3-ubyte", "t10k-labels-idx1-ubyte"] isfile(file) && continue - download("http://yann.lecun.com/exdb/mnist/$file.gz", "$file.gz") + download("https://cache.julialang.org/http://yann.lecun.com/exdb/mnist/$file.gz", "$file.gz") open(file, "w") do io write(io, GZip.open(read, "$file.gz")) end diff --git a/src/data/sentiment.jl b/src/data/sentiment.jl index f471e628..ae9f9261 100644 --- a/src/data/sentiment.jl +++ b/src/data/sentiment.jl @@ -5,7 +5,7 @@ using ..Data: deps function load() isfile(deps("sentiment.zip")) || - download("https://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip", + download("https://cache.julialang.org/https://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip", deps("sentiment.zip")) return end From 6445295318938501dfd9fe57438e17ec70c69a52 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Tue, 6 Mar 2018 08:29:44 -0800 Subject: [PATCH 2/2] Better download detection --- src/data/cmudict.jl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/data/cmudict.jl b/src/data/cmudict.jl index 33ad45fa..3ac47ef1 100644 --- a/src/data/cmudict.jl +++ b/src/data/cmudict.jl @@ -5,13 +5,18 @@ export cmudict using ..Data: deps const version = "0.7b" +const cache_prefix = "https://cache.julialang.org" function load() - isdir(deps("cmudict")) && return + suffixes = ["", ".phones", ".symbols"] + if isdir(deps("cmudict")) + if all(isfile.(["cmudict$x" for x in suffixes])) + return + end + end mkpath(deps("cmudict")) - for x in ["", ".phones", ".symbols"] - download("https://cache.julialang.org/http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-$version$x", - deps("cmudict", "cmudict$x")) + for x in suffixes + download("$cache_prefix/http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-$version$x", deps("cmudict", "cmudict$x")) end end