doberst commited on
Commit
8e6b8dc
1 Parent(s): 1b7c3c4

Update README.md

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