Instructions to use YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept") model = AutoModelForCausalLM.from_pretrained("YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept
- SGLang
How to use YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept 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 "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept" \ --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": "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept", "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 "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept" \ --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": "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept with Docker Model Runner:
docker model run hf.co/YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept
Gemma-2-2B-it, Ancient Rome unlearned with MEMIT+Empty
An unlearned model from the experiments of Intrinsic Evaluation of Unlearning Using Parametric Knowledge Traces (Hong, Yu, Ravfogel, Yang and Geva; EMNLP 2025): google/gemma-2-2b-it after unlearning the concept Ancient Rome.
| Base model | google/gemma-2-2b-it |
| Unlearning method | MEMIT+Empty (the memit/ code with dummy_string=True) |
| Target | the concept Ancient Rome |
- Paper: arXiv:2406.11614
- Code: github.com/yihuaihong/ConceptVectors
- Benchmark: YihuaiHong/ConceptVectors
Loading
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "YihuaiHong/gemma2-2b-it_MEMIT_Empty_unlearn_on_Ancient-Rome_concept"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto")
Intended use
Research on machine unlearning, for example testing whether the concept's knowledge is still present in the parameters. Unlearning here is not a safety guarantee: the paper finds that many unlearning methods change the model's behaviour while the concept's parametric knowledge largely remains.
Citation
@article{hong2024intrinsic,
title = {Intrinsic Evaluation of Unlearning Using Parametric Knowledge Traces},
author = {Hong, Yihuai and Yu, Lei and Ravfogel, Shauli and Yang, Haiqin and Geva, Mor},
year = {2024},
journal = {arXiv preprint arXiv:2406.11614}
}
- Downloads last month
- 22