Skip to content

Commit ecbc41a

Browse files
hf name formatting in bridge guide (#352)
* Update bridge-guide.md Signed-off-by: Wenwen Gao <94138584+snowmanwwg@users.noreply.github.com> * update doc title Signed-off-by: Maanu Grover <109391026+maanug-nv@users.noreply.github.com> --------- Signed-off-by: Wenwen Gao <94138584+snowmanwwg@users.noreply.github.com> Signed-off-by: Maanu Grover <109391026+maanug-nv@users.noreply.github.com> Co-authored-by: Maanu Grover <109391026+maanug-nv@users.noreply.github.com>
1 parent f3bd988 commit ecbc41a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎docs/bridge-guide.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Megatron <-> HuggingFace Bridge User Guide
1+
# Bridge with 🤗Hugging Face
22

3-
Megatron Bridge provides seamless bidirectional conversion between HuggingFace Transformers and Megatron Core model formats. This guide covers the main APIs for loading models, checking compatibility, and converting between formats.
3+
Megatron Bridge provides seamless bidirectional conversion between 🤗Hugging Face Transformers and Megatron Core model formats. This guide covers the main APIs for loading models, checking compatibility, and converting between formats.
44

5-
## Loading a HuggingFace Model into Megatron Implementation
5+
## Loading a 🤗Hugging Face Model into Megatron Implementation
66

7-
The easiest way to load a HuggingFace model is using `AutoBridge.from_hf_pretrained()`, which automatically detects the model architecture and selects the appropriate bridge. You can then use `AutoBridge.to_megatron_model()` to initialize the Megatron model from the HuggingFace configuration and load HuggingFace weights.
7+
The easiest way to load a 🤗Hugging Face model is using `AutoBridge.from_hf_pretrained()`, which automatically detects the model architecture and selects the appropriate bridge. You can then use `AutoBridge.to_megatron_model()` to initialize the Megatron model from the 🤗Hugging Face configuration and load 🤗HuggingFace weights.
88

99
### Basic Usage
1010

@@ -71,7 +71,7 @@ The provider pattern is especially useful when you need to:
7171

7272
Before loading a model, you can check if it's supported by Megatron Bridge.
7373

74-
You can list all supported HuggingFace model architectures with the following:
74+
You can list all supported 🤗Hugging Face model architectures with the following:
7575

7676
```python
7777
from megatron.bridge import AutoBridge
@@ -100,17 +100,17 @@ if AutoBridge.can_handle("custom/model", trust_remote_code=True):
100100
bridge = AutoBridge.from_hf_pretrained("custom/model", trust_remote_code=True)
101101
```
102102

103-
## Converting back to HuggingFace
103+
## Converting back to 🤗Hugging Face
104104

105-
After training or modifying a Megatron model, you can convert it back to HuggingFace format for deployment or sharing. The bridge provides several methods for this conversion depending on your needs.
105+
After training or modifying a Megatron model, you can convert it back to 🤗Hugging Face format for deployment or sharing. The bridge provides several methods for this conversion depending on your needs.
106106

107107
To save the complete model including configuration, tokenizer, and weights:
108108

109109
```python
110110
# Save the complete model (config, tokenizer, weights)
111111
bridge.save_hf_pretrained(megatron_model, "./my-fine-tuned-llama")
112112

113-
# The saved model can be loaded with HuggingFace
113+
# The saved model can be loaded with 🤗Hugging Face
114114
from transformers import AutoModelForCausalLM
115115
hf_model = AutoModelForCausalLM.from_pretrained("./my-fine-tuned-llama")
116116
```

0 commit comments

Comments
 (0)