Skip to main content

🥛 milky

Minimal dataset toolkit for building and cleaning User/Assistant .mlk training data.

Designed for small language model pipelines like Author.


📌 Overview

milky is a lightweight utility for:

  • appending training pairs
  • reading .mlk datasets
  • validating dataset format
  • sanitizing corrupted samples
  • repairing broken entries
  • dataset statistics
  • dataset quality scoring
  • automatic formatting (multiline-safe)

It is intentionally simple and file-based.


⚙️ Initialization

When imported, milky prints:

[YYYY-MM-DD] Milky initialized.

📄 Dataset Format (.mlk)

Each line follows:

User: <prompt> Assistant: <response><eos>

Example

User: What is AI? Assistant: AI is the study of intelligent systems.<eos>
User: Write a poem Assistant: The sea is calm tonight...<eos>

🧠 Multiline Handling

milky automatically converts real newlines into safe escaped format:

\n → \\n

So all samples remain single-line safe.


🚀 API Reference


append()

append(prompt: str, response: str, target_file: str) -> None

Appends a User/Assistant pair to a .mlk dataset.

Behavior:

  • validates .mlk extension
  • automatically formats input (cleaning + newline escaping)
  • ensures single-line storage
  • appends <eos> token

read()

read(target_file: str) -> list

Reads dataset file.

Returns:

  • raw list of dataset lines

Notes:

  • validates .mlk extension
  • no parsing or decoding applied

check()

check(file_path: str) -> list

Validates dataset structure.

Detects:

  • empty lines
  • missing User:
  • missing Assistant:
  • missing <eos>

Output:

  • colored CLI diagnostics
  • returns (line_number, error_type) list

sanitize()

sanitize(file_path: str, apply: bool = False)

Removes invalid dataset entries.

Removes:

  • empty lines
  • malformed samples

Behavior:

  • apply=False → preview only
  • apply=True → overwrites file

repair()

repair(file_path: str, apply: bool = False)

Attempts to fix malformed entries instead of deleting them.

Fixes:

  • adds missing <eos>
  • normalizes spacing
  • drops unfixable lines

Behavior:

  • apply=False → preview mode
  • apply=True → writes file

stats()

stats(file_path: str) -> dict

Computes dataset metrics.

Measures:

  • total lines
  • valid samples
  • empty lines
  • malformed lines
  • missing <eos>
  • average prompt length
  • average response length

Notes:

  • automatically decodes escaped newlines (\\n → \n)
  • used for dataset inspection before training

score()

score(file_path: str) -> float

Returns a 0–100 dataset quality score.

What it evaluates:

  • ratio of valid samples
  • malformed lines penalty
  • missing <eos> penalty
  • empty line penalty

Interpretation:

  • 90–100 → clean dataset (train-ready)
  • 70–89 → good but slightly noisy
  • 40–69 → needs cleaning
  • <40 → unsafe / unstable dataset

🧠 Design Philosophy

milky is:

  • minimal
  • dependency-free
  • file-based
  • strict format enforcement
  • optimized for small LLM pipelines

It does NOT:

  • support JSON / Parquet datasets
  • perform tokenization
  • handle streaming data
  • manage multi-file corpora

⚠️ Important Notes

  • .mlk format is strict
  • each sample must be single-line
  • <eos> is required for training stability
  • sanitize is destructive (use carefully)
  • repair is heuristic-based
  • formatting is automatic in append()

🥛 Why “milky”?

Because it turns raw text into structured training pairs — cleaning noise into model-ready data.


📦 Typical Workflow

append → check → stats → score → sanitize → repair → train

🚀 Example Workflow

append("Hello", "Hi!", "data.mlk")

errors = check("data.mlk")

info = stats("data.mlk")

quality = score("data.mlk")

cleaned, removed = sanitize("data.mlk", apply=True)

fixed, changes = repair("data.mlk", apply=True)

Metadata

Release files for milky 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for milky 0.1.2
File Size Uploaded Provenance Actions
milky-0.1.2.tar.gz 4.8 kB Without provenance Details for milky-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for milky 0.1.2
File Interpreter ABI Platform Actions
milky-0.1.2-py3-none-any.whl Python 3 none any Details for milky-0.1.2-py3-none-any.whl

Total release size: 9.9 kB

Release files / milky-0.1.2.tar.gz

Download URL milky-0.1.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
766b069cec95a1bff4cda26587b3db4b36aed32744964d0fb0a073fe9496eb2a
BLAKE2b-256 checksum
How to use checksums
e3e1578915317af4e8dcc56ac46181109320624e2bc76044399cf1010a2a77bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / milky-0.1.2-py3-none-any.whl

Download URL milky-0.1.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
999760467f160506a98c0b81514ec8b13dfb81ab405aa757df1ffd07c6ea900d
BLAKE2b-256 checksum
How to use checksums
5b322944ef7fabc224a6b4055cdacadd7a7743f66dedb4bb7a8da58ccffeabce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for milky 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page