FlagOS is a unified heterogeneous computing software stack for large models, co-developed with leading global chip manufacturers. With core technologies such as the FlagScale distributed training/inference framework, FlagGems universal operator library, FlagCX communication library, and FlagTree unified compiler, the FlagRelease platform leverages the FlagOS stack to automatically produce and release various combinations of <chip + open-source model>. This enables efficient and automated model migration across diverse chips, opening a new chapter for large model deployment and application.
Based on this, the ERNIE-4.5-300B-A47B-PT-FlagOS-Nvidia model is adapted for the Nvidia chip using the FlagOS software stack, enabling:
Out-of-the-box inference scripts with pre-configured hardware and software parameters
Released FlagOS-A800 container image supporting deployment within minutes
Consistency Validation
Rigorously evaluated through benchmark testing: Performance and results from the FlagOS software stack are compared against native stacks on multiple public.
Technical Overview
FlagScale Distributed Training and Inference Framework
FlagScale is an end-to-end framework for large models across heterogeneous computing resources, maximizing computational efficiency and ensuring model validity through core technologies. Its key advantages include:
Unified Deployment Interface: Standardized command-line tools support one-click service deployment across multiple hardware platforms, significantly reducing adaptation costs in heterogeneous environments.
Intelligent Parallel Optimization: Automatically generates optimal distributed parallel strategies based on chip computing characteristics, achieving dynamic load balancing of computation/communication resources.
Seamless Operator Switching: Deep integration with the FlagGems operator library allows high-performance operators to be invoked via environment variables without modifying model code.
FlagGems Universal Large-Model Operator Library
FlagGems is a Triton-based, cross-architecture operator library collaboratively developed with industry partners. Its core strengths include:
Full-stack Coverage: Over 100 operators, with a broader range of operator types than competing libraries.
High Efficiency: Employs unique code generation and runtime optimization techniques for faster secondary development and better runtime performance compared to alternatives.
FlagEval Evaluation Framework
FlagEval (Libra)** is a comprehensive evaluation system and open platform for large models launched in 2023. It aims to establish scientific, fair, and open benchmarks, methodologies, and tools to help researchers assess model and training algorithm performance. It features:
Multi-dimensional Evaluation: Supports 800+ model evaluations across NLP, CV, Audio, and Multimodal fields, covering 20+ downstream tasks including language understanding and image-text generation.
Industry-Grade Use Cases: Has completed horizontal evaluations of mainstream large models, providing authoritative benchmarks for chip-model performance validation.
Execution on Master Node IP---Modify the serve.yaml file
In serve.yaml, set USE_FLAGGEMS to true; change docker to the name of the launched container (e.g., flagos); set ssh_port to the worker nodes' IP and the port where openssh-server is running (usually 22)
python
1vim /repos/FlagScale/examples/ernie45/conf/serve.yaml
2defaults:3- _self_
4- serve: 300b
56experiment:7 exp_name: ernie45_300b
8 exp_dir: outputs/${experiment.exp_name}9 task:10type: serve
11 runner:12 hostfile: examples/ernie45/conf/hostfile.txt
13 nnodes:214 nproc_per_node:815 docker: flagos # Change to the name of the launched container (e.g., flagos)16 ssh_port:22# Change to the worker nodes' IP and the port where openssh-server is running (usually 22)17 deploy:18 use_fs_serve: false
19 envs:20 CUDA_VISIBLE_DEVICES:0,1,2,3,4,5,6,721 CUDA_DEVICE_MAX_CONNECTIONS:122 USE_FLAGGEMS: true
23 RAY_CGRAPH_get_timeout:60# should be set when USE_FLAGGEMS=true, default is 10 from ray24 cmds:25 before_start: source /root/miniconda3/bin/activate flagscale-inference
2627action: run
2829hydra:30 run:31dir: ${experiment.exp_dir}/hydra
32
Execution on Master Node IP---Modify the serve/300b.yaml file
In serve/300b.yaml, set the model path to /models/ERNIE-4.5-300B-A47B-PT
python
1vim /repos/FlagScale/examples/ernie45/conf/serve/300b.yaml
2- serve_id: vllm_model
3 engine: vllm
4 engine_args:5 model:/models/ERNIE-4.5-300B-A47B-PT # add Post-trained models6 host:0.0.0.07 max_model_len:1280008 max_num_seqs:256# for high-throughput server9 uvicorn_log_level: warning
10 port:3000011 engine_args_specific:12 vllm:13 tensor_parallel_size:814 pipeline_parallel_size:215 gpu_memory_utilization:0.9816 trust_remote_code: true
17 enforce_eager: true # enforce_eager is recommended to be set true, false may trigger unknown but reproduced NCCL exception18 enable_chunked_prefill: true
19 profile:20 prefix_len:021 input_len:102422 output_len:102423 num_prompts:12824 range_ratio:1
Enter the flagscale-inference environment and reinstall flagscale
Set up passwordless access from the master container to worker host machines
Write the contents of the ~/.ssh/id_rsa.pub file from the flagos container on the master node into the ~/.ssh/authorized_keys file on the worker nodes' physical machines.
Serve
Execution on Master Node IP
python
1cd /repos/FlagScale
2flagscale serve ernie45
34#After the service starts, you will see output similar to the following:5#INFO 07-08 09:49:51 [api_server.py:1349] Starting vLLM API server 0 on http://0.0.0.0:300006
Service Invocation
API-based Invocation Script
import openai
openai.api_key = "EMPTY"
openai.base_url = "http://<server_ip>:30000/v1/"
model = "/models/ERNIE-4.5-300B-A47B-PT"
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What's the weather like today?"}
]
response = openai.chat.completions.create(
model=model,
messages=messages,
stream=False,
)
for item in response:
print(item)