pixas commited on
Commit
e72dea3
·
verified ·
1 Parent(s): c6ae826

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -1
README.md CHANGED
@@ -3,4 +3,55 @@ license: mit
3
  base_model:
4
  - meta-llama/Llama-3.1-8B-Instruct
5
  pipeline_tag: text-generation
6
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  base_model:
4
  - meta-llama/Llama-3.1-8B-Instruct
5
  pipeline_tag: text-generation
6
+ language:
7
+ - en
8
+ tags:
9
+ - medical
10
+ ---
11
+
12
+
13
+ <div align="center">
14
+ <h1>
15
+ MedSSS-8B-Policy
16
+ </h1>
17
+ </div>
18
+
19
+ <div align="center">
20
+ <a href="https://github.com/pixas/MedSSS" target="_blank">GitHub</a> | <a href="" target="_blank">Paper</a>
21
+ </div>
22
+
23
+ # <span>Introduction</span>
24
+ **MedSSS-Policy** is a the policy model designed for slow-thinking medical reasoning. It will conduct explicit step-wise reasoning and finalize the answer at the end of the response.
25
+
26
+ For more information, visit our GitHub repository:
27
+ [https://github.com/pixas/MedSSS](https://github.com/pixas/MedSSS).
28
+
29
+
30
+
31
+
32
+ # <span>Usage</span>
33
+ We build the policy model as a LoRA adapter, which saves the memory to use it.
34
+ As this LoRA adapter is built on `Meta-Llama3.1-8B-Instruct`, you need to first prepare the base model in your platform.
35
+ You can deploy it with tools like [vllm](https://github.com/vllm-project/vllm) or [Sglang](https://github.com/sgl-project/sglang), or perform direct inference:
36
+ ```python
37
+ from transformers import AutoModelForCausalLM, AutoTokenizer
38
+ from peft import PeftModel
39
+ base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct",torch_dtype="auto",device_map="auto")
40
+ model = PeftModel.from_pretrained(base_model, "pixas/MedSSS_Policy", torc_dtype="auto", device_map="auto")
41
+ tokenizer = AutoTokenizer.from_pretrained("pixas/MedSSS_Policy")
42
+ input_text = "How to stop a cough?"
43
+ messages = [{"role": "user", "content": input_text}]
44
+ inputs = tokenizer(tokenizer.apply_chat_template(messages, tokenize=False,add_generation_prompt=True
45
+ ), return_tensors="pt").to(model.device)
46
+ outputs = model.generate(**inputs, max_new_tokens=2048)
47
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
48
+ ```
49
+
50
+ MedSSS-Policy adopts a step-wise reasoning approach, with outputs formatted as:
51
+
52
+ ```
53
+ Step 0: Let's break down this problem step by step.
54
+ Step 1: ...
55
+ [several steps]
56
+ Step N: [last reasoning step]\n\nThe answer is {answer}
57
+ ```