Instructions to use RLHFlow/Llama3.1-8B-ORM-Mistral-Data with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RLHFlow/Llama3.1-8B-ORM-Mistral-Data with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RLHFlow/Llama3.1-8B-ORM-Mistral-Data") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RLHFlow/Llama3.1-8B-ORM-Mistral-Data") model = AutoModelForCausalLM.from_pretrained("RLHFlow/Llama3.1-8B-ORM-Mistral-Data") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use RLHFlow/Llama3.1-8B-ORM-Mistral-Data with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RLHFlow/Llama3.1-8B-ORM-Mistral-Data" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RLHFlow/Llama3.1-8B-ORM-Mistral-Data", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RLHFlow/Llama3.1-8B-ORM-Mistral-Data
- SGLang
How to use RLHFlow/Llama3.1-8B-ORM-Mistral-Data 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 "RLHFlow/Llama3.1-8B-ORM-Mistral-Data" \ --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": "RLHFlow/Llama3.1-8B-ORM-Mistral-Data", "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 "RLHFlow/Llama3.1-8B-ORM-Mistral-Data" \ --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": "RLHFlow/Llama3.1-8B-ORM-Mistral-Data", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RLHFlow/Llama3.1-8B-ORM-Mistral-Data with Docker Model Runner:
docker model run hf.co/RLHFlow/Llama3.1-8B-ORM-Mistral-Data
This is a outcome-supervised reward (ORM) trained on Mistral-generated data from the project RLHFlow/RLHF-Reward-Modeling
The model is trained from meta-llama/Llama-3.1-8B-Instruct on RLHFlow/Mistral-ORM-Data for 1 epochs. We use a global batch size of 32 and a learning rate of 2e-6, where we pack the samples and split them into chunks of 8192 token. See more training details at https://github.com/RLHFlow/Online-RLHF/blob/main/math/llama-3.1-prm.yaml .
BoN evaluation result for Mistral generator:
| Model | Method | GSM8K | MATH |
|---|---|---|---|
| Mistral-7B | Pass@1 | 77.9 | 28.4 |
| Mistral-7B | Majority Voting@1024 | 84.2 | 36.8 |
| Mistral-7B | Mistral-ORM@1024 | 90.1 | 43.6 |
| Mistral-7B | Mistral-PRM@1024 | 92.4 | 46.3 |
Scaling the inference sampling to N=1024 for Deepseek generator:
| Model | Method | GSM8K | MATH |
|---|---|---|---|
| Deepseek-7B | Pass@1 | 83.9 | 38.4 |
| Deepseek-7B | Majority Voting@1024 | 89.7 | 57.4 |
| Deepseek-7B | Deepseek-ORM@1024 | 93.4 | 52.4 |
| Deepseek-7B | Deepseek-PRM@1024 | 93.0 | 58.1 |
| Deepseek-7B | Mistral-ORM@1024 (OOD) | 90.3 | 54.9 |
| Deepseek-7B | Mistral-PRM@1024 (OOD) | 91.9 | 56.9 |
Visualization
Usage
See https://github.com/RLHFlow/RLHF-Reward-Modeling/tree/main/math for detailed examples.
Citation
The automatic annotation was proposed in the Math-shepherd paper:
@inproceedings{wang2024math,
title={Math-shepherd: Verify and reinforce llms step-by-step without human annotations},
author={Wang, Peiyi and Li, Lei and Shao, Zhihong and Xu, Runxin and Dai, Damai and Li, Yifei and Chen, Deli and Wu, Yu and Sui, Zhifang},
booktitle={Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
pages={9426--9439},
year={2024}
}
If you find the training recipe useful, please consider cite it as follows.
@misc{xiong2024rlhflowmath,
author={Wei Xiong and Hanning Zhang and Nan Jiang and Tong Zhang},
title = {An Implementation of Generative PRM},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/RLHFlow/RLHF-Reward-Modeling}}
}
- Downloads last month
- 1
