Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
use TF IO for plain text reading, otherwise it doesn't work on Google…
Browse files Browse the repository at this point in the history
… ML Engine
  • Loading branch information
juditacs committed Jul 11, 2017
1 parent 37c7201 commit f606943
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions morph_seg/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
from sys import stdin
import gzip

from tensorflow.python.lib.io import file_io

from experiment import Seq2seqExperiment
from data import DataSet


def parse_args():
p = ArgumentParser(description='Run baseline seq2seq experiments.')
p.add_argument('train_file', type=str, default=stdin,
p.add_argument('--train-file', type=str, default=stdin,
help="Plain text of gzip file containing the training"
"data. If not specified, STDIN is used")
p.add_argument('-r', '--result-file', type=str,
Expand Down Expand Up @@ -47,7 +49,7 @@ def main():
with gzip.open(args.train_file) as infile:
data.read_data_from_stream(infile, limit=args.sample_count)
else:
with open(args.train_file) as infile:
with file_io.FileIO(args.train_file, mode='w+') as infile:
data.read_data_from_stream(infile, limit=args.sample_count)
else:
data.read_data_from_stream(stdin, limit=args.sample_count)
Expand Down

0 comments on commit f606943

Please sign in to comment.