Views
No views yet
[!NOTE] Note: "-Paddle" models use PaddlePaddle weights, while "-PT" models use Transformer-style PyTorch weights.
[!NOTE] Note: The Base model only supports text completion. For evaluation, use thecompletionAPI (notchat_completion) in vLLM/FastDeploy.
| Key | Value |
|---|---|
| Modality | Text |
| Training Stage | Pretraining |
| Params(Total / Activated) | 21B / 3B |
| Layers | 28 |
| Heads(Q/KV) | 20 / 4 |
| Text Experts(Total / Activated) | 64 / 6 |
| Vision Experts(Total / Activated) | 64 / 6 |
| Shared Experts | 2 |
| Context Length | 131072 |
transformers librarytransformers library (version 4.54.0 or newer) installed to use this model.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_name = "baidu/ERNIE-4.5-21B-A3B-Base-PT"
5
6# load the tokenizer and the model
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8model = AutoModelForCausalLM.from_pretrained(
9 model_name,
10 device_map="auto",
11 torch_dtype=torch.bfloat16,
12)
13
14prompt = "Large language model is"
15model_inputs = tokenizer([prompt], add_special_tokens=False, return_tensors="pt").to(model.device)
16
17generated_ids = model.generate(
18 **model_inputs,
19 max_new_tokens=1024
20)
21result = tokenizer.decode(generated_ids[0].tolist(), skip_special_tokens=True)
22print("result:", result)vllm serve baidu/ERNIE-4.5-21B-A3B-Base-PT1@misc{ernie2025technicalreport,
2 title={ERNIE 4.5 Technical Report},
3 author={Baidu ERNIE Team},
4 year={2025},
5 eprint={},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={}
9}