Run this model with HF Jobs

Run olaverse/YellowMIST-Encoder-15M-ESA 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-ESA. 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-ESA 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.
olumideola's picture
YellowMIST-Encoder-15M-ESA (from base-latn-africa-central-east-south-dew-1-enc-hybrid-full-s0)
eb90093 verified
Raw History Blame Contribute Delete
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)