Skip to content

Commit 7a39b6c

Browse files
xemcerkgabrieldemarmiesse
authored andcommitted
Fix too many values to unpack error (keras-team#13511)
* 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. * add blankspace around operator
1 parent e8946d5 commit 7a39b6c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/lstm_seq2seq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
with open(data_path, 'r', encoding='utf-8') as f:
7171
lines = f.read().split('\n')
7272
for line in lines[: min(num_samples, len(lines) - 1)]:
73-
input_text, target_text = line.split('\t')
73+
input_text, target_text, _ = line.split('\t')
7474
# We use "tab" as the "start sequence" character
7575
# for the targets, and "\n" as "end sequence" character.
7676
target_text = '\t' + target_text + '\n'

examples/lstm_seq2seq_restore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
with open(data_path, 'r', encoding='utf-8') as f:
3434
lines = f.read().split('\n')
3535
for line in lines[: min(num_samples, len(lines) - 1)]:
36-
input_text, target_text = line.split('\t')
36+
input_text, target_text, _ = line.split('\t')
3737
# We use "tab" as the "start sequence" character
3838
# for the targets, and "\n" as "end sequence" character.
3939
target_text = '\t' + target_text + '\n'

0 commit comments

Comments
 (0)