File size: 1,764 Bytes
1852aa7
 
 
 
 
f83bcb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1852aa7
 
 
 
 
 
 
 
f83bcb2
 
 
1852aa7
 
 
 
 
 
 
 
 
f83bcb2
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
library_name: transformers
tags: []
---

# ELM Llama3-8B-Instruct Model Card

> [**Erasing Conceptual Knoweldge from Language Models**](https://arxiv.org/abs/2410.02760),            
> Rohit Gandikota, Sheridan Feucht, Samuel Marks, David Bau

#### How to use
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "baulab/elm-Meta-Llama-3-8B-Instruct"
device = 'cuda:0'
dtype = torch.float32

model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=dtype)
model = model.to(device)
model.requires_grad_(False)
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

# generate text
inputs = tokenizer(prompt, return_tensors='pt', padding=True)
inputs = inputs.to(device).to(dtype)

outputs = model.generate(**inputs,
                         max_new_tokens=300,
                         do_sample=True,
                         top_p=.95,
                         temperature=1.2)

outputs = tokenizer.batch_decode(outputs, skip_special_tokens = True)
print(outputs[0])
```
<!-- Provide a quick summary of what the model is/does. -->



### Model Sources [optional]

<!-- Provide the basic links for the model. -->

- **Repository:** https://github.com/rohitgandikota/erasing-llm
- **Paper [optional]:** https://arxiv.org/pdf/2410.02760
- **Project [optional]:** https://elm.baulab.info



## Citation [optional]

<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->

**BibTeX:**

```
@article{gandikota2024elm,
  title={Erasing Conceptual Knowledge from Language Models},
  author={Rohit Gandikota and Sheridan Feucht and Samuel Marks and David Bau},
  journal={arXiv preprint arXiv:2410.02760},
  year={2024}
}
```