Instructions to use khazarai/datascience-RLHF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use khazarai/datascience-RLHF with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-1.7B") model = PeftModel.from_pretrained(base_model, "khazarai/datascience-RLHF") - Transformers
How to use khazarai/datascience-RLHF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="khazarai/datascience-RLHF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("khazarai/datascience-RLHF", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use khazarai/datascience-RLHF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "khazarai/datascience-RLHF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "khazarai/datascience-RLHF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/khazarai/datascience-RLHF
- SGLang
How to use khazarai/datascience-RLHF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "khazarai/datascience-RLHF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "khazarai/datascience-RLHF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "khazarai/datascience-RLHF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "khazarai/datascience-RLHF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use khazarai/datascience-RLHF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for khazarai/datascience-RLHF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for khazarai/datascience-RLHF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for khazarai/datascience-RLHF to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="khazarai/datascience-RLHF", max_seq_length=2048, ) - Docker Model Runner
How to use khazarai/datascience-RLHF with Docker Model Runner:
docker model run hf.co/khazarai/datascience-RLHF
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 |
|