[update]add code
Browse files
main.py
CHANGED
@@ -71,7 +71,7 @@ def main():
|
|
71 |
input_ids = torch.tensor([input_ids], dtype=torch.long)
|
72 |
input_ids = input_ids.to(device)
|
73 |
|
74 |
-
output = ""
|
75 |
streamer = TextIteratorStreamer(tokenizer=tokenizer)
|
76 |
|
77 |
generation_kwargs = dict(
|
@@ -95,7 +95,7 @@ def main():
|
|
95 |
output_ = output_.replace("[UNK]", "")
|
96 |
output_ = output_.replace(text, "")
|
97 |
|
98 |
-
output += output_
|
99 |
output_text_box.value += output
|
100 |
yield output
|
101 |
|
|
|
71 |
input_ids = torch.tensor([input_ids], dtype=torch.long)
|
72 |
input_ids = input_ids.to(device)
|
73 |
|
74 |
+
output: str = ""
|
75 |
streamer = TextIteratorStreamer(tokenizer=tokenizer)
|
76 |
|
77 |
generation_kwargs = dict(
|
|
|
95 |
output_ = output_.replace("[UNK]", "")
|
96 |
output_ = output_.replace(text, "")
|
97 |
|
98 |
+
output += output_.strip()
|
99 |
output_text_box.value += output
|
100 |
yield output
|
101 |
|