Instructions to use open-r1/OpenR1-Distill-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use open-r1/OpenR1-Distill-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="open-r1/OpenR1-Distill-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("open-r1/OpenR1-Distill-7B") model = AutoModelForCausalLM.from_pretrained("open-r1/OpenR1-Distill-7B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use open-r1/OpenR1-Distill-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "open-r1/OpenR1-Distill-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "open-r1/OpenR1-Distill-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/open-r1/OpenR1-Distill-7B
- SGLang
How to use open-r1/OpenR1-Distill-7B 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 "open-r1/OpenR1-Distill-7B" \ --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": "open-r1/OpenR1-Distill-7B", "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 "open-r1/OpenR1-Distill-7B" \ --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": "open-r1/OpenR1-Distill-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use open-r1/OpenR1-Distill-7B with Docker Model Runner:
docker model run hf.co/open-r1/OpenR1-Distill-7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -30,6 +30,7 @@ OpenR1-Distill-7B replicates the reasoning capabilities of [deepseek-ai/DeepSeek
|
|
| 30 |
|
| 31 |
- **Repository:** https://github.com/huggingface/open-r1
|
| 32 |
- **Training logs:** https://wandb.ai/huggingface/open-r1/runs/199cum6l
|
|
|
|
| 33 |
|
| 34 |
## Usage
|
| 35 |
|
|
@@ -93,10 +94,10 @@ OpenR1-Distill-7B was trained using supervised fine-tuning (SFT) on the [Mixture
|
|
| 93 |
|
| 94 |
The individual experiments correspond to the following:
|
| 95 |
|
| 96 |
-
* exp1 - exp3: extending the model's base RoPE frequency from 10k to 100k, 300k, and 500k respectively. We find there is no significant difference between the scaling factors, and
|
| 97 |
-
* exp4 - exp6: independently scaling the learning rate on the math and code mixtures from 1e-5 to 2e-5, and 4e-5 respectively.
|
| 98 |
-
* exp7 - exp8: measuring the impact of sequence packing (exp7) versus no packing (exp8) on the math mixture.
|
| 99 |
-
* exp9 - exp10: measuring the impact of training on all three mixtures (math, code, and science) versus training on math and code only.
|
| 100 |
|
| 101 |
> [!NOTE]
|
| 102 |
> We use LiveCodeBench v4 to accelerate evaluation during our ablations as it contains around half the problems of v5, yet is still representative of the full benchmark.
|
|
|
|
| 30 |
|
| 31 |
- **Repository:** https://github.com/huggingface/open-r1
|
| 32 |
- **Training logs:** https://wandb.ai/huggingface/open-r1/runs/199cum6l
|
| 33 |
+
- **Evaluation logs:** https://huggingface.co/datasets/open-r1/details-open-r1_OpenR1-Distill-7B
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|
|
|
|
| 94 |
|
| 95 |
The individual experiments correspond to the following:
|
| 96 |
|
| 97 |
+
* **exp1 - exp3:** extending the model's base RoPE frequency from 10k to 100k, 300k, and 500k respectively. We find there is no significant difference between the scaling factors, and used 300k in all subsequent experiments.
|
| 98 |
+
* **exp4 - exp6:** independently scaling the learning rate on the math and code mixtures from 1e-5 to 2e-5, and 4e-5 respectively.
|
| 99 |
+
* **exp7 - exp8:** measuring the impact of sequence packing (exp7) versus no packing (exp8) on the math mixture.
|
| 100 |
+
* **exp9 - exp10:** measuring the impact of training on all three mixtures (math, code, and science) versus training on math and code only.
|
| 101 |
|
| 102 |
> [!NOTE]
|
| 103 |
> We use LiveCodeBench v4 to accelerate evaluation during our ablations as it contains around half the problems of v5, yet is still representative of the full benchmark.
|