Update README.md
Browse files
README.md
CHANGED
|
@@ -153,17 +153,45 @@ class Qwen2ForCausalRM(Qwen2ForCausalLM):
|
|
| 153 |
model_path = "TIGER-Lab/AceCodeRM-32B"
|
| 154 |
model = Qwen2ForCausalRM.from_pretrained(model_path, device_map="auto")
|
| 155 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
input_chat = [
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
{
|
| 159 |
"role": "assistant",
|
| 160 |
-
"content":
|
| 161 |
},
|
|
|
|
|
|
|
| 162 |
{
|
|
|
|
| 163 |
"role": "user",
|
| 164 |
-
"content": "I'd like to show off how chat templating works!",
|
| 165 |
},
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
input_tokens = tokenizer.apply_chat_template(
|
| 168 |
input_chat,
|
| 169 |
tokenize=True,
|
|
|
|
| 153 |
model_path = "TIGER-Lab/AceCodeRM-32B"
|
| 154 |
model = Qwen2ForCausalRM.from_pretrained(model_path, device_map="auto")
|
| 155 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 156 |
+
program_correct = """def runningSum(nums):
|
| 157 |
+
result = []
|
| 158 |
+
current_sum = 0
|
| 159 |
+
for num in nums:
|
| 160 |
+
current_sum += num
|
| 161 |
+
result.append(current_sum)
|
| 162 |
+
return result"""
|
| 163 |
+
program_incorrect = """def runningSum(nums):
|
| 164 |
+
result = []
|
| 165 |
+
for i in range(len(nums)):
|
| 166 |
+
if i == 0:
|
| 167 |
+
result.append(nums[i])
|
| 168 |
+
else:
|
| 169 |
+
result.append(nums[i] + nums[i-1])
|
| 170 |
+
return result"""
|
| 171 |
input_chat = [
|
| 172 |
+
[
|
| 173 |
+
[
|
| 174 |
+
{
|
| 175 |
+
"content": question,
|
| 176 |
+
"role": "user",
|
| 177 |
+
},
|
| 178 |
{
|
| 179 |
"role": "assistant",
|
| 180 |
+
"content": program_correct,
|
| 181 |
},
|
| 182 |
+
],
|
| 183 |
+
[
|
| 184 |
{
|
| 185 |
+
"content": question,
|
| 186 |
"role": "user",
|
|
|
|
| 187 |
},
|
| 188 |
+
{
|
| 189 |
+
"role": "assistant",
|
| 190 |
+
"content": program_incorrect,
|
| 191 |
+
},
|
| 192 |
+
],
|
| 193 |
+
]
|
| 194 |
+
]
|
| 195 |
input_tokens = tokenizer.apply_chat_template(
|
| 196 |
input_chat,
|
| 197 |
tokenize=True,
|