Skip to content
Merged
Changes from all commits
Commits
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
7 changes: 0 additions & 7 deletions trl/experimental/kto/kto_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,6 @@ def __init__(
if param.requires_grad:
param.data = param.data.to(torch.bfloat16)

# KTO only supports causal language models, not encoder-decoder models
if model is not None and hasattr(model.config, "is_encoder_decoder") and model.config.is_encoder_decoder:
raise ValueError(
"KTO only supports causal language models. Encoder-decoder models are not supported. "
"Please use a causal LM (e.g., GPT, Llama, Mistral) instead of an encoder-decoder model (e.g., T5, BART)."
)

if args.max_length is None:
logger.warning(
"When using DataCollatorForUnpairedPreference, you should set `max_length` in the KTOTrainer's init"
Expand Down
Loading