Instructions to use JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu")# Load model directly from transformers import T2MLRWrapper model = T2MLRWrapper.from_pretrained("JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu
- SGLang
How to use JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu with Docker Model Runner:
docker model run hf.co/JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu
T2MLR_362M_lstart9_lend24_50B_FineWebEdu
T2MLR (Transformer with Temporal Middle-Layer Recurrence) applies a recurrent connection across a contiguous band of middle layers, carrying a recurrent state between token positions. This checkpoint is a 362M model pretrained from scratch on FineWeb-Edu for ~51.5B tokens.
Configuration
| Parameters | 366.4M |
| Layers | 32 |
| Hidden size | 960 |
| Recurrent band | T2MLR(9,24) — layers 9–24 inclusive, 1-indexed |
l_start / l_end in config.json |
8 / 23 (0-indexed) |
| Recurrent layers | 16 of 32 |
| Mixing module | gated |
| Precision | bfloat16 |
| Training tokens | ~51.5B (100,000 steps) |
| Final training loss | 2.5055 |
Architecture follows SmolLM2 (Llama-style, GQA, SwiGLU, RoPE) with the T2MLR wrapper applied over the middle-layer band. Tokenizer is the SmolLM2 tokenizer (49,152 tokens).
Usage
This model uses a custom wrapper, so load it with the reference implementation rather
than a bare AutoModel call:
git clone https://github.com/princeton-pli/T2MLR.git
cd T2MLR && pip install -r requirements.txt
The loader reads from a local directory, so download the repo first with
snapshot_download rather than passing the repo id straight to it.
import sys, torch
sys.path.insert(0, "T2MLR/src")
from huggingface_hub import snapshot_download
from t2mlr_wrapper import T2MLRWrapper
from transformers import AutoTokenizer
path = snapshot_download("JupiterZhu/T2MLR_362M_lstart9_lend24_50B_FineWebEdu")
model = T2MLRWrapper.from_pretrained_with_t2mlr(path, attn_impl="sdpa", dtype=torch.bfloat16).eval()
tok = AutoTokenizer.from_pretrained(path)
inputs = tok("The capital of France is", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=32, do_sample=False,
pad_token_id=tok.eos_token_id)
print(tok.decode(out[0], skip_special_tokens=True))
control_flows is required for direct forward calls
When T2MLR is enabled, forward() requires a control_flows tensor shaped like
input_ids. Values <= 1 run the plain (non-recurrent) path; values > 1 mark
positions that participate in recurrence. generate() sets this up for you.
ids = tok("The capital of France is", return_tensors="pt").input_ids
cf = torch.full_like(ids, 2) # 2 => recurrent
logits = model(input_ids=ids, attention_mask=torch.ones_like(ids),
control_flows=cf).logits
Running with control_flows = 1 everywhere disables the recurrence and gives
substantially worse loss — the recurrent band carries a large share of the model's
capability.
Notes
- These are base models trained on a general web corpus with no instruction tuning or alignment. Greedy decoding from short prompts is often repetitive; this is normal for models at this scale and token budget.
- Outputs may be inaccurate, biased, or offensive, reflecting the pretraining data.
Citation
Official implementation: https://github.com/princeton-pli/T2MLR
- Downloads last month
- 187