-
Notifications
You must be signed in to change notification settings - Fork 4
Refine merge script #92
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds configurable aggregation options to a model merging script, allowing users to specify custom weights for each model and choose between averaging or summing parameters.
- Added
--source-weights
parameter to specify individual model weights - Added
--aggregation-method
parameter to choose between "average" and "sum" operations - Modified parameter accumulation logic to use weighted calculations instead of simple averaging
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -87,36 +125,36 @@ def main(): | |||
raise ValueError(f"Shape mismatch for key '{key}': " | |||
f"{param_sums[key].shape} vs {tensor.shape}") | |||
param_sums[key] += tensor |
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.
The parameter accumulation is not applying the weights. It should be param_sums[key] += tensor * weight
to properly implement weighted merging.
Copilot uses AI. Check for mistakes.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
@reiyw ping |
モデルマージ用スクリプトに計算式を変更するオプションを追加:
何も指定しなければ単純な相加平均になります。