Views
No views yet
pip install transformers torch xformers==0.0.28.post3pip install transformers torch xformers==0.0.28.post3 flash_attn1from transformers import AutoModel, AutoTokenizer
2
3model_name = "chandar-lab/NeoBERT"
4tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
5model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
6
7# Tokenize input text
8text = "NeoBERT is the most efficient model of its kind!"
9inputs = tokenizer(text, return_tensors="pt")
10
11# Generate embeddings
12outputs = model(**inputs)
13embedding = outputs.last_hidden_state[:, 0, :]
14print(embedding.shape)| Feature | NeoBERT |
|---|---|
Depth-to-width | 28 × 768 |
Parameter count | 250M |
Activation | SwiGLU |
Positional embeddings | RoPE |
Normalization | Pre-RMSNorm |
Data Source | RefinedWeb |
Data Size | 2.8 TB |
Tokenizer | google/bert |
Context length | 4,096 |
MLM Masking Rate | 20% |
Optimizer | AdamW |
Scheduler | CosineDecay |
Training Tokens | 2.1 T |
Efficiency | FlashAttention |
1@misc{breton2025neobertnextgenerationbert,
2 title={NeoBERT: A Next-Generation BERT},
3 author={Lola Le Breton and Quentin Fournier and Mariam El Mezouar and Sarath Chandar},
4 year={2025},
5 eprint={2502.19587},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2502.19587},
9}