Instructions to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/gemma-2-9b-it-WPO-HB-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/gemma-2-9b-it-WPO-HB-GGUF", filename="gemma-2-9b-it-WPO-HB.Q2_K.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with Ollama:
ollama run hf.co/QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF 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 QuantFactory/gemma-2-9b-it-WPO-HB-GGUF 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 QuantFactory/gemma-2-9b-it-WPO-HB-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/gemma-2-9b-it-WPO-HB-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/gemma-2-9b-it-WPO-HB-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/gemma-2-9b-it-WPO-HB-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-2-9b-it-WPO-HB-GGUF-Q4_K_M
List all available models
lemonade list
llm.create_chat_completion(
messages = "No input example has been defined for this model task."
)QuantFactory/gemma-2-9b-it-WPO-HB-GGUF
This is quantized version of wzhouad/gemma-2-9b-it-WPO-HB created using llama.cpp
Original Model Card
We propose a novel strategy to enhance off-policy preference optimization by simulating on-policy learning with off-policy preference data. Our Weighted Preference Optimization (WPO) method adapts off-policy data to resemble on-policy data more closely by reweighting preference pairs according to their probability under the current policy. This method not only addresses the distributional gap problem but also enhances the optimization process without incurring additional costs. Refer to our preprint and repo for details.
Model Description
Data
gemma-2-9b-it finetuned by hybrid WPO, utilizing two types of data:
- On-policy sampled gemma outputs based on Ultrafeedback prompts.
- GPT-4-turbo outputs based on Ultrafeedback prompts.
In comparison to the preference data construction method in our paper, we switch to RLHFlow/ArmoRM-Llama3-8B-v0.1 to score the outputs, and choose the outputs with maximum/minimum scores to form a preference pair.
We provide our training data at wzhouad/gemma-2-ultrafeedback-hybrid.
AlpacaEval Eval Results
| Model | LC | WR | Avg. Length |
|---|---|---|---|
| gemma-2-9b-it-WPO-HB | 76.73 | 77.83 | 2285 |
Link to Other WPO Models
Check our WPO Collection.
Training Hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-06
- beta: 0.01
- per_device_train_batch_size: 1
- gradient_accumulation_steps: 16
- seed: 1
- num_devices: 8
- optim: adamw_torch
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.1
- num_train_epochs: 2.0
- max_length: 2048
- max_prompt_length: 1800
License
This model is licensed under the Zoom software license and is permitted for use only for noncommercial, educational, or academic research purposes.
Citation
WPO:
@article{zhou2024wpo,
title={WPO: Enhancing RLHF with Weighted Preference Optimization},
author={Zhou, Wenxuan and Agrawal, Ravi and Zhang, Shujian and Indurthi, Sathish Reddy and Zhao, Sanqiang and Song, Kaiqiang and Xu, Silei and Zhu, Chenguang},
journal={arXiv preprint arXiv:2406.11827},
year={2024}
}
Ultrafeedback:
@article{cui2023ultrafeedback,
title={{UltraFeedback}: Boosting language models with high-quality feedback},
author={Cui, Ganqu and Yuan, Lifan and Ding, Ning and Yao, Guanming and Zhu, Wei and Ni, Yuan and Xie, Guotong and Liu, Zhiyuan and Sun, Maosong},
journal={arXiv preprint arXiv:2310.01377},
year={2023}
}
Armo-RM:
@article{ArmoRM,
title={Interpretable Preferences via Multi-Objective Reward Modeling and Mixture-of-Experts},
author={Haoxiang Wang and Wei Xiong and Tengyang Xie and Han Zhao and Tong Zhang},
journal={arXiv preprint arXiv:2406.12845},
}
@inproceedings{wang2024arithmetic,
title={Arithmetic Control of LLMs for Diverse User Preferences: Directional Preference Alignment with Multi-Objective Rewards},
author={Haoxiang Wang and Yong Lin and Wei Xiong and Rui Yang and Shizhe Diao and Shuang Qiu and Han Zhao and Tong Zhang},
year={2024},
booktitle={ACL},
}
- Downloads last month
- 358
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/gemma-2-9b-it-WPO-HB-GGUF", filename="", )