--- license: mit language: en library_name: transformers pipeline_tag: translation base_model: google/t5-efficient-tiny tags: - cron - scheduling - t5 - transformers.js - onnx - cronlm - text2text-generation --- # cronlm Tiny natural-language to cron model. Pluggable into [@huggingface/transformers](https://github.com/huggingface/transformers.js). - Base: `google/t5-efficient-tiny` (~16M params) - Shipped: INT8 ONNX (encoder + decoder + decoder-with-past), ~36 MB total - Accuracy: **99.2%** on 4 000 fresh synthetic samples · **97.3%** on a hand-crafted adversarial set - Validity: **100%** of outputs are parseable 5-field cron - Latency: ~3 ms / item on a laptop CPU ## Usage ### Browser / Node — transformers.js ```js import { pipeline } from "@huggingface/transformers"; const cron = await pipeline("text2text-generation", "pavstev/cronlm"); const out = await cron("every weekday at 9am".toLowerCase()); console.log(out[0].generated_text); // "0 9 * * 1-5" ``` Lowercase the input before passing — bumps accuracy on Title-Case inputs by ~2.5 pp. ### Python — transformers ```py from transformers import pipeline cron = pipeline("text2text-generation", model="pavstev/cronlm") print(cron("every weekday at 9am")[0]["generated_text"]) # "0 9 * * 1-5" ``` ## Examples | Input | Output | | --- | --- | | every 5 minutes | `*/5 * * * *` | | every weekday at 9am | `0 9 * * 1-5` | | at 10:30 PM on Sundays | `30 22 * * 0` | | every 15 minutes between 9 and 17 | `*/15 9-17 * * *` | | every Mon and Wed at noon | `0 12 * * 1,3` | | on the 1st of every month | `0 0 1 * *` | | every quarter | `0 0 1 1,4,7,10 *` | | at midnight | `0 0 * * *` | | `@daily` | `0 0 * * *` | | MWF at 9am | `0 9 * * 1,3,5` | | every December 25 | `0 0 25 12 *` | | from the 1st to the 5th at noon | `0 12 1-5 * *` | | every 30 minutes during business hours | `*/30 9-17 * * 1-5` | ## Validation A pure-Python validator/fixer is included in the [`cronlm`](https://github.com/pavstev/cronlm) package — wrap model output to catch any rare invalid generation: ```py from cronlm import fix fix("0 25 * * 1") # "0 23 * * 1" ``` ## Training Source, dataset generator, and training scripts: ## License MIT