Spaces:
Paused
Paused
Commit
·
707a118
1
Parent(s):
201400d
Update answerer.py
Browse files- answerer.py +3 -4
answerer.py
CHANGED
|
@@ -1,19 +1,18 @@
|
|
| 1 |
from typing import Dict, AsyncGenerator, List
|
| 2 |
import os, gc
|
| 3 |
-
from huggingface_hub import hf_hub_download
|
| 4 |
from rwkv.model import RWKV
|
| 5 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
| 6 |
|
| 7 |
class Answerer:
|
| 8 |
-
def __init__(self,
|
| 9 |
os.environ["RWKV_JIT_ON"] = "1"
|
| 10 |
# os.environ["RWKV_CUDA_ON"] = "1"
|
| 11 |
|
| 12 |
-
self.__model = RWKV(
|
| 13 |
self.__pipeline = PIPELINE(self.__model, vocab)
|
| 14 |
self.ctx_limit = ctx_limit
|
| 15 |
|
| 16 |
-
|
| 17 |
self,
|
| 18 |
input: str,
|
| 19 |
max_output_length_tk: int,
|
|
|
|
| 1 |
from typing import Dict, AsyncGenerator, List
|
| 2 |
import os, gc
|
|
|
|
| 3 |
from rwkv.model import RWKV
|
| 4 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
| 5 |
|
| 6 |
class Answerer:
|
| 7 |
+
def __init__(self, model: str, vocab: str, strategy: str, ctx_limit: int):
|
| 8 |
os.environ["RWKV_JIT_ON"] = "1"
|
| 9 |
# os.environ["RWKV_CUDA_ON"] = "1"
|
| 10 |
|
| 11 |
+
self.__model = RWKV(model, strategy=strategy)
|
| 12 |
self.__pipeline = PIPELINE(self.__model, vocab)
|
| 13 |
self.ctx_limit = ctx_limit
|
| 14 |
|
| 15 |
+
def __call__(
|
| 16 |
self,
|
| 17 |
input: str,
|
| 18 |
max_output_length_tk: int,
|