diff --git a/console_play.py b/console_play.py index c7dd24f..4b40357 100644 --- a/console_play.py +++ b/console_play.py @@ -24,7 +24,7 @@ def play_unconstrained(): generator = CTRLGenerator() #generator = WebGenerator(CRED_FILE) if len(sys.argv) is 1: - prompt = get_story_start("hospital") + prompt = get_story_start("forest") else: prompt = sys.argv[1] story_manager = UnconstrainedStoryManager(generator) diff --git a/generator/ctrl/ctrl_generator.py b/generator/ctrl/ctrl_generator.py index e15ca99..bd6c40a 100644 --- a/generator/ctrl/ctrl_generator.py +++ b/generator/ctrl/ctrl_generator.py @@ -20,10 +20,10 @@ def loss(labels, logits): class CTRLGenerator(): - def __init__(self, control_code="Writing Text: ", generate_num=64, temperature=0.5, topk=40): + def __init__(self, control_code="Fantasy ", generate_num=64, temperature=0.5, topk=40): self.generate_num=generate_num - model_dir = "generator/ctrl/training_utils/seqlen512_v1.ckpt/" + model_dir = "generator/ctrl/training_utils/seqlen256_v1.ckpt/" self.control_code = control_code vocab_file = 'generator/ctrl/model/vocab' code_file = 'generator/ctrl/model/codes' diff --git a/generator/ctrl/install_ctrl.sh b/generator/ctrl/install_ctrl_py2.sh similarity index 100% rename from generator/ctrl/install_ctrl.sh rename to generator/ctrl/install_ctrl_py2.sh diff --git a/generator/ctrl/install_ctrl_py3.sh b/generator/ctrl/install_ctrl_py3.sh new file mode 100755 index 0000000..836da30 --- /dev/null +++ b/generator/ctrl/install_ctrl_py3.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +cd model +# Cython is needed to compile fastBPE +pip install Cython + +# Patch the TensorFlow estimator package +export FILE="/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/keras.py" +patch -b "$FILE" estimator.patch + +# Install fastBPE +git clone https://github.com/glample/fastBPE.git +cd fastBPE +python setup.py install +cd ../.. + +# Download the 512-length model if specified, 256-length otherwise +#if [ "$1" = "512" ] +#then +# URL="gs://sf-ctrl/seqlen512_v1.ckpt/" +#else +# URL="gs://sf-ctrl/seqlen256_v1.ckpt/" +#fi + +# Copy model +#gsutil -m cp -r "$URL" . +