diff --git a/contrib/clojure-package/examples/rnn/src/rnn/test_char_rnn.clj b/contrib/clojure-package/examples/rnn/src/rnn/test_char_rnn.clj index d03b1a6b36e4..22a2982f222b 100644 --- a/contrib/clojure-package/examples/rnn/src/rnn/test_char_rnn.clj +++ b/contrib/clojure-package/examples/rnn/src/rnn/test_char_rnn.clj @@ -17,6 +17,7 @@ (ns rnn.test-char-rnn (:require [clojure.string :as string] + [clojure.java.shell :refer [sh]] [rnn.util :as util] [rnn.lstm :as lstm] [org.apache.clojure-mxnet.context :as context] @@ -24,6 +25,9 @@ [org.apache.clojure-mxnet.module :as m] [org.apache.clojure-mxnet.ndarray :as ndarray])) +(when-not (.exists (clojure.java.io/file "data")) + (do (println "Retrieving data...") (sh "./get_data.sh"))) + (def data-path "data/obama.txt") (def model-prefix) (def start-sentence "The joke ") diff --git a/contrib/clojure-package/examples/rnn/src/rnn/train_char_rnn.clj b/contrib/clojure-package/examples/rnn/src/rnn/train_char_rnn.clj index 325f636561c2..41a764f7af95 100644 --- a/contrib/clojure-package/examples/rnn/src/rnn/train_char_rnn.clj +++ b/contrib/clojure-package/examples/rnn/src/rnn/train_char_rnn.clj @@ -17,6 +17,7 @@ (ns rnn.train-char-rnn (:require [clojure.string :as string] + [clojure.java.shell :refer [sh]] [rnn.util :as util] [rnn.lstm :as lstm] [rnn.test-char-rnn :as test-rnn] @@ -34,6 +35,9 @@ ;;/~https://github.com/apache/incubator-mxnet/blob/master/example/rnn/old/char-rnn.ipynb +(when-not (.exists (clojure.java.io/file "data")) + (do (println "Retrieving data...") (sh "./get_data.sh"))) + ;; batch size for training (def batch-size 32) ;; we can support various length input @@ -58,9 +62,6 @@ (def data-path "data/obama.txt") (def vocab (util/build-vocab data-path)) -(when-not (.exists (io/file "data")) - (do (println "Retrieving data...") (sh "./get_data.sh"))) - ;; generate the symbol for a length (defn sym-gen [seq-len] (lstm/lstm-unroll num-lstm-layer seq-len (inc (count vocab)) diff --git a/contrib/clojure-package/examples/rnn/test/rnn/core_test.clj b/contrib/clojure-package/examples/rnn/test/rnn/core_test.clj index ac4f5014e18c..b198577241c3 100644 --- a/contrib/clojure-package/examples/rnn/test/rnn/core_test.clj +++ b/contrib/clojure-package/examples/rnn/test/rnn/core_test.clj @@ -17,7 +17,6 @@ (ns rnn.core_test (:require - [rnn.train-char-rnn] ; this will load the data files [rnn.test-char-rnn :as rnn] [clojure.test :refer :all])) diff --git a/contrib/clojure-package/examples/tutorial/project.clj b/contrib/clojure-package/examples/tutorial/project.clj index 3bcfc0289644..58a10f04f28b 100644 --- a/contrib/clojure-package/examples/tutorial/project.clj +++ b/contrib/clojure-package/examples/tutorial/project.clj @@ -19,7 +19,7 @@ :description "MXNET tutorials" :plugins [[lein-cljfmt "0.5.7"]] :dependencies [[org.clojure/clojure "1.9.0"] - [org.apache.mxnet.contrib.clojure/clojure-mxnet "1.4.0-SNAPSHOT"] + [org.apache.mxnet.contrib.clojure/clojure-mxnet "1.5.0-SNAPSHOT"] ;; Uncomment the one appropriate for your machine & configuration: #_[org.apache.mxnet.contrib.clojure/clojure-mxnet-linux-cpu "1.4.0"]