Upload GPT-2 fine-tuned on wikitext-2 via bergson MAGIC
Browse files- README.md +83 -0
- config.json +41 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +12 -0
README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- gpt-2
|
| 7 |
+
- wikitext
|
| 8 |
+
- magic
|
| 9 |
+
- bergson
|
| 10 |
+
- fine-tuned
|
| 11 |
+
base_model: gpt2
|
| 12 |
+
datasets:
|
| 13 |
+
- Salesforce/wikitext
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# bergson MAGIC checkpoint — GPT-2 fine-tuned on wikitext-2
|
| 17 |
+
|
| 18 |
+
GPT-2 (124M) fine-tuned on
|
| 19 |
+
`Salesforce/wikitext` `wikitext-2-raw-v1` `train` (chunked at 512
|
| 20 |
+
tokens) via the [`bergson`](https://github.com/EleutherAI/bergson)
|
| 21 |
+
MAGIC pipeline. This is the exact checkpoint used to generate the
|
| 22 |
+
attribution scores published at
|
| 23 |
+
[`EleutherAI/bergson-magic-scores-gpt-2`](https://huggingface.co/datasets/EleutherAI/bergson-magic-scores-gpt-2).
|
| 24 |
+
|
| 25 |
+
## Loading
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 29 |
+
model = AutoModelForCausalLM.from_pretrained("EleutherAI/bergson-magic-gpt-2")
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/bergson-magic-gpt-2")
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## YAML used to produce this checkpoint
|
| 34 |
+
|
| 35 |
+
```yaml
|
| 36 |
+
- magic:
|
| 37 |
+
run_path: runs/gpt2_wikitext
|
| 38 |
+
model: gpt2
|
| 39 |
+
overwrite: true
|
| 40 |
+
|
| 41 |
+
data:
|
| 42 |
+
dataset: Salesforce/wikitext
|
| 43 |
+
subset: wikitext-2-raw-v1
|
| 44 |
+
split: "train"
|
| 45 |
+
chunk_length: 512
|
| 46 |
+
|
| 47 |
+
query:
|
| 48 |
+
dataset: Salesforce/wikitext
|
| 49 |
+
subset: wikitext-2-raw-v1
|
| 50 |
+
split: "test[3:4]"
|
| 51 |
+
chunk_length: 0
|
| 52 |
+
|
| 53 |
+
distributed:
|
| 54 |
+
nproc_per_node: 4
|
| 55 |
+
nnode: 4
|
| 56 |
+
|
| 57 |
+
batch_size: 256
|
| 58 |
+
num_epochs: 2
|
| 59 |
+
lr_schedule:
|
| 60 |
+
lr_scheduler_type: polynomial
|
| 61 |
+
lr: 0.0008
|
| 62 |
+
lr_start: 1e-6
|
| 63 |
+
lr_end: 0.00008
|
| 64 |
+
warmup_steps: 0.25
|
| 65 |
+
|
| 66 |
+
subset_strategy: random
|
| 67 |
+
wandb_project: magic
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
Saved as `examples/magic/compare/q3_magic.yaml` in the bergson repo.
|
| 71 |
+
|
| 72 |
+
Run with:
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
bergson pipeline examples/magic/compare/q3_magic.yaml
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
The `bergson magic` step trains the model on the train split via its
|
| 79 |
+
own training loop (it must, because MAGIC's attribution scores are
|
| 80 |
+
the gradients of query loss with respect to per-example training
|
| 81 |
+
weights, computed by back-propagating through training). The final
|
| 82 |
+
trained weights end up at the `hf_model/` subdirectory of the run
|
| 83 |
+
path; that's what was uploaded here.
|
config.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"add_cross_attention": false,
|
| 4 |
+
"architectures": [
|
| 5 |
+
"GPT2LMHeadModel"
|
| 6 |
+
],
|
| 7 |
+
"attn_pdrop": 0.1,
|
| 8 |
+
"bos_token_id": 50256,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"embd_pdrop": 0.1,
|
| 11 |
+
"eos_token_id": 50256,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"layer_norm_epsilon": 1e-05,
|
| 14 |
+
"model_type": "gpt2",
|
| 15 |
+
"n_ctx": 1024,
|
| 16 |
+
"n_embd": 768,
|
| 17 |
+
"n_head": 12,
|
| 18 |
+
"n_inner": null,
|
| 19 |
+
"n_layer": 12,
|
| 20 |
+
"n_positions": 1024,
|
| 21 |
+
"pad_token_id": null,
|
| 22 |
+
"reorder_and_upcast_attn": false,
|
| 23 |
+
"resid_pdrop": 0.1,
|
| 24 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 25 |
+
"scale_attn_weights": true,
|
| 26 |
+
"summary_activation": null,
|
| 27 |
+
"summary_first_dropout": 0.1,
|
| 28 |
+
"summary_proj_to_labels": true,
|
| 29 |
+
"summary_type": "cls_index",
|
| 30 |
+
"summary_use_proj": true,
|
| 31 |
+
"task_specific_params": {
|
| 32 |
+
"text-generation": {
|
| 33 |
+
"do_sample": true,
|
| 34 |
+
"max_length": 50
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"tie_word_embeddings": true,
|
| 38 |
+
"transformers_version": "5.3.0",
|
| 39 |
+
"use_cache": true,
|
| 40 |
+
"vocab_size": 50257
|
| 41 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 50256,
|
| 4 |
+
"eos_token_id": 50256,
|
| 5 |
+
"transformers_version": "5.3.0"
|
| 6 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e45c55d2e40ccb2b05297a465ded21d62afc4a9fd042c60489f3ab3d67da71ff
|
| 3 |
+
size 497774208
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"errors": "replace",
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"model_max_length": 1024,
|
| 9 |
+
"pad_token": null,
|
| 10 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 11 |
+
"unk_token": "<|endoftext|>"
|
| 12 |
+
}
|