Instructions to use mzhaoshuai/alpaca-7b-ref-bertscore with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mzhaoshuai/alpaca-7b-ref-bertscore with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mzhaoshuai/alpaca-7b-ref-bertscore")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mzhaoshuai/alpaca-7b-ref-bertscore", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mzhaoshuai/alpaca-7b-ref-bertscore with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mzhaoshuai/alpaca-7b-ref-bertscore" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mzhaoshuai/alpaca-7b-ref-bertscore", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mzhaoshuai/alpaca-7b-ref-bertscore
- SGLang
How to use mzhaoshuai/alpaca-7b-ref-bertscore 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 "mzhaoshuai/alpaca-7b-ref-bertscore" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mzhaoshuai/alpaca-7b-ref-bertscore", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "mzhaoshuai/alpaca-7b-ref-bertscore" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mzhaoshuai/alpaca-7b-ref-bertscore", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mzhaoshuai/alpaca-7b-ref-bertscore with Docker Model Runner:
docker model run hf.co/mzhaoshuai/alpaca-7b-ref-bertscore
RefAlign: RL with Similarity-based Rewards
GitHub repository: https://github.com/mzhaoshuai/RefAlign
This is the model aligned with RefAlign, a versatile REINFORCE-style alignment algorithm that utilizes language generation evaluation metrics (such as BERTScore) between sampled generations and reference answers as surrogate rewards.
It is primarily aligned for safety.
The training data is https://huggingface.co/datasets/mzhaoshuai/Llama-3.3-70B-Inst-awq_SafeRLHF.
When conducting Reinforcement Learning with Similarity-based Rewards, the reward function is BERTScore.
| Hyper-Parameters | Value |
|---|---|
| LR | 3e-6 |
| Batch Size | 512 |
| Epoch | 2 |
| Prompt Length | 192 |
| Generation Length | 384 |
| Sampled Generations (K) | 2 |
| BertScore Model | bart-large-mnli |
| harmless advantage weight | 4.0 |
- Downloads last month
- 4
Model tree for mzhaoshuai/alpaca-7b-ref-bertscore
Base model
PKU-Alignment/alpaca-7b-reproduced