Downloads · 30 days
0
dreuxx26/HRM-Grammar-Light
HRM-Grammar-Light is a machine learning model from dreuxx26. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Multilingual lightweight grammar-correction model based on a decoder-only HRM-like architecture with Adaptive Computation Time (ACT). Trains from prompt+target pairs, supports community contributions (safe contrib bra…
Downloads · 30 days
0
Access
Public
Updated Aug 16, 2025
Repo size
4.3 GB
Likes
0
Public
Click a slice to open those files.
.pt256 MB · 67%
From the Hugging Face model README
Multilingual lightweight grammar-correction model based on a decoder-only HRM-like architecture with Adaptive Computation Time (ACT). Trains from prompt+target pairs, supports community contributions (safe contrib branches), and runs efficiently on T4 and A100.
nnm.py implements data prep, training, validation, and Hub uploads.dreuxx26/HRM-Grammar-Light (weights/checkpoints uploaded by the trainer).Your dataset should provide at least these columns:
input_text: Original text to correct. Optionally prefixed like corregir español: ... (if not present, the script infers/cleans it).target_text: Corrected text target.language: If present, it’s normalized; rare classes are collapsed to other for stable splits.Two ways to load the data:
HRM_DATASET_HUB_ID (e.g., your_user/hrm_grammar_light). Optional: HRM_DATASET_CONFIG, HRM_DATASET_SPLIT, HRM_DATASET_REVISION.HF_TOKEN in Colab Secrets to enable Hub uploads.nnm.py in Colab (the script auto-mounts Drive and installs deps when in Colab)."corregir {idioma}: " + </s> + target + </s> and masks the prompt (labels = -100) so loss is on the target only.Key features during training:
Mixed precision autocast: bf16 on A100 (Ampere+), fp16 on T4 automatically.
TF32 enabled only on Ampere+.
Gradient checkpointing (toggle with HRM_CHECKPOINTING).
Token-weighted epoch averages and validation metrics (loss, token-acc, normalized edit distance). Jump in and train
Colab (1-click): https://colab.research.google.com/drive/1pMrC_Mgk-EcULxvYCj6QsfLic0VlBxGF?usp=sharing
original: https://colab.research.google.com/drive/1Q9pqGU8pP79qYX0josznBZzo6HrQsOYA?usp=sharing
Enable contributors to train for 1–2 epochs and upload without touching main:
HRM_COMMUNITY_MODE=1 and HRM_CONTRIB=<handle>.manifest.json and uploads to contrib/<handle>-<timestamp>.HRM_ALLOW_REGRESSION=1.BEST when it’s the best val loss so far.HF_REPO_ID: Model repo to upload (default: dreuxx26/HRM-Grammar-Light).HRM_DATASET_HUB_ID, HRM_DATASET_CONFIG, HRM_DATASET_SPLIT, HRM_DATASET_REVISION.LOCAL_DATASET_PATH: Drive folder with .arrow files (fallback when no Hub dataset).HRM_EPOCHS (default 10), HRM_BLOCK_SIZE (default 256), HRM_BATCH_SIZE (default 8), HRM_LR (default 3e-4), HRM_WARMUP_RATIO (default 0.1).HRM_EFF_BATCH: target effective batch size (auto-adjusts grad accumulation).HRM_CHECKPOINTING (1/0), HRM_ACT_STEPS (default 8), HRM_ACT_EPS (default 0.01).HRM_DEEP_SUPERVISION (0/1), HRM_DS_WEIGHT (0.2 by default).HRM_COMMUNITY_MODE (0/1), HRM_CONTRIB, HRM_UPLOAD_BRANCH (optional explicit branch), HRM_ALLOW_REGRESSION (0/1).HRM_BLOCK_SIZE at 192–256.HRM_EFF_BATCH to reach your desired effective batch while avoiding OOM.HRM_CHECKPOINTING=1).HF_TOKEN is present, the trainer saves weights (pytorch_model.bin), a checkpoint state (local_training_state.pt), and manifest.json locally.contrib/<handle>-<timestamp>; otherwise to main.HRM_ALLOW_REGRESSION=1.HRM_BLOCK_SIZE, increase HRM_GRAD_ACCUM via HRM_EFF_BATCH, keep checkpointing on.HF_TOKEN in Colab Secrets or as an environment variable.HRM_DATASET_HUB_ID exists and is public (or authenticated), or ensure Arrow files are in the Drive path.