Registry / ai-ml / mbridge

mbridge

JSON →
library0.15.1pypypiunverified

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.

pip install mbridge
INSTALL
IMPORT
SIG · MBRIDGE
M
mbridge
ai-mlpythonv0.15.1
Install
1.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.8MB
glibc
py 3.103.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.

BridgeConverter
from mbridge import BridgeConverter
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
Debug
Known issues
breakingFrom v0.15.0, `tie_embedding_weights` handling changed. Checkpoints converted with older versions may have mismatched embedding layers.
fix
Re-run conversion with v0.15.0+ and set `tie_word_embedding=True` if needed.
affects: < 0.15.0
gotchaTensor and pipeline parallelism settings must match the Megatron-Core training configuration. Mismatched settings can cause silent shape errors.
fix
Ensure `tensor_parallel` and `pipeline_parallel` are identical to the values used during training.
affects: all
deprecatedThe `--model-parallel-size` argument has been deprecated in favor of `--tensor-model-parallel-size` and `--pipeline-model-parallel-size`.
fix
Use `tensor_parallel` and `pipeline_parallel` parameters in the BridgeConverter API.
affects: >=0.13.0
Upgrade
Version history
0.15.1latest on PyPI · released Sep 22, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
32
Amazon
1
OpenAI (training)
1
Resources
mbridge — pip install mbridge · libregistry