File size: 1,423 Bytes
87d8758
72efd6d
2d0bcfc
 
87d8758
de4850a
72efd6d
de4850a
 
 
72efd6d
eda2644
 
 
 
 
 
 
 
 
 
 
 
72efd6d
eda2644
 
 
 
 
72efd6d
eda2644
 
72efd6d
eda2644
 
2d0bcfc
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-nc-4.0
datasets:
- clane9/NSD-Flat
---

# Model card for `boldgpt_small_patch10.kmq`

![Example training predictions](example.png)

A Vision Transformer (ViT) model trained on BOLD activation maps from [NSD-Flat](https://huggingface.co/datasets/clane9/NSD-Flat). Patches were quantized to discrete tokens using k-means (`KMeansTokenizer`). The training objective was to auto-regressively predict the next patch with shuffled patch order and cross-entropy loss.

## Dependencies

- [boldGPT](https://github.com/clane9/boldGPT)

## Usage

```python
from boldgpt.data import ActivityTransform
from boldgpt.models import create_model
from datasets import load_dataset

model = create_model("boldgpt_small_patch10.kmq", pretrained=True)

dataset = load_dataset("clane9/NSD-Flat", split="train")
dataset.set_format("torch")

transform = ActivityTransform()
batch = dataset[:1]
batch["activity"] = transform(batch["activity"])

# output: (B, N + 1, K) predicted next token logits
output, state = model(batch)
```

## Reproducing

- Training command:

  ```bash
  torchrun --standalone --nproc_per_node=4 \
    scripts/train_gpt.py --out_dir results \
    --model boldgpt_small \
    --ps 10 --vs 1024 --vocab_state checkpoints/ps-10_vs-1024_vss-4000_seed-42/tok_state.pt \
    --shuffle --epochs 1000 --bs 512 \
    --workers 0 --amp --compile --wandb
  ```
- Commit: `f9720ca52d6fa6b3eb47a34cf95f8e18a8683e4c`