-
Notifications
You must be signed in to change notification settings - Fork 905
compat trl 0.15 #5905
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
compat trl 0.15 #5905
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
from dataclasses import dataclass, field | ||||||
from typing import List | ||||||
from typing import List, Optional | ||||||
|
||||||
from trl import CPOConfig as HfCPOConfig | ||||||
from trl import DPOConfig as HfDPOConfig | ||||||
|
@@ -15,7 +15,7 @@ | |||||
|
||||||
@dataclass | ||||||
class DPOConfig(SwiftArgumentsMixin, HfDPOConfig): | ||||||
pass | ||||||
ld_alpha: Optional[float] = None # compat trl==0.15 | ||||||
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. The comment
Suggested change
|
||||||
|
||||||
|
||||||
@dataclass | ||||||
|
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.
This change refactors the logic to delay loading the
hf_model
until it's needed inside theif args.to_hf:
block, which is a good practice for memory efficiency. However, this introduces a second call toprepare_model_template
on line 297. While this improves code structure, it's worth ensuring that callingprepare_model_template
twice doesn't introduce a significant performance overhead. If the function is lightweight whenload_model=False
, this is fine. Otherwise, it might be better to refactorprepare_model_template
to separate template creation from model loading more explicitly.