Translation
Transformers
ONNX
Transformers.js
English
t5
text2text-generation
cron
scheduling
cronlm
Instructions to use pavstev/cronlm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pavstev/cronlm with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="pavstev/cronlm")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("pavstev/cronlm") model = AutoModelForSeq2SeqLM.from_pretrained("pavstev/cronlm") - Transformers.js
How to use pavstev/cronlm with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('translation', 'pavstev/cronlm'); - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("pavstev/cronlm")
model = AutoModelForSeq2SeqLM.from_pretrained("pavstev/cronlm")Quick Links
cronlm
Tiny natural-language to cron model. Pluggable into @huggingface/transformers.
- 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
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
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 package β wrap model output to catch any rare invalid generation:
from cronlm import fix
fix("0 25 * * 1") # "0 23 * * 1"
Training
Source, dataset generator, and training scripts: https://github.com/pavstev/cronlm
License
MIT
- Downloads last month
- 50
Model tree for pavstev/cronlm
Base model
google/t5-efficient-tiny
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="pavstev/cronlm")