-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
38 lines (31 loc) · 1.27 KB
/
config.py
File metadata and controls
38 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import warnings
from dataclasses import dataclass, field
from trl import DPOConfig
@dataclass
class EpsilonDPOConfig(DPOConfig):
epsilon: float = field(
default=0.01,
metadata={
"help": "Parameter controlling the step size of KL penalty relaxation."
},
)
def __post_init__(self):
if self.reference_free == True:
warnings.warn(
"When using `EpsilonDPOTrainer`, you should set `reference_free=False`. "
"We have set it for you, but you should do it yourself in the future."
)
self.reference_free = False
if self.precompute_ref_log_probs == True:
warnings.warn(
"When using `EpsilonDPOTrainer`, you should set `precompute_ref_log_probs=True`. "
"We have set it for you, but you should do it yourself in the future."
)
self.precompute_ref_log_probs = False
if self.loss_type != "sigmoid":
warnings.warn(
"When using `EpsilonDPOTrainer`, you should set `loss_type=\"sigmoid\"`. "
"We have set it for you, but you should do it yourself in the future."
)
self.loss_type = "sigmoid"
super().__post_init__()