Instructions to use hannacla/unlearned_OLMo-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hannacla/unlearned_OLMo-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hannacla/unlearned_OLMo-7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hannacla/unlearned_OLMo-7B") model = AutoModelForCausalLM.from_pretrained("hannacla/unlearned_OLMo-7B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hannacla/unlearned_OLMo-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hannacla/unlearned_OLMo-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hannacla/unlearned_OLMo-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hannacla/unlearned_OLMo-7B
- SGLang
How to use hannacla/unlearned_OLMo-7B 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 "hannacla/unlearned_OLMo-7B" \ --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": "hannacla/unlearned_OLMo-7B", "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 "hannacla/unlearned_OLMo-7B" \ --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": "hannacla/unlearned_OLMo-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hannacla/unlearned_OLMo-7B with Docker Model Runner:
docker model run hf.co/hannacla/unlearned_OLMo-7B
The model is based on the SemEval-2025 Task 4 on unlearning sensitive content from LLMs. To forget examples of the forget set and memorize information from the retain set, the model was finetuned leveraging sequential data sampling combined with negative preference optimization (NPO), cross entropy loss and the Rényi divergence using LoRA. The approach and model are introduced in the paper "Parameter-Efficient Unlearning for Large Language Models – Leveraging NPO, Rényi Divergence, and Sequential Data Sampling" by Clausen 2025.
Trained and evaluated on the validation set, the model achieves the following scores:
Note that the MIA data for the validation set has not been published, hence, the MIA score could not be computed. Further, the final test set is unaivalable.
Disclaimer: The finetuned model is based on the specifically finetuned OLMo-7B model used in the task which in turn is the OLMo-7B-0724-Instruct-hf. Hence, it may generate harmful completions after inappropriate user prompts and is primarily intended for research purposes.
Example Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Import tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("hannacla/unlearned_OLMo-7B")
model = AutoModelForCausalLM.from_pretrained("hannacla/unlearned_OLMo-7B")
# Define pad token
tokenizer.pad_token = tokenizer.eos_token
# Generation function based on question and answer of retain or forget set
def gen(question, answer):
input_ids = tokenizer(
question,
return_tensors='pt'
).input_ids
with torch.no_grad():
out = model.generate(input_ids, max_new_tokens=512, do_sample=False, use_cache=True, pad_token_id=tokenizer.eos_token_id)
output = tokenizer.decode(
out[0],
skip_special_tokens=True,
clean_up_tokenization_spaces=True)
print(f'Input: {question} \n Answer: {answer} \n Output: {output}')
Citation
@inproceedings{clausen-2025-unlearning,
title = "Parameter-Efficient Unlearning for Large Language Models – Leveraging NPO, Rényi Divergence, and Sequential Data Sampling",
author = "Hannah Clausen",
booktitle = "Proceedings of the Seventh IN5550 Workshop on Neural Natural Language Processing (WNNLP 2025)",
editors = "Andrey Kutuzov and David Samuel and Vladislav Mikhailov and Roxana Pop and Sondre Wold",
month = june,
year = "2025",
publisher = "University of Oslo, Norway",
pages = "88--98"
}
Contact
Please write a community message or contact Hannah Clausen (hannacla@ifi.uio.no) if you have any questions about this model.
- Downloads last month
- 5