CoolFace
Modelpublic

BananaMind/MicroBananaMind-v1

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
3likes188downloads
Model Card

MicroBananaMind-v1

[image] MicroBananaMind-v1 is a very small causal language model trained from scratch on FineWeb-Edu, FineMath, and Cosmopedia-v2.

The model has 902,272 parameters and uses a custom 1536-token byte-level BPE tokenizer with digit-aware tokenization It is our smallest model ever that is not just a TinyStories model.

Model Details

FieldValue
Parameters902,272
ArchitectureCustom Llama-style decoder
Layers4
Hidden size128
Intermediate size352
Attention heads4
KV heads1
Vocabulary size1,536
Context length1,024
EmbeddingsTied input/output embeddings
Weight formatsafetensors

Tokenizer

MicroBananaMind-v1 uses our digit-aware 1536-token tokenizer.

Training Data

DatasetTokens
FineWeb-Edu sample-10BT retokenized with 1536 digit tokenizer16,799,039,898
FineMath retokenized with 1536 digit tokenizer1,740,373,303
Cosmopedia-v2 retokenized with 1536 digit tokenizer3,458,958,651

Training setup:

FieldValue
Sequence length1,024
FineWeb sampling ratio70%
FineMath sampling ratio10%
Cosmopedia sampling ratio20%
Batch size128
Gradient accumulation8
Tokens per optimizer step1,048,576
Training steps20,963
Approx training tokens seen21,981,298,688
Learning rate8e-4
Minimum learning rate8e-5
Warmup steps500
Weight decay0.1
Seed1337

We recommend using a temperature of 0 or 0.1

Usage

This model uses custom architecture code, so load it with trust_remote_code=True.

bash
pip install -U transformers safetensors torch
python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "BananaMind/MicroBananaMind-v1"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    torch_dtype=torch.bfloat16 if torch.cuda.is_available() and torch.cuda.is_bf16_supported() else torch.float16,
).cuda().eval()

prompt = "The color of the sky is "
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)

with torch.no_grad():
    output = model.generate(
        input_ids=input_ids,
        max_new_tokens=64,
        do_sample=False,
        repetition_penalty=1.1,
        pad_token_id=tokenizer.eos_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

print(tokenizer.decode(output[0], skip_special_tokens=True))

License

Apache 2.0