ldhldh commited on
Commit
ea6b9f5
โ€ข
1 Parent(s): d7136d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -54,7 +54,7 @@ def init():
54
  model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
55
 
56
 
57
- def chat(id, npc, prompt):
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
- prom = prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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]))