Skip to content
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

🔀 Add MergeModelCallBack #2282

Merged
merged 48 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
63f7ae0
Create mergekit_utils.py
August-murr Oct 25, 2024
55f3a25
adding mergekit as an optional dependancy
August-murr Oct 25, 2024
9f829fa
adding MergeModel to callbacks
August-murr Oct 25, 2024
f666369
adding mergekit_utils dependencies to callbacks
August-murr Oct 25, 2024
bb52d4b
setting lower bound for mergekit
August-murr Oct 30, 2024
5d9a5a9
setting mergekit lower band to 0.0.5.1
August-murr Oct 30, 2024
9ba148c
Merge branch 'main' into MergeModelCallBack
qgallouedec Nov 5, 2024
0fe2d67
adding support for MergeModelCallBack __init__.py
August-murr Nov 14, 2024
caee4b2
adding support for mergemodelcallback
August-murr Nov 14, 2024
b278e5a
mergemodelcallback tests
August-murr Nov 14, 2024
311a27a
Update callbacks.py
August-murr Nov 14, 2024
ec8b5ec
Update __init__.py
August-murr Nov 14, 2024
147b188
Update __init__.py
August-murr Nov 14, 2024
7f5dbc1
Update test_callbacks.py
August-murr Nov 14, 2024
c17f8e3
Update trl/trainer/callbacks.py
August-murr Nov 15, 2024
0d9c8a0
Update trl/trainer/callbacks.py
August-murr Nov 15, 2024
ca07b42
Update trl/trainer/callbacks.py
August-murr Nov 15, 2024
6229885
using different dataset for tests
August-murr Nov 15, 2024
9ea5a6b
Update trl/mergekit_utils.py
August-murr Nov 15, 2024
1a2b425
Update trl/mergekit_utils.py
August-murr Nov 15, 2024
f0f84eb
Merge branch 'main' into MergeModelCallBack
qgallouedec Nov 15, 2024
c924cb9
Apply suggestions from code review
August-murr Nov 15, 2024
8b5a4a9
replacing get_last_checkpoint
August-murr Nov 15, 2024
34e94ff
Merge branch 'MergeModelCallBack' of https://github.com/August-murr/t…
August-murr Nov 15, 2024
0a5db60
renaming Merge to merge_models
August-murr Nov 15, 2024
906eafa
setting mergers default value to linear
August-murr Nov 15, 2024
8d03608
removing unnecessary docs and comments
August-murr Nov 15, 2024
eb66e99
adding docstring to Mergeconfig
August-murr Nov 15, 2024
eb7b228
adding mergekits link to docstring
August-murr Nov 15, 2024
1057c59
precommit
August-murr Nov 15, 2024
1c85ee5
removing duplicated import
August-murr Nov 16, 2024
18d0388
typos in mergekit_utils docstring
August-murr Nov 16, 2024
ca8f361
fixing tests
August-murr Nov 17, 2024
0a25ee8
making mergemodelcallback tests optional
August-murr Nov 18, 2024
cd76890
Make import optional
qgallouedec Nov 18, 2024
c8afdbc
minor
qgallouedec Nov 18, 2024
26aa418
Merge branch 'main' into MergeModelCallBack
kashif Nov 20, 2024
fb12119
Merge branch 'MergeModelCallBack' of https://github.com/August-murr/t…
qgallouedec Nov 21, 2024
88de59a
use tmp dir in test
qgallouedec Nov 21, 2024
fed6045
sort
qgallouedec Nov 21, 2024
01e38c8
Add import error checks for mergekit extra
qgallouedec Nov 21, 2024
9e7a068
use a common _merge_and_maybe_push method and compat with windows path
qgallouedec Nov 21, 2024
fa5bafe
debug windows
qgallouedec Nov 21, 2024
47ecef5
Update dependencies for mergekit and add test dependencies
qgallouedec Nov 21, 2024
7fe26d5
Add assertion to check if merged folder exists in the last checkpoint
qgallouedec Nov 21, 2024
a57d88a
Fix temporary directory cleanup in test_callbacks.py
qgallouedec Nov 21, 2024
69ea0ed
Add sys import and skip test for Python versions below 3.10 due to cl…
qgallouedec Nov 21, 2024
d89eadc
revert change for debug
qgallouedec Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add import error checks for mergekit extra
  • Loading branch information
qgallouedec committed Nov 21, 2024
commit 01e38c8ccaf715882f4dd904274957e18eb1d5fc
6 changes: 6 additions & 0 deletions trl/mergekit_utils.py
August-murr marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class MergeConfig:
"""

def __init__(self, method: str = "linear"):
if not is_mergekit_available():
raise ImportError(
"MergeConfig requires the `mergekit` extra. To install, run `pip install trl[mergekit]`."
)
self.method = method
self.policy_model_path = None
self.target_model_path = None
Expand Down Expand Up @@ -265,6 +269,8 @@ def merge_models(config: MergeConfig, out_path: str):
config (`MergeConfig`): The merge configuration.
out_path (`str`): The output path for the merged model.
"""
if not is_mergekit_available():
raise ImportError("merge_models requires the `mergekit` extra. To install, run `pip install trl[mergekit]`.")
run_merge(
config,
out_path=out_path,
Expand Down