diff --git a/docs/source/reducing_memory_usage.md b/docs/source/reducing_memory_usage.md index 166bb031ed3..20c2851169e 100644 --- a/docs/source/reducing_memory_usage.md +++ b/docs/source/reducing_memory_usage.md @@ -208,6 +208,9 @@ Padding-free batching is an alternative approach for reducing memory usage. In t +> [!WARNING] +> Padding-free is temporarily unavailable in DPO since the refactor in [#3906](https://github.com/huggingface/trl/pull/3906). Setting `padding_free=True` in [`DPOConfig`] logs a warning and falls back to standard padding. It is planned to return in a future update, tracked in [#2469](https://github.com/huggingface/trl/issues/2469). + ```python from trl import DPOConfig diff --git a/trl/trainer/dpo_config.py b/trl/trainer/dpo_config.py index 92609020a99..e24fbb548d5 100644 --- a/trl/trainer/dpo_config.py +++ b/trl/trainer/dpo_config.py @@ -62,6 +62,9 @@ class DPOConfig(_BaseConfig): Whether to perform forward passes without padding by flattening all sequences in the batch into a single continuous sequence. This reduces memory usage by eliminating padding overhead. Currently, this is only supported with the FlashAttention 2 or 3, which can efficiently handle the flattened batch structure. + Temporarily unavailable since the DPO refactor in [#3906](https://github.com/huggingface/trl/pull/3906): + setting it to `True` logs a warning and falls back to standard padding. It is planned to return in a future + update. pad_to_multiple_of (`int`, *optional*): If set, the sequences will be padded to a multiple of this value. precompute_ref_log_probs (`bool`, *optional*, defaults to `False`): @@ -207,7 +210,8 @@ class DPOConfig(_BaseConfig): "help": "Whether to perform forward passes without padding by flattening all sequences in the batch into " "a single continuous sequence. This reduces memory usage by eliminating padding overhead. Currently, this " "is only supported with the FlashAttention 2 or 3, which can efficiently handle the flattened batch " - "structure." + "structure. Temporarily unavailable since the DPO refactor in #3906: setting it to `True` logs a warning " + "and falls back to standard padding. It is planned to return in a future update." }, ) pad_to_multiple_of: int | None = field(