FlagOS multi-chip engine plugin for verl.
verl_plugin_fl/
├── __init__.py # Entry point: registers platform + engines
├── platform.py # Platform registration (eagerly init + FL diagnostics)
├── pyproject.toml
├── engine/
│ ├── __init__.py # Import triggers @EngineRegistry.register()
│ ├── fsdp_fl.py # FSDPFLEngineWithLMHead / FSDPFLEngineWithValueHead
│ └── megatron_fl.py # MegatronFLEngineWithLMHead
├── utils/
│ ├── __init__.py
│ └── config_manager.py # FLEnvManager, may_enable_flag_gems
└── configs/
└── vllm_plugin_fl_dispatch.yaml
# From local directory (development mode)
cd verl-plugin-fl && pip install -e .
# From GitHub
pip install git+https://github.com/flagos-ai/verl-plugin-fl.gitVERL_USE_EXTERNAL_MODULES=verl_plugin_fltriggersimportlib.import_module("verl_plugin_fl")verl_plugin_fl.__init__callsregister_platform()to eagerly initialise the platform singleton and log FL config- Then imports
verl_plugin_fl.engine, which importsfsdp_fl.pyandmegatron_fl.py - Each engine file calls
get_device_name()at import time to detect the current hardware (e.g."cuda","npu") - The
@EngineRegistry.register(device=_device)decorators override the default engine for the detected hardware ("last writer wins") EngineRegistry.get_engine_cls()uses the sameget_device_name()to look up the engine — which now resolves to the FL version
This means only VERL_USE_EXTERNAL_MODULES needs to be set — one environment variable to load the plugin.
# Set before launching training
export VERL_USE_EXTERNAL_MODULES=verl_plugin_flMultiple external modules can be comma-separated:
export VERL_USE_EXTERNAL_MODULES=verl_plugin_fl,other_plugin.module# TE-FL backend priority: flagos / vendor / reference
export TE_FL_PREFER=flagos
# Strict mode (no fallback): 1 / 0
export TE_FL_STRICT=0
# FlagGems operator switch
export USE_FLAGGEMS=true
# FlagGems operator whitelist/blacklist (comma separated, optional)
export TRAINING_FL_FLAGOS_WHITELIST="..."
export TRAINING_FL_FLAGOS_BLACKLIST="..."
# FlagCX communication
export USE_FLAGCX=1
export FLAGCX_PATH=/path/FlagCXexport VLLM_PLUGINS="fl"
export USE_FLAGGEMS=true
export VLLM_FL_OOT_ENABLED=1
export VLLM_FL_FLAGOS_BLACKLIST="where_scalar_other,where_scalar_self,where_self,where_self_out,pad"
export USE_FLAGCX=1
export FLAGCX_PATH=/path/FlagCXSee TransformerEngine-FL and vllm-plugin-FL for detailed explanations.
| Engine Class | model_type | backend | device |
|---|---|---|---|
FSDPFLEngineWithLMHead |
language_model |
fsdp, fsdp2 |
auto (get_device_name()) |
FSDPFLEngineWithValueHead |
value_model |
fsdp, fsdp2 |
auto (get_device_name()) |
MegatronFLEngineWithLMHead |
language_model |
megatron |
auto (get_device_name()) |
verl >= 0.7.0- FlagGems (optional, for Triton operator acceleration)
- FlagCX (optional, for communication)
- TransformerEngine-FL (for Megatron engine)
- vllm-plugin-FL (for rollout)