Downloads · 30 days
6
30% of all-time downloads
samarthraina/D-STEER-Mistral-7B-OpenHermes-DPO-Adapter
D-STEER-Mistral-7B-OpenHermes-DPO-Adapter is a text generation model from samarthraina. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
Canonical D-STEER release of the harmlessness-oriented DPO adapter for teknium/OpenHermes-2.5-Mistral-7B.
Downloads · 30 days
6
30% of all-time downloads
All-time downloads
20
Public
Repo size
692 MB
Likes
0
Public
Click a slice to open those files.
.safetensors692 MB · 99%
From the Hugging Face model README
Canonical D-STEER release of the harmlessness-oriented DPO adapter for
teknium/OpenHermes-2.5-Mistral-7B.
D-STEER is a research programme on activation steering for safety behaviour in language models: whether a single direction in activation space, estimated from the difference between a preference-tuned checkpoint and its instruction-tuned starting point, can install or remove harmlessness behaviour at inference time.
This adapter supplies the preference-tuned endpoint of the second D-STEER model pair, used to check that findings are not specific to a single architecture.
teknium/OpenHermes-2.5-Mistral-7B, revision 24c0bea14d53e6f67f1fbe2eca5bfe7cae389b33mistralai/Mistral-7B-v0.1harmless-baseq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projembed_tokens / lm_head in
float16. The base model itself is bfloat16, which is what the snippet below loads.Full hyperparameters are in training_args.json.
Requires
transformers >= 5.0. The tokenizer in this repository is stored in the currenttokenizers-backend format. Loading it withtransformers4.x raisesTokenizer class TokenizersBackend does not exist.
The training tokenizer in this repository has one additional token relative to the base
model — a dedicated <|pad|> padding token:
| tokens | |
|---|---|
base teknium/OpenHermes-2.5-Mistral-7B embedding table | 32,002 |
| adapter tokenizer in this repository | 32,003 |
The base embedding table must be resized to match before the adapter is attached, or loading fails on a shape mismatch. The snippet below does this correctly.
This repository ships the trained embed_tokens and lm_head weights at the resized
[32003, 4096] shape alongside the LoRA tensors, so once you resize, the added token's
values come from the adapter rather than from random initialisation.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
ADAPTER = "samarthraina/D-STEER-Mistral-7B-OpenHermes-DPO-Adapter"
BASE = "teknium/OpenHermes-2.5-Mistral-7B"
BASE_REVISION = "24c0bea14d53e6f67f1fbe2eca5bfe7cae389b33"
# 1. load the adapter's tokenizer (it carries the extra token)
tokenizer = AutoTokenizer.from_pretrained(ADAPTER)
# 2. load the base model at the pinned revision
model = AutoModelForCausalLM.from_pretrained(BASE, revision=BASE_REVISION, dtype=torch.bfloat16)
# 3. check the embedding table against the tokenizer
n_embed = model.get_input_embeddings().weight.shape[0]
print(f"base embeddings: {n_embed} | tokenizer: {len(tokenizer)}")
# 4. resize only if they disagree
if n_embed != len(tokenizer):
model.resize_token_embeddings(len(tokenizer))
# 5. attach the LoRA adapter
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()
# 6. optional: fold the adapter into the base weights
# model = model.merge_and_unload()
Released for AI-safety research: as the preference-tuned endpoint of a matched pair for estimating and evaluating harmlessness directions in activation space.
| Item | Value |
|---|---|
adapter_model.safetensors SHA-256 | 79c81ebc54c040c305fd35524fafe0edb3facc6be91284ad3e5ddc97bb758517 |
adapter_model.safetensors size | 692,169,616 bytes |
| D-STEER code commit | 84b50df41dd83fee78de149e6f849cb8e09c8c8e |
| Model artifact manifest SHA-256 | a16d842cb1fc0212a0a081b4c49183b2053e5902b00b90dfda255992a1a6a609 |
training_args.bin SHA-256 (recorded, not published) | see PROVENANCE.json |
PROVENANCE.json in this repository records the SHA-256 of every published file. |
Apache-2.0, inherited from the base model
teknium/OpenHermes-2.5-Mistral-7B (Apache-2.0), which is itself
derived from mistralai/Mistral-7B-v0.1
(Apache-2.0). This adapter contains no Llama-derived weights.