From 43f3badef4b79071c017d1a74cf37e68fb11bb46 Mon Sep 17 00:00:00 2001 From: gigasquid Date: Fri, 26 Apr 2019 10:42:14 -0400 Subject: [PATCH] update download script for new paths for base model update README --- contrib/clojure-package/examples/bert/README.md | 11 +++++++++-- .../clojure-package/examples/bert/get_bert_data.sh | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/contrib/clojure-package/examples/bert/README.md b/contrib/clojure-package/examples/bert/README.md index d3d1ee13c990..41124fa29739 100644 --- a/contrib/clojure-package/examples/bert/README.md +++ b/contrib/clojure-package/examples/bert/README.md @@ -95,10 +95,13 @@ Once you have these three files, you will be able to run this example without pr ## Fine-tuning Sentence Pair Classification with BERT -This was based off of the great tutorial for in Gluon-NLP [https://gluon-nlp.mxnet.io/examples/sentence_embedding/bert.html](https://gluon-nlp.mxnet.io/examples/sentence_embedding/bert.html) +This was based off of the great tutorial for in Gluon-NLP [https://gluon-nlp.mxnet.io/examples/sentence_embedding/bert.html](https://gluon-nlp.mxnet.io/examples/sentence_embedding/bert.html). + +We use the pre-trained BERT model that was exported from GluonNLP via the scripts/bert/staticbert/static_export_base.py. For convience, the model has been downloaded for you by running the get_bert_data.sh file in the root directory of this example. It will fine tune the base bert model for use in a classification task for 3 epochs. + ### Setup Guide #### Step 1: Download the model @@ -111,7 +114,11 @@ From the example directory: ./get_bert_data.sh ``` -Some sample questions and answers are provide in the `squad-sample.edn` file. Some are taken directly from the SQuAD dataset and one was just made up. Feel free to edit the file and add your own! +### To run the notebook walkthrough + +There is a Jupyter notebook that uses the `lein juptyer` plugin to be able to execute Clojure code in project setting. The first time that you run it you will need to install the kernal with `lein jupyter install-kernel`. After that you can open the notebook in the project directory with `lein jupyter notebook`. + +There is also an exported copy of the walkthrough to markdown `fine-tune-bert.md`. ### To run diff --git a/contrib/clojure-package/examples/bert/get_bert_data.sh b/contrib/clojure-package/examples/bert/get_bert_data.sh index 7ff57a3d38f2..10ed8e9a1f8e 100755 --- a/contrib/clojure-package/examples/bert/get_bert_data.sh +++ b/contrib/clojure-package/examples/bert/get_bert_data.sh @@ -26,7 +26,7 @@ if [ ! -d "$data_path" ]; then curl https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci/BertQA/vocab.json -o $data_path/vocab.json curl https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci/BertQA/static_bert_qa-0002.params -o $data_path/static_bert_qa-0002.params curl https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci/BertQA/static_bert_qa-symbol.json -o $data_path/static_bert_qa-symbol.json - curl https://media.githubusercontent.com/media/gigasquid/mxnet-data/master/static_bert_base_net-symbol.json -o $data_path/static_bert_base_net-symbol.json - curl https://media.githubusercontent.com/media/gigasquid/mxnet-data/master/static_bert_base_net-0000.params -o $data_path/static_bert_base_net-0000.params + curl https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci/BertQA/static_bert_base_net-symbol.json -o $data_path/static_bert_base_net-symbol.json + curl https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci/BertQA/static_bert_base_net-0000.params -o $data_path/static_bert_base_net-0000.params curl https://raw.githubusercontent.com/dmlc/gluon-nlp/master/docs/examples/sentence_embedding/dev.tsv -o $data_path/dev.tsv fi