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 installed (version 4.50.0 or higher)1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "baidu/ERNIE-4.5-21B-A3B-Base-PT"
4
5# load the tokenizer and the model
6tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
8
9prompt = "Large language model is"
10model_inputs = tokenizer([prompt], add_special_tokens=False, return_tensors="pt").to(model.device)
11
12generated_ids = model.generate(
13 model_inputs.input_ids,
14 max_new_tokens=1024
15)
16result = tokenizer.decode(generated_ids[0].tolist(), skip_special_tokens=True)
17print("result:", result)vllm serve baidu/ERNIE-4.5-21B-A3B-Base-PT --trust-remote-code1@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}