-
Notifications
You must be signed in to change notification settings - Fork 199
update merge_lora script #2688
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
Merged
+32
−20
Merged
update merge_lora script #2688
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
Oops, something went wrong.
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.
🧩 Analysis chain
🌐 Web query:
In the current PyTorch documentation, what defaults does torch.distributed.init_process_group() use when only backend="gloo" is passed, and which environment variables are required for env:// initialization?💡 Result:
Defaults used by
torch.distributed.init_process_group(backend="gloo")(i.e., onlybackendpassed)From the current PyTorch docs, the function signature/defaults are:
init_process_group(backend=None, init_method=None, timeout=None, world_size=-1, rank=-1, store=None, group_name='', pg_options=None, device_id=None, ...). (docs.pytorch.org)So with only
backend="gloo"passed, the defaults in effect are:init_method: assumed to be"env://"(because neitherstorenorinit_methodis specified). (docs.pytorch.org)timeout: 30 minutes (docs: “10 minutes for NCCL and 30 minutes for other backends”; Gloo is “other backends”). (docs.pytorch.org)world_size: -1 (meaning it must be provided viaenv://env vars or explicitly). (docs.pytorch.org)rank: -1 (meaning it must be provided viaenv://env vars or explicitly). (docs.pytorch.org)store=None,group_name='',pg_options=None,device_id=None(and other shown defaults). (docs.pytorch.org)Environment variables required for
env://initializationPyTorch docs list these variables for
env://:MASTER_PORT— requiredMASTER_ADDR— required (except for rank 0)WORLD_SIZE— required (unless you passworld_sizedirectly)RANK— required (unless you passrankdirectly) (docs.pytorch.org)Citations:
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 2363
🏁 Script executed:
# Also look for the docstring/description of what --cpu is supposed to do head -n 50 examples/peft/merge_lora.pyRepository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 1931
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 682
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 673
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 53
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 616
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 1106
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 237
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 1942
🏁 Script executed:
Repository: NVIDIA-NeMo/Megatron-Bridge
Length of output: 1468
Supply explicit single-rank configuration for standalone CPU usage or document required environment variables.
The docstring advertises
python merge_lora.py ... --cpuas a standalone single-process example, but the code callstorch.distributed.init_process_group("gloo")without explicitrank,world_size, orinit_method. PyTorch defaultsinit_methodto"env://"when not specified, requiringMASTER_PORT,MASTER_ADDR,WORLD_SIZE, andRANKenvironment variables—which will not be set in a standalone Python invocation. Either pass explicit parameters (e.g.,rank=0, world_size=1) or document that users must export these environment variables before running the CPU example.🤖 Prompt for AI Agents