File size: 993 Bytes
dbad91c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Hugging Face Dataset Exporter

This script exports data from a Postgres database to a Hugging Face dataset in Parquet format.

## Setup

1.  **Install dependencies:**

    Navigate to this directory and install the required Python packages.

    ```bash
    pip install -r requirements.txt
    ```

2.  **Set environment variables:**

    The script uses environment variables for database credentials. You can set them in your shell or use a `.env` file.

    ```bash
    export DB_USER="your_db_user"
    export DB_PASSWORD="your_db_password"
    export DB_HOST="localhost"
    export DB_PORT="5432"
    export DB_NAME="your_db_name"
    ```

## Usage

Run the script from the root of the repository:

```bash
python scripts/hf_export/export.py --output_dir /path/to/your/dataset
```

The script will create a directory at the specified output path containing the dataset in Parquet format. If `--output_dir` is not provided, it will save to `hf_dataset` in the current working directory.