Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 0 additions & 100 deletions research/adversarial_text/BUILD

This file was deleted.

17 changes: 8 additions & 9 deletions research/adversarial_text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Code for [*Adversarial Training Methods for Semi-Supervised Text Classification*

## Requirements

* Bazel ([install](https://bazel.build/versions/master/docs/install.html))
* TensorFlow >= v1.1

## End-to-end IMDB Sentiment Classification
Expand All @@ -23,7 +22,7 @@ The directory `/tmp/aclImdb` contains the raw IMDB data.

```
$ IMDB_DATA_DIR=/tmp/imdb
$ bazel run data:gen_vocab -- \
$ python gen_vocab.py -- \
--output_dir=$IMDB_DATA_DIR \
--dataset=imdb \
--imdb_input_dir=/tmp/aclImdb \
Expand All @@ -35,7 +34,7 @@ Vocabulary and frequency files will be generated in `$IMDB_DATA_DIR`.
###  Generate training, validation, and test data

```
$ bazel run data:gen_data -- \
$ python gen_data.py -- \
--output_dir=$IMDB_DATA_DIR \
--dataset=imdb \
--imdb_input_dir=/tmp/aclImdb \
Expand All @@ -49,7 +48,7 @@ $ bazel run data:gen_data -- \

```
$ PRETRAIN_DIR=/tmp/models/imdb_pretrain
$ bazel run :pretrain -- \
$ python pretrain.py -- \
--train_dir=$PRETRAIN_DIR \
--data_dir=$IMDB_DATA_DIR \
--vocab_size=86934 \
Expand Down Expand Up @@ -77,7 +76,7 @@ training and classification.

```
$ TRAIN_DIR=/tmp/models/imdb_classify
$ bazel run :train_classifier -- \
$ python train_classifier.py -- \
--train_dir=$TRAIN_DIR \
--pretrained_model_dir=$PRETRAIN_DIR \
--data_dir=$IMDB_DATA_DIR \
Expand All @@ -102,7 +101,7 @@ $ bazel run :train_classifier -- \

```
$ EVAL_DIR=/tmp/models/imdb_eval
$ bazel run :evaluate -- \
$ python evaluate.py -- \
--eval_dir=$EVAL_DIR \
--checkpoint_dir=$TRAIN_DIR \
--eval_data=test \
Expand Down Expand Up @@ -145,13 +144,13 @@ Flags particular to each job are defined in the main binary files.

### Data Generation

* Vocabulary generation: [`gen_vocab.py`](https://github.com/tensorflow/models/tree/master/research/adversarial_text/data/gen_vocab.py)
* Data generation: [`gen_data.py`](https://github.com/tensorflow/models/tree/master/research/adversarial_text/data/gen_data.py)
* Vocabulary generation: [`gen_vocab.py`](https://github.com/tensorflow/models/tree/master/research/adversarial_text/gen_vocab.py)
* Data generation: [`gen_data.py`](https://github.com/tensorflow/models/tree/master/research/adversarial_text/gen_data.py)

Command-line flags defined in [`document_generators.py`](https://github.com/tensorflow/models/tree/master/research/adversarial_text/data/document_generators.py)
control which dataset is processed and how.

## Contact for Issues

* Ryan Sepassi, @rsepassi
* Andrew M. Dai, @a-dai
* Andrew M. Dai, @a-dai <adai@google.com>
Empty file.
52 changes: 0 additions & 52 deletions research/adversarial_text/data/BUILD

This file was deleted.

Empty file.
2 changes: 1 addition & 1 deletion research/adversarial_text/data/data_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import tensorflow as tf

from adversarial_text.data import data_utils
from data import data_utils

data = data_utils

Expand Down
2 changes: 1 addition & 1 deletion research/adversarial_text/data/document_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import tensorflow as tf

from adversarial_text.data import data_utils
from data import data_utils

flags = tf.app.flags
FLAGS = flags.FLAGS
Expand Down
2 changes: 1 addition & 1 deletion research/adversarial_text/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import tensorflow as tf

from adversarial_text import graphs
import graphs

flags = tf.app.flags
FLAGS = flags.FLAGS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

import tensorflow as tf

from adversarial_text.data import data_utils
from adversarial_text.data import document_generators
from data import data_utils
from data import document_generators

data = data_utils
flags = tf.app.flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import tensorflow as tf

from adversarial_text.data import data_utils
from adversarial_text.data import document_generators
from data import data_utils
from data import document_generators

flags = tf.app.flags
FLAGS = flags.FLAGS
Expand Down
6 changes: 3 additions & 3 deletions research/adversarial_text/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

import tensorflow as tf

from adversarial_text import adversarial_losses as adv_lib
from adversarial_text import inputs as inputs_lib
from adversarial_text import layers as layers_lib
import adversarial_losses as adv_lib
import inputs as inputs_lib
import layers as layers_lib

flags = tf.app.flags
FLAGS = flags.FLAGS
Expand Down
4 changes: 2 additions & 2 deletions research/adversarial_text/graphs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

import tensorflow as tf

from adversarial_text import graphs
from adversarial_text.data import data_utils
import graphs
from data import data_utils

flags = tf.app.flags
FLAGS = flags.FLAGS
Expand Down
2 changes: 1 addition & 1 deletion research/adversarial_text/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import tensorflow as tf

from adversarial_text.data import data_utils
from data import data_utils


class VatxtInput(object):
Expand Down
2 changes: 1 addition & 1 deletion research/adversarial_text/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def predictions(logits):
with tf.name_scope('predictions'):
# For binary classification
if inner_dim == 1:
pred = tf.cast(tf.greater(tf.squeeze(logits, -1), 0.5), tf.int64)
pred = tf.cast(tf.greater(tf.squeeze(logits, -1), 0.), tf.int64)
# For multi-class classification
else:
pred = tf.argmax(logits, 2)
Expand Down
4 changes: 2 additions & 2 deletions research/adversarial_text/pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

import tensorflow as tf

from adversarial_text import graphs
from adversarial_text import train_utils
import graphs
import train_utils

FLAGS = tf.app.flags.FLAGS

Expand Down
4 changes: 2 additions & 2 deletions research/adversarial_text/train_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

import tensorflow as tf

from adversarial_text import graphs
from adversarial_text import train_utils
import graphs
import train_utils

flags = tf.app.flags
FLAGS = flags.FLAGS
Expand Down