Update README.md
Browse files
README.md
CHANGED
@@ -99,6 +99,37 @@ _ = model.generate(
|
|
99 |
streamer = TextStreamer(tokenizer, skip_prompt = True),
|
100 |
)
|
101 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
## Training Details
|
104 |
|
|
|
99 |
streamer = TextStreamer(tokenizer, skip_prompt = True),
|
100 |
)
|
101 |
```
|
102 |
+
**For pipeline:**
|
103 |
+
|
104 |
+
```python
|
105 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
106 |
+
from peft import PeftModel
|
107 |
+
|
108 |
+
tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen2.5-0.5B-Instruct")
|
109 |
+
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-0.5B-Instruct")
|
110 |
+
model = PeftModel.from_pretrained(base_model, "khazarai/HeisenbergQ-0.5B-RL")
|
111 |
+
|
112 |
+
question = """
|
113 |
+
What is the significance of setting mass equal to 1 in a quantum dynamical system, and how does it impact the formulation of the Hamiltonian and the operators?
|
114 |
+
"""
|
115 |
+
|
116 |
+
system = """
|
117 |
+
Respond in the following format:
|
118 |
+
<reasoning>
|
119 |
+
...
|
120 |
+
</reasoning>
|
121 |
+
<answer>
|
122 |
+
...
|
123 |
+
</answer>
|
124 |
+
"""
|
125 |
+
|
126 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
127 |
+
messages = [
|
128 |
+
{"role" : "system", "content" : system},
|
129 |
+
{"role": "user", "content": question}
|
130 |
+
]
|
131 |
+
pipe(messages)
|
132 |
+
```
|
133 |
|
134 |
## Training Details
|
135 |
|