Skip to content

Commit 0c75f67

Browse files
committed
feat: refactor main_ds.py
Introduce a new design for key components of main_ds.py. Namely splitting Model initialization, Accelerator initialization, Optimizer initialization, and Checkpoint saving initialization into classes: Model Accelerator Checkpointer The Model class wraps the various AutoModel classes we support -- and aims to be a lightweight wrapper to help with usability of the library with different model types. setup_optimizer resides within the model class and returns one of the optimizer types we support The Accelerator class aims to both store commonly accessed variables associated with the accelerated model and abstract model/optimizer mutation away from the user who should only access our Model and Optimizer classes The Checkpointer class introduces a unified approach to our various checkpointing techniques. A user can pass in their checkpointing style (full_state or hf_format), and the checkpointer, via checkpointer.checkpoint, will save the model using the selected method and other techniques (LoRA). These classes are one of a few steps needed to "SDK-ify" the training library Signed-off-by: Charlie Doern <cdoern@redhat.com>
1 parent 5d510fb commit 0c75f67

File tree

5 files changed

+1399
-978
lines changed

5 files changed

+1399
-978
lines changed

src/instructlab/training/config.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ class DeepSpeedOffloadStrategy(Enum):
2727
NONE = None
2828

2929

30+
# public API
31+
class Optimizers(Enum):
32+
ADAMW = "Adamw"
33+
CPUAdam = "CPUAdam"
34+
FusedAdam = "FusedAdam"
35+
36+
37+
# public API
38+
class ModelTypes(Enum):
39+
LIGER = "Liger"
40+
CAUSALLM = "Causallm"
41+
DOLOMITE = "Dolomite"
42+
43+
3044
# public API
3145
class DistributedBackend(Enum):
3246
FSDP = "fsdp"

0 commit comments

Comments
 (0)