Moses25 commited on
Commit
b3f9f8a
·
verified ·
1 Parent(s): f45d961

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -28,7 +28,7 @@ def chat_format(conversation:list,tokenizer,chat_type="mistral"):
28
  id = tokenizer.apply_chat_template(ap,chat_template=mistral_template,tokenize=False)
29
  elif chat_type=='llama3':
30
  id = tokenizer.apply_chat_template(ap,chat_template=llama3_template,tokenize=False)
31
- id = id.rstrip("<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n")
32
  return id
33
 
34
  user_chat=[{"role":"user","content":"In a basket, there are 20 oranges, 60 apples, and 40 bananas. If 15 pears were added, and half of the oranges were removed, what would be the new ratio of oranges to apples, bananas, and pears combined within the basket?"}]
@@ -48,12 +48,12 @@ def predict(content_prompt):
48
  num_beams=1,
49
  do_sample=True,
50
  repetition_penalty=1.0,
51
- eos_token_id=tokenizer.eos_token_id,
52
- pad_token_id=tokenizer.pad_token_id,
53
  )
54
  s = generation_output.sequences[0]
55
  output = tokenizer.decode(s,skip_special_tokens=True)
56
- output1 = output.split("<|eot_id|>")[-1].strip()
57
  # print(output1)
58
  return output1
59
 
 
28
  id = tokenizer.apply_chat_template(ap,chat_template=mistral_template,tokenize=False)
29
  elif chat_type=='llama3':
30
  id = tokenizer.apply_chat_template(ap,chat_template=llama3_template,tokenize=False)
31
+ #id = id.rstrip("<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n")
32
  return id
33
 
34
  user_chat=[{"role":"user","content":"In a basket, there are 20 oranges, 60 apples, and 40 bananas. If 15 pears were added, and half of the oranges were removed, what would be the new ratio of oranges to apples, bananas, and pears combined within the basket?"}]
 
48
  num_beams=1,
49
  do_sample=True,
50
  repetition_penalty=1.0,
51
+ eos_token_id=tokenizer.convert_tokens_to_ids("<|eot_id|>"),
52
+ pad_token_id=tokenizer.convert_tokens_to_ids("<|eot_id|>"),
53
  )
54
  s = generation_output.sequences[0]
55
  output = tokenizer.decode(s,skip_special_tokens=True)
56
+ output1 = output.split("<|eot_id|>")[-2].lstrip("<|start_header_id|>assistant<|end_header_id|>").strip()
57
  # print(output1)
58
  return output1
59