This commit is contained in:
root
2019-10-23 15:29:14 +00:00
parent 7bad170add
commit a1d028f224
4 changed files with 30 additions and 3 deletions
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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'
+27
View File
@@ -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" .