File size: 7,533 Bytes
2dcd69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# RAFT Submission Template

Welcome to the RAFT benchmark! RAFT is a few-shot classification benchmark that tests language models:

- across multiple domains (lit review, tweets, customer interaction, etc.)
- on economically valuable classification tasks (someone inherently cares about the task)
- in a setting that mirrors deployment (50 examples per task, info retrieval allowed, hidden test set)

This repository can be used to generate a template so you can submit your predictions for evaluation on [the leaderboard](https://huggingface.co/spaces/ought/raft-leaderboard).

## Quickstart

### 1. Create an account and repository on the Hugging Face Hub

First create an account on the Hugging Face Hub and you can sign up [here](https://huggingface.co/join) if you haven't already!

### 2. Create a template repository on your machine

The next step is to create a template repository on your local machine that contains various files and a CLI to help you validate and submit your predictions. You can run the following commands to create the repository:

```bash
# Install the following libraries if you don't have them
pip install cookiecutter huggingface-hub==0.0.16
# Create the template repository
cookiecutter https://github.com/oughtinc/raft_submission.git
```

This will ask you to specify your Hugging Face Hub username, password, and the name of the repository:

```
hf_hub_username [<huggingface>]:
hf_hub_password [<password>]:
repo_name [<my-raft-submissions>]:
```

This will trigger the following steps:

1. Create a private dataset repository on the Hugging Face Hub under `{hf_hub_username}/{repo_name}`
2. Clone the repository to your local machine
3. Add various template files and commit them locally to the repository

The resulting repository should have the following structure:

```
my-raft-submission
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md                           <- The top-level README with submission instructions
β”œβ”€β”€ cli.py                              <- The CLI for installing dependencies, validating predictions, and making submissions
β”œβ”€β”€ data
β”‚Β Β  β”œβ”€β”€ ade_corpus_v2                   <- The predictions for each task are stored in their corresponding directory
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv             <- A CSV file of the predictions with `ID` and `Label` columns
β”‚Β Β  β”‚Β Β  └── task.json                   <- Configuration file for loading the predictions. Do not edit!
β”‚Β Β  β”œβ”€β”€ banking_77
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ neurips_impact_statement_risks
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ one_stop_english
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ overruling
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ semiconductor_org_types
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ systematic_review_inclusion
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ tai_safety_research
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ terms_of_service
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  β”œβ”€β”€ tweet_eval_hate
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictions.csv
β”‚Β Β  β”‚Β Β  └── task.json
β”‚Β Β  └── twitter_complaints
β”‚Β Β      β”œβ”€β”€ predictions.csv
β”‚Β Β      └── task.json
β”œβ”€β”€ my-raft-submission.py               <- Script to load predictions during evaluation. Do not edit!
└── requirements.txt                    <- The requirements file for the submissions
```

### 3. Install the dependencies

The final step is to install the project's dependencies. We recommend creating a Python virtual environment for the project, e.g. with Anaconda:

```bash
# Navigate to the template repository
cd my-raft-submissions
# Create and activate a virtual environment
conda create -n raft python=3.8 && conda activate raft
# Install dependencies
python cli.py install
```

That's it! You're now all set to start generating predictions - see the instructions below on how to submit them to the Hub.

## Submitting to the leaderboard

To make a submission to the [leaderboard](https://huggingface.co/spaces/ought/raft-leaderboard), there are three main steps:

1. Generate predictions on the unlabeled test set of each task
2. Validate the predictions are compatible with the evaluation framework
3. Push the predictions to the Hub!

See the instructions below for more details.

### Rules

1. To prevent overfitting to the public leaderboard, we only evaluate **one submission per week**. You can push predictions to the Hub as many times as you wish, but we will only evaluate the most recent commit in a given week.
2. Transfer or meta-learning using other datasets, including further pre-training on other corpora, is allowed.
3. Use of unlabeled test data is allowed, as is it always available in the applied setting. For example, further pre-training using the unlabeled data for a task would be permitted.
4. Systems may be augmented with information retrieved from the internet, e.g. via automated web searches.


### Submission file format

For each task in RAFT, you should create a CSV file called `predictions.csv` with your model's predictions on the unlabeled test set. Each file should have exactly 2 columns:

* ID (int)
* Label (string)

See the dummy predictions in the `data` folder for examples with the expected format. Each `predictions.csv` file should be stored in the task's subfolder in `data` and at the end you should have something like the following:

```
data
β”œβ”€β”€ ade_corpus_v2
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ banking_77
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ neurips_impact_statement_risks
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ one_stop_english
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ overruling
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ semiconductor_org_types
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ systematic_review_inclusion
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ tai_safety_research
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ terms_of_service
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
β”œβ”€β”€ tweet_eval_hate
β”‚   β”œβ”€β”€ predictions.csv
β”‚   └── task.json
└── twitter_complaints
    β”œβ”€β”€ predictions.csv
    └── task.json
```

### Validate your submission

To ensure that your submission files are correctly formatted, run the following command from the root of the repository:

```
python cli.py validate
```

If everything is correct, you should see the following message:

```
All submission files validated! ✨ πŸš€ ✨
Now you can make a submission πŸ€—
```

### Push your submission to the Hugging Face Hub!

The final step is to commit your files and push them to the Hub:

```
python cli.py submit
```

If there are no errors, you should see the following message:

```
Submission successful! πŸŽ‰ πŸ₯³ πŸŽ‰
Your submission will be evaulated on Sunday 05 September 2021 ⏳
```

where the evaluation is run every Sunday and your results will be visible on the leaderboard.