Downloads · 30 days
4
13% of all-time downloads
RheaTinghe/stat214-lab3-bert-lora-r8-maxlen256
stat214-lab3-bert-lora-r8-maxlen256 is a machine learning model from RheaTinghe. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapter for bert-base-uncased, fine-tuned on transcripts from the Huth Lab fMRI story-listening dataset for the Stat 214 (Spring 2026) final project at UC Berkeley.
Downloads · 30 days
4
13% of all-time downloads
All-time downloads
30
Public
Repo size
1.2 MB
Likes
0
Public
Click a slice to open those files.
.safetensors1.2 MB · 100%
From the Hugging Face model README
LoRA adapter for bert-base-uncased, fine-tuned on transcripts from the
Huth Lab fMRI story-listening dataset for the Stat 214 (Spring 2026)
final project at UC Berkeley.
The adapter is used to extract context-aware word embeddings that are then fed into a per-voxel ridge regression to predict whole-brain BOLD signal from spoken-story stimuli.
| Hyperparameter | Value |
|---|---|
| Base model | bert-base-uncased |
LoRA rank r | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.1 |
| Target modules | query, value |
| Training objective | Masked Language Modeling (MLM, 15%) |
| Training stories | 86 (Huth Lab podcast transcripts) |
| MLM max sequence length | 256 |
| Epochs | 3 |
| Optimizer | AdamW, lr=2e-4 |
| Batch size | 16 |
| Final MLM training loss | — |
After extracting per-word embeddings from this adapter (using ±10 word context windows + Lanczos downsampling + 4 TR delays) and fitting per-voxel ridge regression on Subjects 2 and 3:
| Subject | Mean CC | Top 5% CC | Top 1% CC | Top-1 voxel |
|---|---|---|---|---|
| Subject 2 | 0.0645 | 0.2146 | 0.2908 | 0.4776 |
| Subject 3 | 0.0657 | 0.2172 | 0.3041 | 0.5159 |
(See full project repository for ridge weights, evaluation code, and SHAP / LIME word-importance analyses.)
from transformers import BertForMaskedLM, BertTokenizerFast
from peft import PeftModel
tokenizer = BertTokenizerFast.from_pretrained("bert-base-uncased")
base = BertForMaskedLM.from_pretrained("bert-base-uncased")
model = PeftModel.from_pretrained(base, "RheaTinghe/stat214-lab3-bert-lora-r8-maxlen256")
model.eval()
# Extract per-word embeddings via ±10 word context windows
# (see scripts/run_bert_pretrained.py in the project repo for the
# complete extraction pipeline)
@misc{stat214lab3,
author = {Galloro, Drew and Wang, Ruihang and Khothsombath, Benjamin and Zhang, Rhea},
title = {Stat 214 Lab 3: BERT-LoRA encoding model for fMRI},
year = {2026},
note = {UC Berkeley Spring 2026},
}