Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #217 from rsepassi/push
Browse files Browse the repository at this point in the history
v1.1.7
  • Loading branch information
lukaszkaiser authored Aug 9, 2017
2 parents c5e13db + af4f1e0 commit 73f0be2
Show file tree
Hide file tree
Showing 37 changed files with 1,826 additions and 612 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='tensor2tensor',
version='1.1.6',
version='1.1.7',
description='Tensor2Tensor',
author='Google Inc.',
author_email='[email protected]',
Expand Down
17 changes: 11 additions & 6 deletions tensor2tensor/bin/t2t-trainer
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os

# Dependency imports

from tensor2tensor.utils import registry
Expand Down Expand Up @@ -57,22 +59,25 @@ def main(_):
usr_dir.import_usr_dir(FLAGS.t2t_usr_dir)
trainer_utils.log_registry()
trainer_utils.validate_flags()
tf.gfile.MakeDirs(FLAGS.output_dir)
output_dir = os.path.expanduser(FLAGS.output_dir)
tmp_dir = os.path.expanduser(FLAGS.tmp_dir)
data_dir = os.path.expanduser(FLAGS.data_dir)
tf.gfile.MakeDirs(output_dir)

# Generate data if requested.
if FLAGS.generate_data:
tf.gfile.MakeDirs(FLAGS.data_dir)
tf.gfile.MakeDirs(FLAGS.tmp_dir)
tf.gfile.MakeDirs(data_dir)
tf.gfile.MakeDirs(tmp_dir)
for problem_name in FLAGS.problems.split("-"):
tf.logging.info("Generating data for %s" % problem_name)
problem = registry.problem(problem_name)
problem.generate_data(FLAGS.data_dir, FLAGS.tmp_dir)
problem.generate_data(data_dir, tmp_dir)

# Run the trainer.
trainer_utils.run(
data_dir=FLAGS.data_dir,
data_dir=data_dir,
model=FLAGS.model,
output_dir=FLAGS.output_dir,
output_dir=output_dir,
train_steps=FLAGS.train_steps,
eval_steps=FLAGS.eval_steps,
schedule=FLAGS.schedule)
Expand Down
14 changes: 7 additions & 7 deletions tensor2tensor/data_generators/cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def _gen(nbr_symbols, max_length, nbr_cases):

for plain, code in zip(indices, codes):
yield {
"X": plain,
"Y": code,
"inputs": plain,
"targets": code,
}

return _gen
Expand Down Expand Up @@ -99,8 +99,8 @@ def _gen(nbr_symbols, max_length, nbr_cases):

for plain, code in zip(indices, codes):
yield {
"X": plain,
"Y": code,
"inputs": plain,
"targets": code,
}

return _gen
Expand Down Expand Up @@ -148,7 +148,7 @@ def key(self):
return [1, 3]


class Layer(object):
class ShiftEncryptionLayer(object):
"""A single layer for shift."""

def __init__(self, vocab, shift):
Expand Down Expand Up @@ -211,7 +211,7 @@ def encipher_shift(plaintext, plain_vocab, shift):
ciphertext (list of Strings): encrypted plain text.
"""
ciphertext = []
cipher = Layer(plain_vocab, shift)
cipher = ShiftEncryptionLayer(plain_vocab, shift)

for _, sentence in enumerate(plaintext):
cipher_sentence = []
Expand All @@ -238,7 +238,7 @@ def encipher_vigenere(plaintext, plain_vocab, key):
# generate Vigenere table
layers = []
for i in range(len(plain_vocab)):
layers.append(Layer(plain_vocab, i))
layers.append(ShiftEncryptionLayer(plain_vocab, i))

for i, sentence in enumerate(plaintext):
cipher_sentence = []
Expand Down
180 changes: 0 additions & 180 deletions tensor2tensor/data_generators/concatenate_examples.py

This file was deleted.

Loading

0 comments on commit 73f0be2

Please sign in to comment.