doberst commited on
Commit
0dc9372
·
1 Parent(s): 6360308

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md CHANGED
@@ -89,6 +89,28 @@ To get the best results, package "my_prompt" as follows:
89
  my_prompt = {{text_passage}} + "\n" + {{question/instruction}}
90
 
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  ## Model Card Contact
94
 
 
89
  my_prompt = {{text_passage}} + "\n" + {{question/instruction}}
90
 
91
 
92
+ If you are using a HuggingFace generation script:
93
+
94
+ # prepare prompt packaging used in fine-tuning process
95
+ new_prompt = "<human>: " + entries["context"] + "\n" + entries["query"] + "\n" + "<bot>:"
96
+
97
+ inputs = tokenizer(new_prompt, return_tensors="pt")
98
+ start_of_output = len(inputs.input_ids[0])
99
+
100
+ # temperature: set at 0.3 for consistency of output
101
+ # max_new_tokens: set at 100 - may prematurely stop a few of the summaries
102
+
103
+ outputs = model.generate(
104
+ inputs.input_ids.to(device),
105
+ eos_token_id=tokenizer.eos_token_id,
106
+ pad_token_id=tokenizer.eos_token_id,
107
+ do_sample=True,
108
+ temperature=0.3,
109
+ max_new_tokens=100,
110
+ )
111
+
112
+ output_only = tokenizer.decode(outputs[0][start_of_output:],skip_special_tokens=True)
113
+
114
 
115
  ## Model Card Contact
116