File size: 2,343 Bytes
b8945a6
 
 
 
ba8bee3
 
 
 
 
 
 
b8945a6
 
 
 
ba8bee3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8945a6
c87157f
b8945a6
c87157f
 
b8945a6
 
 
ba8bee3
b8945a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba8bee3
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
66
67
68
69
70
71
72
73
74
75
---
license: apache-2.0
base_model: google/bigbird-roberta-base
tags:
- eduscore
- data filter
inference: false
datasets:
- HuggingFaceFW/fineweb-edu-llama3-annotations
language:
- en
---


[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/pszemraj/eduscore-regression/runs/04oc07hx)
# bigbird-roberta-base: eduscore 

Similar to the [original](https://hf.co/HuggingFaceFW/fineweb-edu-classifier), this model predicts a score of 0 to 5 on 'educational quality' of some text. This model was fine-tuned @ its max context length of 4096 tokens.


## Usage

Note this is for CPU, for GPU you will need to make some (small) changes.

```py
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_name = "pszemraj/bigbird-roberta-base-edu-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(
    model_name, attn_implementation="eager"
)

text = "This is a test sentence."
inputs = tokenizer(text, return_tensors="pt", padding="longest", truncation=True)
outputs = model(**inputs)
logits = outputs.logits.squeeze(-1).float().detach().numpy()
score = logits.item()
result = {
    "text": text,
    "score": score,
    "int_score": int(round(max(0, min(score, 5)))),
}

print(result)
# {'text': 'This is a test sentence.', 'score': 0.20170727372169495, 'int_score': 0}
```

## Details

This model is a fine-tuned version of [google/bigbird-roberta-base](https://huggingface.co/google/bigbird-roberta-base) on the HuggingFaceFW/fineweb-edu-llama3-annotations dataset.
It achieves the following results on the evaluation set:
- Loss: 0.2176
- Mse: 0.2176

## Intended uses & limitations

Refer to the hf classifier's [model card](https://huggingface.co/HuggingFaceFW/fineweb-edu-classifier#limitations) for more details

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 1e-05
- train_batch_size: 4
- eval_batch_size: 4
- seed: 90085
- gradient_accumulation_steps: 32
- total_train_batch_size: 128
- optimizer: Adam with betas=(0.9,0.98) and epsilon=1e-09
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.05
- num_epochs: 1.0