Fix auto padding free logic to respect user passed False (#4128)
* Fix auto padding free logic to respect user passed * Update unsloth/trainer.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
fc63b7ec4d
commit
6f73648ead
2 changed files with 3 additions and 1 deletions
|
|
@ -1037,6 +1037,7 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"):
|
|||
"include_num_input_tokens_seen": False,
|
||||
"auto_find_batch_size": False, # Auto /2 batch size - too many people complained so removing
|
||||
"dataloader_pin_memory": True,
|
||||
"padding_free": None, # None = user didn't set it, allows auto-enable detection
|
||||
# Might fail so disable for now
|
||||
# "dataloader_persistent_workers" : True, # Keeps dataloader in RAM
|
||||
# "dataloader_prefetch_factor" : 2,
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ def _should_auto_padding_free(config) -> bool:
|
|||
or getattr(config, "packing", False)
|
||||
):
|
||||
return False
|
||||
return not getattr(config, "padding_free", False)
|
||||
return getattr(config, "padding_free", None) is None
|
||||
|
||||
|
||||
def _disable_sample_packing(config):
|
||||
|
|
@ -392,6 +392,7 @@ def _patch_sft_trainer_auto_packing(trl_module):
|
|||
packing_active = True
|
||||
logger.info("Unsloth: Sample packing enabled for SFTTrainer instance.")
|
||||
|
||||
# Resolve padding_free: None (default) = auto-enable unless env-disabled or packing
|
||||
auto_padding_free_active = False
|
||||
padding_free_requested = getattr(config_arg, "padding_free", None) is True
|
||||
if not blocked:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue