add script to convert training snippets into a jsonl file
This commit is contained in:
1 parent
af8a510d15
commit
a7db571513
6 files changed
+97
-4
No files matched your search
@@ -1,3 +1,54 @@
|
||||
# kuberdata
|
||||
|
||||
Large Language Model training dataset
|
||||
Large Language Model training dataset
|
||||
|
||||
## Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- [uv](https://docs.astral.sh/uv/) — a fast Python package and project manager. Install it with:
|
||||
|
||||
```sh
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
```
|
||||
|
||||
(or `brew install uv` on macOS)
|
||||
|
||||
- A Python interpreter (e.g. 3.10+). If none is installed, `uv` can fetch one automatically:
|
||||
|
||||
```sh
|
||||
uv python install 3.12
|
||||
```
|
||||
|
||||
### Create a virtual environment
|
||||
|
||||
From the repository root, create and activate a virtual environment with uv:
|
||||
|
||||
```sh
|
||||
# Create .venv (a Python interpreter is selected or fetched automatically)
|
||||
uv venv
|
||||
|
||||
# Activate it
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### dir-to-jsonl script
|
||||
|
||||
`scripts/dir-to-jsonl.py` reads all `.json` files in a directory, minifies each one, and appends them as lines to an output JSONL file. It uses only the Python standard library, so no extra packages are required.
|
||||
|
||||
```sh
|
||||
python scripts/dir-to-jsonl.py <directory> <output.jsonl>
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```sh
|
||||
python scripts/dir-to-jsonl.py data/kubernetes-documentation-website/training training.jsonl
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- The output file is **appended to**, so delete it first if you want a fresh build.
|
||||
- Files that fail to parse are skipped with a warning on stderr.
|
||||
Reference in new issue
Block a user