added install script for gcp

This commit is contained in:
Benjamin Bolte
2016-08-31 23:20:38 +00:00
parent b4c9b5381e
commit 4c388e2ba1
3 changed files with 41 additions and 4 deletions
+4
View File
@@ -17,3 +17,7 @@ treq_eval*
*.dict
*.model
# virtual environments
venv/
ENV/
Executable
+33
View File
@@ -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 >==<"
+4 -4
View File
@@ -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()