A tool for transforming conversational data to a unified format
Project description
Convector
Introduction
Convector is a tool designed to facilitate the unification of conversational datasets into a consistent format. Capable of handling various dataset formats including JSONL, Parquet, Zstandard (Zst), JSON.GZ, CSV, and TXT, Convector converts them into JSONL format. The user can choose to filter data during transformation for enhanced customization. It offers flexibility in output formats with options like the default format and chat_completion format, the latter being compliant with OpenAI's format.
Installation
Convector can be installed either via PyPI or directly from GitHub.
- Using PyPI: Run
pip install convectorin the terminal. - Using GitHub: Clone and install using the following commands:
git clone https://github.com/teilomillet/convector cd convector pip install .
Usage
Convector provides a command-line interface for easy data processing with various customization options.
-
Basic Command:
convector process <file_path> [OPTIONS] -
Options:
-p, --profile: Predefined profile from the config (default is 'default').-c, --conversation: Allow to process conversational exchanges.--instruction: Key for instructions or system messages.-i, --input-key: Key for user inputs.-o, --output-key: Key for bot responses.-s, --schema: Schema of the output data.--filter: Filter conditions in "field,operator,value" format.-l, --limit: Limit to a number of lines.--bytes: Limit to a number of bytes.-f, --file-out: File for transformed data.-d, --dir-out: Directory for output files.-v, --verbose: Enable detailed logs.
-
Example Commands:
- Process each file in a folder:
convector process /path/to/data/
- Process the file
data.jsonl, which is a conversation-c, keep all the data with anidunder 10500, the output will be saved in/path/to/output_dir/output.jsonl:convector process /data.jsonl -c --filter id<10500 -f output.jsonl -d /output_dir/
- Process the file
data.parquetand output the data into achat_completionformat with theidanduser_idat each row. (the output data will be saved indata_tr.jsonlinside the default output location (convector/silo)):convector process /data.parquet --filter "id;user_id" --schema chat_completion
- Register a profile name
sampler, process333lines of the filedata.parquetand save the output into achat_completionformat in a file namesampler.jsonl:convector process /data.json -p sampler -l 333 -s chat_completion -f sampler.jsonl
- Process all the files in the folder
/data, using all the commands previously saved in the profilesampler(see above):convector process /data/ -p sampler
- Process each file in a folder:
Advanced Features
- Conversational Data Handling: Convector efficiently processes nested conversational data. Using the
--conversationcommand, it can identify and handle complex conversation structures, auto-generating aconversation_idwhen needed. - Customization: Users can customize the data fields to be retained during processing with the
--filteroption. By default, Convector keepsinstruction,input, andoutput. Additional fields can be included as required. - Folder Handling: Convector can go through folders to process the data inside it. It will by default, create a file using
_trat the end if no--file-outis specified.
Configuration and Customization
- Profile Customization: Users can define and use custom profiles for different types of data processing tasks inside the
config.yaml. The profile will automatically be saved and updated if used with new commands. - Schema Application: Convector allows for the application of custom schemas to tailor the output according to specific requirements.
- Default Schema:
{"instruction":"","input":"","output":"","source":""}
- Chat_completion Schema:
"messages": [ {"role": "system", "content": ""}, {"role": "user", "content": ""}, {"role": "assistant", "content": ""} ], "source":""
- Default Schema:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file convector-0.1.1.tar.gz.
File metadata
- Download URL: convector-0.1.1.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa1e6fc739d211c3412d108f528c110112b5790dc96f843de2e834dd40f9f591
|
|
| MD5 |
d3eadebb784b4c27947397a05a3e3d80
|
|
| BLAKE2b-256 |
0bd12c504cd637d5a40f7a71ac24a2e1b1db2b91baf35a79713a09f5011ea2b9
|
File details
Details for the file convector-0.1.1-py3-none-any.whl.
File metadata
- Download URL: convector-0.1.1-py3-none-any.whl
- Upload date:
- Size: 42.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f6185413c5dd44b2e8a15527f24e3708478177fb68e8b42f65cef05f4acaa24
|
|
| MD5 |
c1cc78df8014b134a9180d617751c679
|
|
| BLAKE2b-256 |
81f72ff917736f81a33fc01110c2fd87a21f806b5c1df09a6bd44994270cb72d
|