Download data_loader.py from JetBrains-Research/commit-message-editing: direct link, hf CLI and curl.
- Browser
- Download file 514 Bytes
-
https://huggingface.co/spaces/JetBrains-Research/commit-message-editing/resolve/main/data_loader.py
- Command line
-
hf download hf://spaces/JetBrains-Research/commit-message-editing/data_loader.py
-
curl -L -o data_loader.py https://huggingface.co/spaces/JetBrains-Research/commit-message-editing/resolve/main/data_loader.py
514 Bytes
| import os | |
| from datasets import load_dataset | |
| CACHE_DIR = 'cache' | |
| N_SAMPLES = 15 | |
| REMOVED_COMMITS = ['9cc896202dc38d962c01aa2637dbc5bbc3e3dd9b'] | |
| def load_data(): | |
| df = load_dataset("JetBrains-Research/commit-rewriting-samples", | |
| split="train", | |
| token=os.environ.get('HF_REWRITING_TOKEN'), | |
| cache_dir=CACHE_DIR).to_pandas() | |
| removed_idx = df['hash'].isin(REMOVED_COMMITS) | |
| df = df[~removed_idx] | |
| return df.to_dict('records')[:N_SAMPLES] | |