Text Generation
Transformers
Safetensors
English
llama
model-raising
synthetic-persona-pretraining
spp
alignment
safety
conversational
text-generation-inference
Instructions to use epfl-dlab/spp-t0-3b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use epfl-dlab/spp-t0-3b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="epfl-dlab/spp-t0-3b-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("epfl-dlab/spp-t0-3b-instruct") model = AutoModelForCausalLM.from_pretrained("epfl-dlab/spp-t0-3b-instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use epfl-dlab/spp-t0-3b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "epfl-dlab/spp-t0-3b-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "epfl-dlab/spp-t0-3b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/epfl-dlab/spp-t0-3b-instruct
- SGLang
How to use epfl-dlab/spp-t0-3b-instruct 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 "epfl-dlab/spp-t0-3b-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "epfl-dlab/spp-t0-3b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "epfl-dlab/spp-t0-3b-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "epfl-dlab/spp-t0-3b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use epfl-dlab/spp-t0-3b-instruct with Docker Model Runner:
docker model run hf.co/epfl-dlab/spp-t0-3b-instruct
Add safety-mixture index to model card
Browse files
README.md
CHANGED
|
@@ -46,6 +46,31 @@ out = model.generate(ids, max_new_tokens=512)
|
|
| 46 |
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=False))
|
| 47 |
```
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
## Intended use
|
| 50 |
Research on alignment and safety (constitutional alignment, value generalization, jailbreak robustness). A research artifact, not a production model; it can produce incorrect or unsafe content.
|
| 51 |
|
|
|
|
| 46 |
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=False))
|
| 47 |
```
|
| 48 |
|
| 49 |
+
## Safety mixtures
|
| 50 |
+
|
| 51 |
+
This model is one point on a safety-data sweep. `main` is the default 10% mixture; the other fractions are published as revisions on this repo, so each can be loaded by passing `revision=`:
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 55 |
+
import torch
|
| 56 |
+
|
| 57 |
+
repo = "epfl-dlab/spp-t0-3b-instruct"
|
| 58 |
+
tok = AutoTokenizer.from_pretrained(repo) # identical at every revision
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 60 |
+
repo, revision="safety-60", dtype=torch.bfloat16, device_map="auto"
|
| 61 |
+
)
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
| Revision | Safety fraction | Safety examples | Instruct examples |
|
| 65 |
+
|---|---|---|---|
|
| 66 |
+
| `safety-0` | 0% | 0 | 300,000 |
|
| 67 |
+
| `safety-5` | 5% | 15,000 | 285,000 |
|
| 68 |
+
| `safety-10` — **default**, same weights as `main` | 10% | 30,000 | 270,000 |
|
| 69 |
+
| `safety-30` | 30% | 90,000 | 210,000 |
|
| 70 |
+
| `safety-60` | 60% | 180,000 | 120,000 |
|
| 71 |
+
|
| 72 |
+
Every mixture is 300,000 examples total, one epoch, response-only loss; safety prompts come from WildJailbreak and WildGuardMix and instructions from WildChat-1M. Only the ratio changes.
|
| 73 |
+
|
| 74 |
## Intended use
|
| 75 |
Research on alignment and safety (constitutional alignment, value generalization, jailbreak robustness). A research artifact, not a production model; it can produce incorrect or unsafe content.
|
| 76 |
|