DaniilAlpha commited on
Commit
4cec5d2
·
1 Parent(s): c542da9

Update answerer.py

Browse files
Files changed (1) hide show
  1. answerer.py +3 -4
answerer.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Callable, Dict, List
2
  import os, gc
3
  from rwkv.model import RWKV
4
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
@@ -20,7 +20,6 @@ class Answerer:
20
  repetitiveness = .3,
21
  diversity = 0,
22
  _count_penalty = 1,
23
- callback = None,
24
  ):
25
  args = PIPELINE_ARGS(
26
  temperature=chaos,
@@ -68,7 +67,7 @@ class Answerer:
68
  if "\ufffd" not in tmp:
69
  tokens.clear()
70
  result += tmp
71
- if(callback): callback(result)
72
 
73
  tokens.clear()
74
  occurrences.clear()
@@ -76,5 +75,5 @@ class Answerer:
76
  del occurrences, tokens, current_token, state
77
  gc.collect()
78
 
79
- return result
80
 
 
1
+ from typing import Dict, List
2
  import os, gc
3
  from rwkv.model import RWKV
4
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
 
20
  repetitiveness = .3,
21
  diversity = 0,
22
  _count_penalty = 1,
 
23
  ):
24
  args = PIPELINE_ARGS(
25
  temperature=chaos,
 
67
  if "\ufffd" not in tmp:
68
  tokens.clear()
69
  result += tmp
70
+ yield result
71
 
72
  tokens.clear()
73
  occurrences.clear()
 
75
  del occurrences, tokens, current_token, state
76
  gc.collect()
77
 
78
+ yield result
79