Spaces:
Paused
Paused
Commit
·
8de1402
1
Parent(s):
7f98a30
Update answerer.py
Browse files- answerer.py +3 -2
answerer.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os, gc
|
|
|
2 |
from rwkv.model import RWKV
|
3 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
4 |
from asyncio import sleep
|
@@ -20,7 +21,7 @@ class Answerer:
|
|
20 |
repetitiveness = .3,
|
21 |
diversity = 0,
|
22 |
_count_penalty = 1,
|
23 |
-
):
|
24 |
args = PIPELINE_ARGS(
|
25 |
temperature=chaos,
|
26 |
top_p=repetitiveness,
|
@@ -63,7 +64,7 @@ class Answerer:
|
|
63 |
else:
|
64 |
occurrences[current_token] = 1
|
65 |
|
66 |
-
tmp = self.__pipeline.decode(tokens)
|
67 |
if "\ufffd" not in tmp:
|
68 |
tokens.clear()
|
69 |
result += tmp
|
|
|
1 |
import os, gc
|
2 |
+
from typing import AsyncGenerator
|
3 |
from rwkv.model import RWKV
|
4 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
5 |
from asyncio import sleep
|
|
|
21 |
repetitiveness = .3,
|
22 |
diversity = 0,
|
23 |
_count_penalty = 1,
|
24 |
+
) -> AsyncGenerator[str, None]:
|
25 |
args = PIPELINE_ARGS(
|
26 |
temperature=chaos,
|
27 |
top_p=repetitiveness,
|
|
|
64 |
else:
|
65 |
occurrences[current_token] = 1
|
66 |
|
67 |
+
tmp: str = self.__pipeline.decode(tokens)
|
68 |
if "\ufffd" not in tmp:
|
69 |
tokens.clear()
|
70 |
result += tmp
|