Instructions to use ntedvs/irex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ntedvs/irex with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("ntedvs/irex") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use ntedvs/irex with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "ntedvs/irex" --prompt "Once upon a time"
- Atomic Chat
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -25,10 +25,10 @@ $ python infer.py "a hex color code like #fff or #a1b2c3"
|
|
| 25 |
Requires Apple Silicon (MLX).
|
| 26 |
|
| 27 |
```
|
| 28 |
-
hf download
|
| 29 |
pip install -r requirements.txt
|
| 30 |
|
| 31 |
-
python infer.py "iso date like 2024-01-31"
|
| 32 |
python infer.py -k 5 "an email address" # top 5 candidates
|
| 33 |
python infer.py # interactive
|
| 34 |
```
|
|
@@ -37,13 +37,11 @@ This is a custom MLX model. It does not load with `transformers`.
|
|
| 37 |
|
| 38 |
## Model
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
| Decoding | beam search (8), reranked by: compiles, matches example strings in the request, in scope |
|
| 46 |
-
| Training | 60k steps, batch 128, about 9 passes over the data, 40 minutes on an M4 Pro |
|
| 47 |
|
| 48 |
## Scope
|
| 49 |
|
|
@@ -51,7 +49,7 @@ JS regex at an intermediate level: literals, `.`, classes, `\d \w \s \b` and neg
|
|
| 51 |
|
| 52 |
## Training data
|
| 53 |
|
| 54 |
-
About 815k English
|
| 55 |
|
| 56 |
- **Regexes:** 159k, sampled from a grammar plus realistic templates. Each is labeled with matching and non-matching strings using real JS semantics (QuickJS).
|
| 57 |
- **English:** generated by DeepSeek-V4.1-Flash in five styles: casual, terse, precise, purpose, sloppy. Plus short everyday requests.
|
|
|
|
| 25 |
Requires Apple Silicon (MLX).
|
| 26 |
|
| 27 |
```
|
| 28 |
+
hf download ntedvs/irex --local-dir irex && cd irex
|
| 29 |
pip install -r requirements.txt
|
| 30 |
|
| 31 |
+
python infer.py "iso date like 2024-01-31" # /^\d{4}-\d{2}-\d{2}$/
|
| 32 |
python infer.py -k 5 "an email address" # top 5 candidates
|
| 33 |
python infer.py # interactive
|
| 34 |
```
|
|
|
|
| 37 |
|
| 38 |
## Model
|
| 39 |
|
| 40 |
+
- **Parameters:** 2.6M (d192, 4 layers, 4 heads)
|
| 41 |
+
- **Architecture:** decoder-only, RMSNorm, RoPE, SwiGLU, tied embeddings
|
| 42 |
+
- **Tokenizer:** BPE (4096) trained from scratch for the English, one token per digit; raw bytes for the regex
|
| 43 |
+
- **Decoding:** beam search (8), reranked by: compiles, matches example strings in the request, in scope
|
| 44 |
+
- **Training:** 60k steps, batch 128, about 9 passes over the data, 40 minutes on an M4 Pro
|
|
|
|
|
|
|
| 45 |
|
| 46 |
## Scope
|
| 47 |
|
|
|
|
| 49 |
|
| 50 |
## Training data
|
| 51 |
|
| 52 |
+
About 815k English-to-regex pairs:
|
| 53 |
|
| 54 |
- **Regexes:** 159k, sampled from a grammar plus realistic templates. Each is labeled with matching and non-matching strings using real JS semantics (QuickJS).
|
| 55 |
- **English:** generated by DeepSeek-V4.1-Flash in five styles: casual, terse, precise, purpose, sloppy. Plus short everyday requests.
|