From 5dff4933da52528c97b1e9ed3ab645f80187069f Mon Sep 17 00:00:00 2001 From: xemcerk Date: Fri, 1 Nov 2019 15:53:20 +0800 Subject: [PATCH 1/2] fix too many values to unpack error In the example script lstm_seq2seq_restore.py and lstm_seq2seq.py, when parse the data using line.split("\t"), it will return 3 values rather than 2, a simple modification can fix it. --- examples/lstm_seq2seq.py | 2 +- examples/lstm_seq2seq_restore.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/lstm_seq2seq.py b/examples/lstm_seq2seq.py index e320fd1bf854..18b61163fe2c 100644 --- a/examples/lstm_seq2seq.py +++ b/examples/lstm_seq2seq.py @@ -70,7 +70,7 @@ with open(data_path, 'r', encoding='utf-8') as f: lines = f.read().split('\n') for line in lines[: min(num_samples, len(lines) - 1)]: - input_text, target_text = line.split('\t') + input_text, target_text, _= line.split('\t') # We use "tab" as the "start sequence" character # for the targets, and "\n" as "end sequence" character. target_text = '\t' + target_text + '\n' diff --git a/examples/lstm_seq2seq_restore.py b/examples/lstm_seq2seq_restore.py index 98134c56d229..302e33478ef3 100644 --- a/examples/lstm_seq2seq_restore.py +++ b/examples/lstm_seq2seq_restore.py @@ -33,7 +33,7 @@ with open(data_path, 'r', encoding='utf-8') as f: lines = f.read().split('\n') for line in lines[: min(num_samples, len(lines) - 1)]: - input_text, target_text = line.split('\t') + input_text, target_text, _ = line.split('\t') # We use "tab" as the "start sequence" character # for the targets, and "\n" as "end sequence" character. target_text = '\t' + target_text + '\n' From d25a61dbd872161e1ff5eddbd9cb22c0b43450fa Mon Sep 17 00:00:00 2001 From: xemcerk Date: Mon, 4 Nov 2019 14:55:28 +0800 Subject: [PATCH 2/2] add blankspace around operator --- examples/lstm_seq2seq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lstm_seq2seq.py b/examples/lstm_seq2seq.py index 18b61163fe2c..179c64e94f88 100644 --- a/examples/lstm_seq2seq.py +++ b/examples/lstm_seq2seq.py @@ -70,7 +70,7 @@ with open(data_path, 'r', encoding='utf-8') as f: lines = f.read().split('\n') for line in lines[: min(num_samples, len(lines) - 1)]: - input_text, target_text, _= line.split('\t') + input_text, target_text, _ = line.split('\t') # We use "tab" as the "start sequence" character # for the targets, and "\n" as "end sequence" character. target_text = '\t' + target_text + '\n'