Instructions to use Setpember/sft_gpt2_medium with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Setpember/sft_gpt2_medium with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Setpember/sft_gpt2_medium")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Setpember/sft_gpt2_medium", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Setpember/sft_gpt2_medium with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Setpember/sft_gpt2_medium" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Setpember/sft_gpt2_medium", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Setpember/sft_gpt2_medium
- SGLang
How to use Setpember/sft_gpt2_medium 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 "Setpember/sft_gpt2_medium" \ --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": "Setpember/sft_gpt2_medium", "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 "Setpember/sft_gpt2_medium" \ --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": "Setpember/sft_gpt2_medium", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Setpember/sft_gpt2_medium with Docker Model Runner:
docker model run hf.co/Setpember/sft_gpt2_medium
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: openai-community/gpt2-medium
|
| 3 |
+
library_name: transformers
|
| 4 |
+
license: mit
|
| 5 |
+
datasets:
|
| 6 |
+
- jondurbin/truthy-dpo-v0.1
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- differential-privacy
|
| 10 |
+
- privacy
|
| 11 |
+
- sft
|
| 12 |
+
- props
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# sft_gpt2_medium
|
| 16 |
+
|
| 17 |
+
Supervised fine-tuning (SFT). This is the starting point for the DPO runs.
|
| 18 |
+
|
| 19 |
+
| | |
|
| 20 |
+
| --- | --- |
|
| 21 |
+
| Base model | [openai-community/gpt2-medium](https://huggingface.co/openai-community/gpt2-medium) (GPT-2 Medium, 355M) |
|
| 22 |
+
| Data | [truthy-dpo-v0.1](https://huggingface.co/datasets/jondurbin/truthy-dpo-v0.1) |
|
| 23 |
+
| Privacy | None (SFT step) |
|
| 24 |
+
| Paper | [PROPS: Progressively Private Self-alignment of Large Language Models](https://arxiv.org/abs/2508.06783) (TMLR 2025) |
|
| 25 |
+
| Code | [FTian-UArizona/PROPS](https://github.com/FTian-UArizona/PROPS) |
|
| 26 |
+
|
| 27 |
+
## How to load
|
| 28 |
+
|
| 29 |
+
This checkpoint is a `policy.pt` file saved by the [DPO reference code](https://github.com/eric-mitchell/direct-preference-optimization).
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
import torch, transformers
|
| 33 |
+
from huggingface_hub import hf_hub_download
|
| 34 |
+
|
| 35 |
+
path = hf_hub_download(repo_id="Setpember/sft_gpt2_medium", filename="policy.pt")
|
| 36 |
+
model = transformers.AutoModelForCausalLM.from_pretrained("openai-community/gpt2-medium")
|
| 37 |
+
model.load_state_dict(torch.load(path, map_location="cpu")["state"])
|
| 38 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("openai-community/gpt2-medium")
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Intended use
|
| 42 |
+
|
| 43 |
+
Research on privacy-preserving alignment. These are small research models. They are not tuned for safety and should not be used in products.
|
| 44 |
+
|
| 45 |
+
## Author
|
| 46 |
+
|
| 47 |
+
Fengwei Tian, University of Arizona ([GitHub](https://github.com/FTian-UArizona))
|