Text Generation
Transformers
Safetensors
llama
alpaca
safety
sft
safe-rlhf
text-generation-inference
Instructions to use ihounie/safe-rlhf-llama-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ihounie/safe-rlhf-llama-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ihounie/safe-rlhf-llama-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ihounie/safe-rlhf-llama-base") model = AutoModelForCausalLM.from_pretrained("ihounie/safe-rlhf-llama-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ihounie/safe-rlhf-llama-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ihounie/safe-rlhf-llama-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ihounie/safe-rlhf-llama-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ihounie/safe-rlhf-llama-base
- SGLang
How to use ihounie/safe-rlhf-llama-base 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 "ihounie/safe-rlhf-llama-base" \ --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": "ihounie/safe-rlhf-llama-base", "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 "ihounie/safe-rlhf-llama-base" \ --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": "ihounie/safe-rlhf-llama-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ihounie/safe-rlhf-llama-base with Docker Model Runner:
docker model run hf.co/ihounie/safe-rlhf-llama-base
ihounie/safe-rlhf-llama-base
SFT fine-tune of PKU-Alignment/alpaca-7b-reproduced on the
PKU-Alignment/PKU-SafeRLHF-30K
dataset (preferred-safe SFT mode), trained with LoRA (r=64, alpha=128, dropout=0.05) for 3 epochs
and then merged back into the base model. Weights are stored in bf16.
- Base model:
PKU-Alignment/alpaca-7b-reproduced - Source W&B run: hounie/SAFE-RLHF-point/kd7z6emv
- Source adapter artifact:
hounie/SAFE-RLHF-point/kd7z6emv-lora_adapters:v0 - Training config:
configs/train/safe/sft_safeRLHF.yamlfrom constrained-sft (loss_type=sft, sft_data=preferred_safe).
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("ihounie/safe-rlhf-llama-base")
model = AutoModelForCausalLM.from_pretrained(
"ihounie/safe-rlhf-llama-base",
torch_dtype=torch.bfloat16,
device_map="auto",
)
- Downloads last month
- 38
Model tree for ihounie/safe-rlhf-llama-base
Base model
PKU-Alignment/alpaca-7b-reproduced