-
Notifications
You must be signed in to change notification settings - Fork 54
mtp for verl #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ArronHZG
wants to merge
9
commits into
ISEEKYAN:main
Choose a base branch
from
ArronHZG:feature/verl_mtp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−12
Open
mtp for verl #62
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8d14f00
use_mtp
ArronHZG 88fa317
rm use_mtp
ArronHZG 1b18b06
use AutoConfig to change hf config
ArronHZG 059cd00
refactor code
ArronHZG bbcff60
set mtp_loss_scaling_factor
ArronHZG 2978b69
trust_remote_code=True
ArronHZG 6bf2d45
for transformer >= 5.0.0
ArronHZG 3fffba7
change mimo
ArronHZG 9a02d0e
Merge branch 'main' into feature/verl_mtp
ArronHZG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| import torch | ||
| from megatron.core import parallel_state as mpu | ||
| from megatron.core.tensor_parallel.random import model_parallel_cuda_manual_seed | ||
| from transformers import AutoTokenizer | ||
| from transformers import AutoTokenizer, AutoConfig | ||
|
|
||
| from mbridge import AutoBridge | ||
|
|
||
|
|
@@ -27,9 +27,17 @@ def init_distributed(): | |
|
|
||
| def load_model(hf_model_path, trust_remote_code=False): | ||
| """Load model""" | ||
| bridge = AutoBridge.from_pretrained( | ||
|
|
||
| # use AutoConfig to change hf config | ||
| config = AutoConfig.from_pretrained( | ||
| hf_model_path, trust_remote_code=trust_remote_code | ||
| ) | ||
|
|
||
| if hasattr(config, "num_nextn_predict_layers"): | ||
| config.num_nextn_predict_layers = 0 | ||
|
|
||
| bridge = AutoBridge.from_config(config) | ||
|
|
||
|
Comment on lines
7
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes should not be needed |
||
| model = bridge.get_model() | ||
| bridge.load_weights(model, hf_model_path) | ||
| return model | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| class SafeTensorIO: | ||
| def __init__(self, hf_dir: str): | ||
| index_file = os.path.join(hf_dir, "model.safetensors.index.json") | ||
| config = AutoConfig.from_pretrained(hf_dir) | ||
| config = AutoConfig.from_pretrained(hf_dir, trust_remote_code=True) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can't set trust_remove_code by default |
||
|
|
||
| self.index = {} | ||
| self.origin_index = {} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we set this, is this a debug code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArronHZG This should not be needed once the patches here are applied #62 (comment)