File size: 659 Bytes
fc31cfb
 
 
 
 
 
 
 
 
 
 
 
ae54b00
fc31cfb
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
# Simple script to convert StackExchange XML to Open Assistant format
# Original code by https://github.com/b-mc2

from datasets import load_dataset

PARQUET_FILE = "stackexchange.parquet"
HF_DATASET = "donfu/oa-stackexchange"


def upload_hf():
    """
    Upload to Hugging Face. Make sure you are logged in beforehand with `huggingface-cli login`
    """
    parquet_file = PARQUET_FILE
    dataset = load_dataset("parquet", data_files=parquet_file, name="oa-stackexchange")
    dataset.push_to_hub(HF_DATASET, max_shard_size="500MB")
    print("Uploaded to Hugging Face: " + HF_DATASET)


if __name__ == "__main__":
    upload_hf()