Skip to content

Commit

Permalink
need to set both split_batches and dispatch_batches to false for pret…
Browse files Browse the repository at this point in the history
…raining
  • Loading branch information
winglian committed Jul 17, 2024
1 parent c7f1776 commit e757bad
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/axolotl/utils/config/models/input/v0_4_1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class PretrainingDataset(BaseModel):
split: Optional[str] = "train"
text_column: Optional[str] = "text"
type: Optional[str] = "pretrain"
trust_remote_code: Optional[bool] = False


class UserDefinedPrompterType(BaseModel):
Expand Down Expand Up @@ -118,6 +119,8 @@ class SFTDataset(BaseModel):
roles: Optional[Dict[str, List[str]]] = None
drop_system_message: Optional[bool] = None

trust_remote_code: Optional[bool] = False


class UserDefinedDPOType(BaseModel):
"""User defined typing for DPO"""
Expand Down Expand Up @@ -158,6 +161,7 @@ class KTODataset(BaseModel):
split: Optional[str] = None
type: Optional[Union[UserDefinedKTOType, str]] = None
data_files: Optional[List[str]] = None
trust_remote_code: Optional[bool] = False


class RLType(str, Enum):
Expand Down Expand Up @@ -711,9 +715,15 @@ def check_pretraining_split_batches_accelerate(cls, data):
if data.get("pretraining_dataset"):
accelerator_config = data.get("accelerator_config", {})
if not accelerator_config:
data["accelerator_config"] = {"split_batches": True}
elif accelerator_config.get("split_batches") is None:
data["accelerator_config"]["split_batches"] = True
data["accelerator_config"] = {
"split_batches": False,
"dispatch_batches": False,
}
else:
if accelerator_config.get("split_batches") is None:
data["accelerator_config"]["split_batches"] = False
if accelerator_config.get("dispatch_batches") is None:
data["accelerator_config"]["dispatch_batches"] = False
return data

@model_validator(mode="before")
Expand Down

0 comments on commit e757bad

Please sign in to comment.