Update README.md
Browse files
README.md
CHANGED
|
@@ -58,7 +58,49 @@ This model is a fine-tuned version of Qwen3-1.7B using ORPO (Odds Ratio Preferen
|
|
| 58 |
Use the code below to get started with the model.
|
| 59 |
|
| 60 |
```python
|
|
|
|
|
|
|
|
|
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
```
|
| 63 |
|
| 64 |
|
|
|
|
| 58 |
Use the code below to get started with the model.
|
| 59 |
|
| 60 |
```python
|
| 61 |
+
from huggingface_hub import login
|
| 62 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 63 |
+
from peft import PeftModel
|
| 64 |
|
| 65 |
+
login(token="")
|
| 66 |
+
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen3-1.7B",)
|
| 68 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 69 |
+
"unsloth/Qwen3-1.7B",
|
| 70 |
+
device_map={"": 0}, token=""
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
model = PeftModel.from_pretrained(base_model,"Rustamshry/datascience-RLHF")
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
| 77 |
+
|
| 78 |
+
### Instruction:
|
| 79 |
+
{}
|
| 80 |
+
|
| 81 |
+
### Input:
|
| 82 |
+
{}
|
| 83 |
+
|
| 84 |
+
### Response:
|
| 85 |
+
{}"""
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
inputs = tokenizer(
|
| 89 |
+
[
|
| 90 |
+
prompt.format(
|
| 91 |
+
"You are an AI assistant that helps people find information",
|
| 92 |
+
"What is the k-Means Clustering algorithm and what is it's purpose?",
|
| 93 |
+
"",
|
| 94 |
+
)
|
| 95 |
+
],
|
| 96 |
+
return_tensors="pt",
|
| 97 |
+
).to("cuda")
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
from transformers import TextStreamer
|
| 101 |
+
|
| 102 |
+
text_streamer = TextStreamer(tokenizer)
|
| 103 |
+
_ = model.generate(**inputs, streamer=text_streamer, max_new_tokens=1800)
|
| 104 |
```
|
| 105 |
|
| 106 |
|