DenCT commited on
Commit
6dfdd8f
·
verified ·
1 Parent(s): 2f28750

Create process_input.py

Browse files
Files changed (1) hide show
  1. utils/process_input.py +20 -0
utils/process_input.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_response(model, instructions, input_texts):
2
+ prompt = """<|system|>
3
+ You are an expert NLP tool. Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.<|end|>
4
+
5
+ <|user|>
6
+ {}
7
+
8
+ {}<|end|>
9
+
10
+ <|assistant|>""".format(
11
+ instructions, input_texts
12
+ )
13
+ output = model(
14
+ prompt,
15
+ max_tokens=1024,
16
+ stop=["Q:"],
17
+ echo=False,
18
+ )
19
+
20
+ return output["choices"][0]["text"]