Run this model with HF Jobs
Run olaverse/YellowMIST-Encoder-15M-AP on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AP. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AP on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use olaverse/YellowMIST-Encoder-15M-AP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use olaverse/YellowMIST-Encoder-15M-AP with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="olaverse/YellowMIST-Encoder-15M-AP")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("olaverse/YellowMIST-Encoder-15M-AP", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download dew/presets.py from olaverse/YellowMIST-Encoder-15M-AP: direct link, hf CLI and curl.
- Browser
- Download file 2.99 kB
-
https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AP/resolve/main/dew/presets.py
- Command line
-
hf download hf://olaverse/YellowMIST-Encoder-15M-AP/dew/presets.py
-
curl -L -o presets.py https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AP/resolve/main/dew/presets.py
2.99 kB
| """Named Dew-1 layouts and sizing to a parameter budget. | |
| from dew import dew_config, fit_params | |
| cfg = fit_params(dew_config("dew-1-loop", vocab_size=16384, hidden_size=320), 15_160_640) | |
| """ | |
| from __future__ import annotations | |
| import torch | |
| from .configuration_dew import DewConfig | |
| PRESETS = { | |
| # Nap & Loop: 1 awake layer, a shared G-G-A block run 0-3 times per word, 1 awake attention layer | |
| "dew-1-loop": dict(prelude="G", body="GGA", coda="A", max_loops=3, doorman=True, ffn="nap"), | |
| # Nap hybrid: DeltaNet:attention 2:1, Nap thinker in every layer, no doorman | |
| "dew-1-nap": dict(prelude="", body="GGAGGA", coda="", max_loops=1, doorman=False, ffn="nap"), | |
| # Selective-memory hybrid: as dew-1-nap with a doorman that lets words skip the middle layers | |
| "dew-1-napskip": dict(prelude="G", body="GGAG", coda="A", max_loops=1, doorman=True, ffn="nap", target_passes=0.5), | |
| # Encoders (masked-LM bases): DeltaNet both ways + attention without the causal mask | |
| "dew-1-enc": dict(prelude="", body="GGAGGA", coda="", max_loops=1, doorman=False, ffn="nap", causal=False), | |
| "dew-1-enc-hybrid": dict(prelude="", body="GGAGGA", coda="", max_loops=1, doorman=False, ffn="dense", causal=False), | |
| "dew-1-enc-dense": dict(prelude="", body="AAAAAAAA", coda="", max_loops=1, doorman=False, ffn="dense", causal=False), | |
| # Controls | |
| "dew-1-hybrid": dict(prelude="", body="GGAGGA", coda="", max_loops=1, doorman=False, ffn="dense"), | |
| "dew-1-dense": dict(prelude="", body="AAAAAAAA", coda="", max_loops=1, doorman=False, ffn="dense"), | |
| } | |
| def dew_config(preset: str, **overrides) -> DewConfig: | |
| if preset not in PRESETS: | |
| raise KeyError(f"unknown preset {preset!r}; choose from {sorted(PRESETS)}") | |
| return DewConfig(**{**PRESETS[preset], **overrides}) | |
| def count_params(cfg: DewConfig) -> int: | |
| from .modeling_dew import DewForCausalLM, DewForMaskedLM | |
| with torch.device("meta"): | |
| m = DewForCausalLM(cfg) if cfg.causal else DewForMaskedLM(cfg) | |
| if cfg.tie_word_embeddings: | |
| m.lm_head.weight = m.model.embed_tokens.weight | |
| return sum(p.numel() for p in m.parameters()) | |
| def fit_params(cfg: DewConfig, target: int, multiple: int = 8) -> DewConfig: | |
| """Resize the thinkers so the whole model has about `target` parameters. | |
| Nap thinker: expert width (shared expert = 2x expert width). Dense: intermediate size.""" | |
| key = "expert_intermediate_size" if cfg.ffn == "nap" else "intermediate_size" | |
| def with_width(w): | |
| kw = cfg.to_dict() | |
| kw[key] = int(w) | |
| if cfg.ffn == "nap": | |
| kw["shared_intermediate_size"] = int(2 * w) | |
| for k in ("model_type", "transformers_version", "architectures"): | |
| kw.pop(k, None) | |
| return DewConfig(**kw) | |
| a, b = 64, 128 | |
| na, nb = count_params(with_width(a)), count_params(with_width(b)) | |
| slope = (nb - na) / (b - a) | |
| w = max(multiple, round((a + (target - na) / slope) / multiple) * multiple) | |
| return with_width(w) | |