Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ def init():
|
|
54 |
model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
|
55 |
|
56 |
|
57 |
-
def chat(id, npc,
|
58 |
if model == None:
|
59 |
init()
|
60 |
return "no model"
|
@@ -71,7 +71,26 @@ def chat(id, npc, prompt):
|
|
71 |
# model inference
|
72 |
|
73 |
if check(model_name):
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
inputs = tokenizer(prom, return_tensors="pt")["input_ids"]
|
76 |
outputs = model.generate(inputs, max_new_tokens=100)
|
77 |
print(tokenizer.decode(outputs[0]))
|
|
|
54 |
model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
|
55 |
|
56 |
|
57 |
+
def chat(id, npc, text):
|
58 |
if model == None:
|
59 |
init()
|
60 |
return "no model"
|
|
|
71 |
# model inference
|
72 |
|
73 |
if check(model_name):
|
74 |
+
|
75 |
+
prom = f"""<s><<SYS>>
|
76 |
+
{npc_data.system_message}<</SYS>>
|
77 |
+
|
78 |
+
[INST]
|
79 |
+
{npc_data}
|
80 |
+
### ๋ช
๋ น์ด:
|
81 |
+
๋ํ๊ธฐ๋ก์ ์ฐธ๊ณ ํ์ฌ Rabbit์ด ํ ๋ง์ ์์ฐ์ค๋ฝ๊ฒ ์์ฑํด์ฃผ์ธ์. ํ ๋ฌธ์ฅ๋ง ์์ฑํ์ธ์.
|
82 |
+
|
83 |
+
์ด์ ๋ํ๊ธฐ๋ก:
|
84 |
+
'''
|
85 |
+
{history}
|
86 |
+
'''
|
87 |
+
|
88 |
+
### User:
|
89 |
+
{user_message}
|
90 |
+
|
91 |
+
### Rabbit:[/INST]
|
92 |
+
"""
|
93 |
+
|
94 |
inputs = tokenizer(prom, return_tensors="pt")["input_ids"]
|
95 |
outputs = model.generate(inputs, max_new_tokens=100)
|
96 |
print(tokenizer.decode(outputs[0]))
|