Skip to content

Commit 4f495bf

Browse files
committed
fix: make linter happy
Signed-off-by: Oleg S <[email protected]>
1 parent d025471 commit 4f495bf

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/instructlab/training/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class DeepSpeedOffloadStrategy(Enum):
3030

3131
# public API
3232
class DistributedBackend(Enum):
33-
FSDP: str = "fsdp"
34-
DEEPSPEED: str = "deepspeed"
33+
FSDP = "fsdp"
34+
DEEPSPEED = "deepspeed"
3535

3636

3737
# public API
@@ -121,6 +121,7 @@ class DeepSpeedOptions(BaseModel):
121121
save_samples: int | None = None
122122

123123

124+
# public API
124125
class DistillationConfig(BaseModel):
125126
"""
126127
Config to use when performing knowledge distillation during training.
@@ -192,7 +193,7 @@ class TrainingArgs(BaseModel):
192193
weight_decay: float = Field(0.0, ge=0.0)
193194

194195
# settings for knowledge distillation
195-
distillation_options: Optional[DistillationConfig] = None
196+
distillation_options: DistillationConfig | None = None
196197
use_distillation: bool = False
197198

198199
mock_data: Optional[bool] = False

src/instructlab/training/main_ds.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,10 @@ def train(
483483
else:
484484
loss = output.loss
485485

486-
assert loss is not None, "loss cannot be equal to None!"
486+
if loss is None:
487+
raise ValueError(
488+
"received a value of `None` for loss after calculations, this should not happen"
489+
)
487490
log_loss = loss.detach().item()
488491

489492
num_loss_counted_tokens, micro_batch_size, log_loss = map(
@@ -1086,7 +1089,7 @@ def run_training(torch_args: TorchrunArgs, train_args: TrainingArgs) -> None:
10861089
parser.add_argument(
10871090
"--weight_decay",
10881091
type=float,
1089-
default=1e-3,
1092+
default=0,
10901093
help="Weight decay rate for optimizers that support it.",
10911094
)
10921095
parser.add_argument(

0 commit comments

Comments
 (0)