Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,15 +42,11 @@ def extend(input_text, num_return_sequences, max_size=20, top_k=50, top_p=0.95):
|
|
42 |
generated_sequence = generated_sequence.tolist()
|
43 |
text = tokenizer.decode(generated_sequence, clean_up_tokenization_spaces=True)
|
44 |
print(text)
|
45 |
-
# Remove all text after the stop token
|
46 |
-
text = text[: text.find(stop_token) if stop_token else None]
|
47 |
-
# Remove all text after 3 newlines
|
48 |
-
text = text[: text.find(new_lines) if new_lines else None]
|
49 |
-
# Add the prompt at the beginning of the sequence. Remove the excess text that was used for pre-processing
|
50 |
total_sequence = (
|
51 |
input_text + text[len(tokenizer.decode(encoded_prompt[0], clean_up_tokenization_spaces=True)) :]
|
52 |
)
|
53 |
-
generated_sequences.append(total_sequence)
|
|
|
54 |
|
55 |
parsed_text = total_sequence.replace("<|startoftext|>", "").replace("\r","").replace("\n\n", "\n")
|
56 |
if len(parsed_text) == 0:
|
|
|
42 |
generated_sequence = generated_sequence.tolist()
|
43 |
text = tokenizer.decode(generated_sequence, clean_up_tokenization_spaces=True)
|
44 |
print(text)
|
|
|
|
|
|
|
|
|
|
|
45 |
total_sequence = (
|
46 |
input_text + text[len(tokenizer.decode(encoded_prompt[0], clean_up_tokenization_spaces=True)) :]
|
47 |
)
|
48 |
+
#generated_sequences.append(total_sequence)
|
49 |
+
generated_sequences.append(text)
|
50 |
|
51 |
parsed_text = total_sequence.replace("<|startoftext|>", "").replace("\r","").replace("\n\n", "\n")
|
52 |
if len(parsed_text) == 0:
|