Update chat_final.py
Browse files- chat_final.py +1 -7
chat_final.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
print('Loading...')
|
2 |
from src.model_run import RWKV_RNN
|
3 |
import numpy as np
|
4 |
import os, copy, types, gc, sys
|
@@ -32,7 +31,6 @@ interface = ":"
|
|
32 |
os.environ["RWKV_RUN_DEVICE"] = args.RUN_DEVICE
|
33 |
MODEL_NAME = args.MODEL_NAME
|
34 |
|
35 |
-
print(f'loading... {MODEL_NAME}')
|
36 |
model = RWKV_RNN(args)
|
37 |
|
38 |
model_tokens = []
|
@@ -64,7 +62,6 @@ def load_all_stat(name):
|
|
64 |
model_tokens = copy.deepcopy(all_state[name]['token'])
|
65 |
return all_state[name]['out']
|
66 |
|
67 |
-
print(f'\nRun prompt...')
|
68 |
|
69 |
out = ""
|
70 |
gc.collect()
|
@@ -72,9 +69,6 @@ gc.collect()
|
|
72 |
save_all_stat('chat_init', out)
|
73 |
save_all_stat('chat', out) # ensure that 'chat' key is added to all_state
|
74 |
|
75 |
-
print(f'### prompt ###\n[{tokenizer.tokenizer.decode(model_tokens)}]\n')
|
76 |
-
|
77 |
-
|
78 |
def reply_msg_generator():
|
79 |
while True:
|
80 |
msg = yield
|
@@ -125,7 +119,7 @@ def on_message_generator():
|
|
125 |
yield '\n' # Yield a newline at the end of the response
|
126 |
message = yield # Get the next message
|
127 |
|
128 |
-
print('Start chatting with Daniel!')
|
129 |
|
130 |
on_message_gen = on_message_generator()
|
131 |
next_message = on_message_gen.__next__() # Start the generator
|
|
|
|
|
1 |
from src.model_run import RWKV_RNN
|
2 |
import numpy as np
|
3 |
import os, copy, types, gc, sys
|
|
|
31 |
os.environ["RWKV_RUN_DEVICE"] = args.RUN_DEVICE
|
32 |
MODEL_NAME = args.MODEL_NAME
|
33 |
|
|
|
34 |
model = RWKV_RNN(args)
|
35 |
|
36 |
model_tokens = []
|
|
|
62 |
model_tokens = copy.deepcopy(all_state[name]['token'])
|
63 |
return all_state[name]['out']
|
64 |
|
|
|
65 |
|
66 |
out = ""
|
67 |
gc.collect()
|
|
|
69 |
save_all_stat('chat_init', out)
|
70 |
save_all_stat('chat', out) # ensure that 'chat' key is added to all_state
|
71 |
|
|
|
|
|
|
|
72 |
def reply_msg_generator():
|
73 |
while True:
|
74 |
msg = yield
|
|
|
119 |
yield '\n' # Yield a newline at the end of the response
|
120 |
message = yield # Get the next message
|
121 |
|
122 |
+
print('Start chatting with Daniel! Pretend to pick up the phone.')
|
123 |
|
124 |
on_message_gen = on_message_generator()
|
125 |
next_message = on_message_gen.__next__() # Start the generator
|