Skip to content
6 changes: 3 additions & 3 deletions trl/experimental/bco/bco_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@


if is_peft_available():
from peft import PeftModel, get_peft_model, prepare_model_for_kbit_training
from peft import PeftConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training

if is_wandb_available():
import wandb
Expand Down Expand Up @@ -377,7 +377,7 @@ class BCOTrainer(_BaseTrainer):
The optimizer and scheduler to use for training.
preprocess_logits_for_metrics (`Callable[[torch.Tensor, torch.Tensor], torch.Tensor]`):
The function to use to preprocess the logits before computing the metrics.
peft_config (`dict`, defaults to `None`):
peft_config ([`~peft.PeftConfig`], *optional*):
The PEFT configuration to use for training. If you pass a PEFT configuration, the model will be wrapped in
a PEFT model.
compute_metrics (`Callable[[EvalPrediction], dict]`, *optional*):
Expand Down Expand Up @@ -421,7 +421,7 @@ def __init__(
callbacks: list[TrainerCallback] | None = None,
optimizers: tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None),
preprocess_logits_for_metrics: Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None,
peft_config: dict | None = None,
peft_config: "PeftConfig | None" = None,
Comment thread
cursor[bot] marked this conversation as resolved.
compute_metrics: Callable[[EvalLoopOutput], dict] | None = None,
model_adapter_name: str | None = None,
ref_adapter_name: str | None = None,
Expand Down
6 changes: 3 additions & 3 deletions trl/experimental/cpo/cpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@


if is_peft_available():
from peft import PeftModel, get_peft_model, prepare_model_for_kbit_training
from peft import PeftConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training


if is_wandb_available():
Expand Down Expand Up @@ -101,7 +101,7 @@ class CPOTrainer(_BaseTrainer):
The optimizer and scheduler to use for training.
preprocess_logits_for_metrics (`Callable[[torch.Tensor, torch.Tensor], torch.Tensor]`):
The function to use to preprocess the logits before computing the metrics.
peft_config (`dict`, defaults to `None`):
peft_config ([`~peft.PeftConfig`], *optional*):
The PEFT configuration to use for training. If you pass a PEFT configuration, the model will be wrapped in
a PEFT model.
compute_metrics (`Callable[[EvalPrediction], dict]`, *optional*):
Expand Down Expand Up @@ -142,7 +142,7 @@ def __init__(
callbacks: list[TrainerCallback] | None = None,
optimizers: tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None),
preprocess_logits_for_metrics: Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None,
peft_config: dict | None = None,
peft_config: "PeftConfig | None" = None,
compute_metrics: Callable[[EvalLoopOutput], dict] | None = None,
):
if train_dataset is None:
Expand Down
6 changes: 3 additions & 3 deletions trl/experimental/kto/kto_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from liger_kernel.chunked_loss import LigerFusedLinearKTOLoss

if is_peft_available():
from peft import PeftModel, get_peft_model, prepare_model_for_kbit_training
from peft import PeftConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training


if TYPE_CHECKING:
Expand Down Expand Up @@ -200,7 +200,7 @@ class KTOTrainer(_BaseTrainer):
The optimizer and scheduler to use for training.
preprocess_logits_for_metrics (`Callable[[torch.Tensor, torch.Tensor], torch.Tensor]`):
The function to use to preprocess the logits before computing the metrics.
peft_config (`dict`, defaults to `None`):
peft_config ([`~peft.PeftConfig`], *optional*):
The PEFT configuration to use for training. If you pass a PEFT configuration, the model will be wrapped in
a PEFT model.
compute_metrics (`Callable[[EvalPrediction], dict]`, *optional*):
Expand Down Expand Up @@ -236,7 +236,7 @@ def __init__(
callbacks: list[TrainerCallback] | None = None,
optimizers: tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None),
preprocess_logits_for_metrics: Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None,
peft_config: dict | None = None,
peft_config: "PeftConfig | None" = None,
compute_metrics: Callable[[EvalLoopOutput], dict] | None = None,
):
# Args
Expand Down
6 changes: 3 additions & 3 deletions trl/experimental/orpo/orpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@


if is_peft_available():
from peft import PeftModel, get_peft_model, prepare_model_for_kbit_training
from peft import PeftConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training


if is_wandb_available():
Expand Down Expand Up @@ -112,7 +112,7 @@ class ORPOTrainer(_BaseTrainer):
The optimizer and scheduler to use for training.
preprocess_logits_for_metrics (`Callable[[torch.Tensor, torch.Tensor], torch.Tensor]`):
The function to use to preprocess the logits before computing the metrics.
peft_config (`dict`, defaults to `None`):
peft_config ([`~peft.PeftConfig`], *optional*):
The PEFT configuration to use for training. If you pass a PEFT configuration, the model will be wrapped in
a PEFT model.
compute_metrics (`Callable[[EvalPrediction], dict]`, *optional*):
Expand Down Expand Up @@ -151,7 +151,7 @@ def __init__(
callbacks: list[TrainerCallback] | None = None,
optimizers: tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None),
preprocess_logits_for_metrics: Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None,
peft_config: dict | None = None,
peft_config: "PeftConfig | None" = None,
compute_metrics: Callable[[EvalLoopOutput], dict] | None = None,
):
if train_dataset is None:
Expand Down
Loading