From 4c388e2ba143bf82b320f3a32e3e507f4e54bbc1 Mon Sep 17 00:00:00 2001 From: Benjamin Bolte Date: Wed, 31 Aug 2016 23:20:38 +0000 Subject: [PATCH] added install script for gcp --- .gitignore | 4 ++++ install.sh | 33 +++++++++++++++++++++++++++++++++ insurance_qa_eval.py | 8 ++++---- 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100755 install.sh diff --git a/.gitignore b/.gitignore index 086c4c3..8696926 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ treq_eval* *.dict *.model +# virtual environments +venv/ +ENV/ + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..7f6666d --- /dev/null +++ b/install.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# This script will get you up and running on a Google Compute Engine instance +# Ubuntu 16.04 (as many CPUs as you like) + +# exit on failure +set -e + +# install pip (not installed by default on GCE) +sudo apt install python-pip + +# install virtualenv +sudo pip install virtualenv + +# create and activate virtual environment +virtualenv venv +source venv/bin/activate + +# install h5py +pip install h5py + +# install tensorflow +export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl +pip install --upgrade $TF_BINARY_URL + +# install keras from source in the home directory +git clone https://github.com/fchollet/keras ~/keras/ +python ~/keras/setup.py install --home ~/keras/ +echo '{"epsilon": 1e-07, "floatx": "float32", "backend": "tensorflow"}' > ~/.keras/keras.json + +# alert user that we're done +echo ">==< Successfully installed dependencies >==<" + diff --git a/insurance_qa_eval.py b/insurance_qa_eval.py index 9284587..83bac7c 100644 --- a/insurance_qa_eval.py +++ b/insurance_qa_eval.py @@ -233,7 +233,7 @@ if __name__ == '__main__': 'n_words': 22353, 'question_len': 150, 'answer_len': 150, - 'margin': 0.2, + 'margin': 0.05, 'initial_embed_weights': 'word2vec_100_dim.embeddings', 'training': { @@ -243,15 +243,15 @@ if __name__ == '__main__': }, 'similarity': { - 'mode': 'gesd', + 'mode': 'cosine', 'gamma': 1, 'c': 1, 'd': 2, } } - from keras_models import AttentionModel - evaluator = Evaluator(conf, model=AttentionModel, optimizer='rmsprop') + from keras_models import EmbeddingModel + evaluator = Evaluator(conf, model=EmbeddingModel, optimizer='sgd') # train the model best_loss = evaluator.train()