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.
Instructions to use olaverse/YellowMIST-Encoder-15M-ESA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use olaverse/YellowMIST-Encoder-15M-ESA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="olaverse/YellowMIST-Encoder-15M-ESA")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("olaverse/YellowMIST-Encoder-15M-ESA", device_map="auto") - Notebooks
- Google Colab
- Kaggle
card: how to use it with and without the yellowmist library, and how to fine-tune
Browse files100 unmodified lines101102103104105106107108109110111112113114115116117118119120121122123124125100 unmodified lines## Use```pythonimport json, sys, unicodedata, torchsys.path.insert(0, ".") # this repo, which ships the `dew` packageimport dew # registers the Dew architecture with transformersfrom transformers import AutoModelForMaskedLMmodel = AutoModelForMaskedLM.from_pretrained(".").eval()v = json.load(open("vocab.json")) # {"vocab": [...], "labels": [...]}ids = {t: i for i, t in enumerate(v["vocab"])}def encode(text, lang):text = unicodedata.normalize("NFC", text)return torch.tensor([[ids[f"<|lang:{lang}|>"]] + [ids.get(c, 1) for c in text]]) # 1 = <unk>hidden = model.model(encode("Your text here", "afr_Latn"))[0] # [1, 1 + chars, 320], one vector per character```To fine-tune, put a small head on `hidden` (one label per character or word) and train the whole model with a lowlearning rate (3e-4 worked for our tasks).## Limits100 unmodified lines101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144100 unmodified lines## Use### With the yellowmist library (recommended)This is a base model to fine-tune. The finished tasks built on it (punctuation, language of every word, wordboundaries) ship in the `yellowmist` library: `pip install yellowmist`, see the [documentation](https://olaverse-labs.github.io/yellowmist/).```pythonfrom yellowmist import train # pip install "yellowmist[train]"enc = train.Encoder.load("ESA") # this modeltrain.continue_pretraining(enc, {"swh_Latn": paragraphs}, steps=2000) # keep pretraining on your textmodel = train.finetune_punct(enc, {"swh_Latn": paragraphs}) # or finetune_switch(...)model.save("my-model") # weights + ONNX, ready for ym.register / model=```The [fine-tuning notebook](https://github.com/Olaverse-Labs/yellowmist/blob/main/notebooks/finetune_yellowmist.ipynb) ([open in Colab](https://colab.research.google.com/github/Olaverse-Labs/yellowmist/blob/main/notebooks/finetune_yellowmist.ipynb)) walks through every step, including adding newlanguages and sharing your model on the Hub.### Without the library (transformers)```pythonimport json, unicodedata, torchimport dew # pip install "dew-lm[hf]": registers the Dew architecturefrom huggingface_hub import hf_hub_downloadfrom transformers import AutoModelForMaskedLMmodel = AutoModelForMaskedLM.from_pretrained("olaverse/YellowMIST-Encoder-15M-ESA").eval()vocab = json.load(open(hf_hub_download("olaverse/YellowMIST-Encoder-15M-ESA", "vocab.json")))["vocab"]ids = {t: i for i, t in enumerate(vocab)}text = unicodedata.normalize("NFC", "Your text here")x = torch.tensor([[ids["<|lang:swh_Latn|>"]] + [ids.get(c, 1) for c in text]]) # 1 = <unk>with torch.no_grad():hidden = model.model(x)[0] # [1, 1 + characters, hidden], one vector per character```To fine-tune by hand, put a small head on `hidden` (one label per character or word) and train the whole model witha low learning rate (3e-4 worked for our tasks).**More:** [documentation](https://olaverse-labs.github.io/yellowmist/) · [GitHub](https://github.com/Olaverse-Labs/yellowmist) · [playground](https://huggingface.co/spaces/olaverse/yellowmist-playground) · [fine-tuning notebook](https://github.com/Olaverse-Labs/yellowmist/blob/main/notebooks/finetune_yellowmist.ipynb)## Limits
README.md+32-13