A bridge library to convert and connect Megatron-Core checkpoints to Hugging Face format and support Reinforcement Learning workflows. Current version 0.15.1, with frequent releases matching Megatron-Core versions. Supports LLMs and VLMs including DeepSeek v3, GLM-4.5, Gemma 3, InternVL3.
Install & Compatibility
Where this runs
tested against v0.15.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from mbridge import BridgeConverter
Basic usage of BridgeConverter to convert between Hugging Face and Megatron-Core formats.
from mbridge import BridgeConverter
converter = BridgeConverter(
hf_model_path="path/to/hf/model",
mc_model_path="/path/to/mcore/model",
model_type="llama",
num_layers=32,
hidden_size=4096,
num_attention_heads=32,
tensor_parallel=1,
pipeline_parallel=1
)
# Convert Hugging Face to Megatron-Core
converter.hf_to_mc()
# Convert Megatron-Core to Hugging Face
converter.mc_to_hf()
mbridge --version
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.