nikravan commited on
Commit
e0c2ba9
·
verified ·
1 Parent(s): 4247d0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -23,8 +23,13 @@ def generate_response(message, history):
23
 
24
 
25
  # synth,cot composite — reasoning / CoT style (see Disclaimer for other modes)
 
 
 
 
 
26
  condition = "<|quad_end|><|object_ref_end|>"
27
- prompt = f"<|im_start|>{condition}{history} {message}<|im_end|>"
28
 
29
  inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
30
  # Mark the prompt as a single bidirectional prefix block — see "PrefixLM mask" below.
 
23
 
24
 
25
  # synth,cot composite — reasoning / CoT style (see Disclaimer for other modes)
26
+ conversation = ""
27
+ for user_msg, assistant_msg in history:
28
+ conversation += f"user: {user_msg}\nassistant: {assistant_msg}\n"
29
+ conversation += f"user: {message}\nassistant: "
30
+
31
  condition = "<|quad_end|><|object_ref_end|>"
32
+ prompt = f"<|im_start|>{condition}{conversation} <|im_end|>"
33
 
34
  inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
35
  # Mark the prompt as a single bidirectional prefix block — see "PrefixLM mask" below.