{"id":21561,"library":"mbridge","title":"mbridge","description":"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.","status":"active","version":"0.15.1","language":"python","source_language":"en","source_url":"https://github.com/ISEEKYAN/mbridge","tags":["megatron-core","huggingface","checkpoint-conversion","deep-learning","llm"],"install":[{"cmd":"pip install mbridge","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"BridgeConverter is not a top-level module; it must be imported from the mbridge package.","wrong":"import BridgeConverter","symbol":"BridgeConverter","correct":"from mbridge import BridgeConverter"},{"note":"convert_checkpoint is exposed at the top level, not under utils.","wrong":"from mbridge.utils import convert_checkpoint","symbol":"convert_checkpoint","correct":"from mbridge import convert_checkpoint"}],"quickstart":{"code":"from mbridge import BridgeConverter\n\nconverter = BridgeConverter(\n    hf_model_path=\"path/to/hf/model\",\n    mc_model_path=\"/path/to/mcore/model\",\n    model_type=\"llama\",\n    num_layers=32,\n    hidden_size=4096,\n    num_attention_heads=32,\n    tensor_parallel=1,\n    pipeline_parallel=1\n)\n# Convert Hugging Face to Megatron-Core\nconverter.hf_to_mc()\n# Convert Megatron-Core to Hugging Face\nconverter.mc_to_hf()\n","lang":"python","description":"Basic usage of BridgeConverter to convert between Hugging Face and Megatron-Core formats."},"warnings":[{"fix":"Re-run conversion with v0.15.0+ and set `tie_word_embedding=True` if needed.","message":"From v0.15.0, `tie_embedding_weights` handling changed. Checkpoints converted with older versions may have mismatched embedding layers.","severity":"breaking","affected_versions":"< 0.15.0"},{"fix":"Ensure `tensor_parallel` and `pipeline_parallel` are identical to the values used during training.","message":"Tensor and pipeline parallelism settings must match the Megatron-Core training configuration. Mismatched settings can cause silent shape errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `tensor_parallel` and `pipeline_parallel` parameters in the BridgeConverter API.","message":"The `--model-parallel-size` argument has been deprecated in favor of `--tensor-model-parallel-size` and `--pipeline-model-parallel-size`.","severity":"deprecated","affected_versions":">=0.13.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install mbridge` in the correct environment.","cause":"mbridge is not installed or installed in a different Python environment.","error":"ModuleNotFoundError: No module named 'mbridge'"},{"fix":"Provide a positive integer for `num_layers` (e.g., 32 for Llama-7B).","cause":"num_layers argument is missing or non-integer.","error":"ValueError: num_layers must be positive integer"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}