Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
update download script for new paths for base model
Browse files Browse the repository at this point in the history
update README
  • Loading branch information
gigasquid committed Apr 26, 2019
1 parent 783b011 commit 43f3bad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions contrib/clojure-package/examples/bert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions contrib/clojure-package/examples/bert/get_bert_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 43f3bad

Please sign in to comment.