Compare commits

...

10 Commits

Author SHA1 Message Date
Salman Mohammadi
0c36a6fea6 config fix -___- 2025-03-18 11:35:20 +00:00
Salman Mohammadi
64aca3c23c linting v2 2025-03-18 11:33:54 +00:00
Salman Mohammadi
22abfd6170 simplifying check 2025-03-18 11:26:53 +00:00
Salman Mohammadi
0658c458b7 Merge branch 'fix_kto' of github.com:axolotl-ai-cloud/axolotl into fix_kto 2025-03-18 11:23:48 +00:00
Salman Mohammadi
690908cf2f linting 2025-03-18 11:23:23 +00:00
salman
b9378e9b39 Merge branch 'main' into fix_kto 2025-03-18 11:22:00 +00:00
Salman Mohammadi
57b0ad1467 adding adapter check 2025-03-18 11:21:42 +00:00
Salman Mohammadi
ec4ead6e3e adding error 2025-03-18 11:20:34 +00:00
Salman Mohammadi
a319ac7d3e removing artifacts 2025-03-17 20:00:09 +00:00
Salman Mohammadi
09d3f2cffa WIP 2025-03-17 19:59:19 +00:00
2 changed files with 25 additions and 10 deletions

View File

@@ -55,7 +55,7 @@ tf32: true
gradient_checkpointing: true gradient_checkpointing: true
gradient_checkpointing_kwargs: gradient_checkpointing_kwargs:
use_reentrant: true use_reentrant: false
early_stopping_patience: early_stopping_patience:
resume_from_checkpoint: resume_from_checkpoint:
local_rank: local_rank:

View File

@@ -1679,6 +1679,30 @@ class AxolotlInputConfig(
return data return data
@model_validator(mode="before")
@classmethod
def check_rl_config_gradient_checkpointing(cls, data):
# TODO: SalmanMohammadi
# Distributed RL with QLoRA + gradient checkpointing
# and use_reentrant = True is broken upstream in TRL
# pylint: disable=too-many-boolean-expressions
if (
data.get("rl")
and data.get("gradient_checkpointing")
and data.get("gradient_checkpointing_kwargs")
and data.get("gradient_checkpointing_kwargs").get("use_reentrant")
and data.get("load_in_4bit")
and data.get("adapter") == "qlora"
and data.get("capabilities")
and data.get("capabilities").get("n_gpu", 1) > 1
):
raise ValueError(
"The `use_reentrant: True` implementation of gradient checkpointing "
"is not supported for distributed RL training with QLoRA. Please set "
"`use_reentrant: False` in `gradient_checkpointing_kwargs`."
)
return data
@model_validator(mode="before") @model_validator(mode="before")
@classmethod @classmethod
def check_kto_config(cls, data): def check_kto_config(cls, data):
@@ -1689,15 +1713,6 @@ class AxolotlInputConfig(
if data.get("remove_unused_columns") is not False: if data.get("remove_unused_columns") is not False:
raise ValueError("Set `remove_unused_columns: False` when using kto") raise ValueError("Set `remove_unused_columns: False` when using kto")
if data.get("gradient_checkpointing") and not (
data.get("gradient_checkpointing_kwargs")
and isinstance(data.get("gradient_checkpointing_kwargs"), dict)
and data["gradient_checkpointing_kwargs"].get("use_reentrant")
):
raise ValueError(
"Set `gradient_checkpointing_kwargs: {use_reentrant: true}` for when kto is enabled"
)
return data return data