Efficient Exact Optimization
Collection
SFT & Reward Models used in the experiments of the ICML 2024 paper "Towards Efficient Exact Optimization of Language Model Alignment" • 2 items • Updated
How to use ehzoah/exo-imdb-sft-model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ehzoah/exo-imdb-sft-model") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ehzoah/exo-imdb-sft-model")
model = AutoModelForCausalLM.from_pretrained("ehzoah/exo-imdb-sft-model")How to use ehzoah/exo-imdb-sft-model with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ehzoah/exo-imdb-sft-model"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ehzoah/exo-imdb-sft-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ehzoah/exo-imdb-sft-model
How to use ehzoah/exo-imdb-sft-model with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ehzoah/exo-imdb-sft-model" \
--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": "ehzoah/exo-imdb-sft-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "ehzoah/exo-imdb-sft-model" \
--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": "ehzoah/exo-imdb-sft-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ehzoah/exo-imdb-sft-model with Docker Model Runner:
docker model run hf.co/ehzoah/exo-imdb-sft-model
model: exo-imdb-sft-model
dataset: imdb (original stanford version)
SFT model used in the imdb experiment of the ICML'24 paper Towards Efficient Exact Optimization of Language Model Alignment.
For details of the dataset, training and inference of this model, please refer to https://github.com/haozheji/exact-optimization/blob/main/exp/imdb_exp/README.md