Spaces:
Running
Running
Gabriela Nicole Gonzalez Saez
commited on
Commit
•
0ace0a9
1
Parent(s):
1115254
fix empty start
Browse files
app.py
CHANGED
@@ -129,7 +129,7 @@ def split_token_from_sequences(sequences, model) -> dict :
|
|
129 |
cont = False
|
130 |
step_words = []
|
131 |
for beam in range(n_sentences):
|
132 |
-
app_text = ''
|
133 |
if step_i < len(gen_sequences_texts[beam]):
|
134 |
app_text = gen_sequences_texts[beam][step_i]
|
135 |
cont = True
|
@@ -138,7 +138,7 @@ def split_token_from_sequences(sequences, model) -> dict :
|
|
138 |
print(words_by_step)
|
139 |
|
140 |
for i_bs, step_w in enumerate(step_words):
|
141 |
-
if step_w
|
142 |
#new id if the same word is not in another beam (?) [beam[i] was a token id]
|
143 |
#parent id = previous word and previous step.
|
144 |
|
|
|
129 |
cont = False
|
130 |
step_words = []
|
131 |
for beam in range(n_sentences):
|
132 |
+
app_text = '<empty_word>'
|
133 |
if step_i < len(gen_sequences_texts[beam]):
|
134 |
app_text = gen_sequences_texts[beam][step_i]
|
135 |
cont = True
|
|
|
138 |
print(words_by_step)
|
139 |
|
140 |
for i_bs, step_w in enumerate(step_words):
|
141 |
+
if not step_w in ['<empty_word>', '<pad>']:
|
142 |
#new id if the same word is not in another beam (?) [beam[i] was a token id]
|
143 |
#parent id = previous word and previous step.
|
144 |
|