diff --git a/generator/ctrl/.gitignore b/generator/ctrl/.gitignore new file mode 100644 index 0000000..570fd54 --- /dev/null +++ b/generator/ctrl/.gitignore @@ -0,0 +1,2 @@ +fastBPE +model diff --git a/generator/ctrl/ctrl_generator.py b/generator/ctrl/ctrl_generator.py index f887810..e15ca99 100644 --- a/generator/ctrl/ctrl_generator.py +++ b/generator/ctrl/ctrl_generator.py @@ -23,7 +23,7 @@ class CTRLGenerator(): def __init__(self, control_code="Writing Text: ", generate_num=64, temperature=0.5, topk=40): self.generate_num=generate_num - model_dir = "generator/ctrl/model/seqlen512_v1.ckpt/" + model_dir = "generator/ctrl/training_utils/seqlen512_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.sh index bc556ba..7b9f901 100755 --- a/generator/ctrl/install_ctrl.sh +++ b/generator/ctrl/install_ctrl.sh @@ -4,11 +4,8 @@ cd model # Cython is needed to compile fastBPE pip install Cython -pip install tensorflow-gpu==1.14 -pip install keras - # Patch the TensorFlow estimator package -FILE="/usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator" +export FILE="/usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/keras.py" patch -b "$FILE" estimator.patch # Install fastBPE diff --git a/generator/ctrl/model/estimator.patch b/generator/ctrl/model/estimator.patch deleted file mode 100644 index ea3db9c..0000000 --- a/generator/ctrl/model/estimator.patch +++ /dev/null @@ -1,24 +0,0 @@ -47c47 -< ---- -> import tensorflow as tf -228c228 -< def _create_keras_model_fn(keras_model, custom_objects=None): ---- -> def _create_keras_model_fn(keras_model, params=None, custom_objects=None): -239c239 -< def model_fn(features, labels, mode): ---- -> def model_fn(features, labels, mode, params=None): -448c448 -< if keras_model._is_graph_network: ---- -> if False: -462,464c462,464 -< estimator = estimator_lib.Estimator(keras_model_fn, -< config=config, -< warm_start_from=warm_start_path) ---- -> estimator = tf.contrib.tpu.TPUEstimator(keras_model_fn, use_tpu=True, train_batch_size=512, eval_batch_size=32, -> config=config, -> warm_start_from=warm_start_path) diff --git a/generator/ctrl/training_utils/.gitignore b/generator/ctrl/training_utils/.gitignore new file mode 100644 index 0000000..6a5ab3a --- /dev/null +++ b/generator/ctrl/training_utils/.gitignore @@ -0,0 +1,3 @@ +seqlen256_v1.ckpt +*.txt +*.tfrecords diff --git a/generator/tf/__init__.py b/generator/tf/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/generator/web/__init__.py b/generator/web/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/other/__init__.py b/other/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/story/__init__.py b/story/__init__.py new file mode 100644 index 0000000..e69de29