Skip to content

Commit ac74aa5

Browse files
committed
introduce additional_arguments in config.yaml
additional_arguments allows ilab to implicitly support more complex flags from the libraries it calls without adding them directly to the config Signed-off-by: Charlie Doern <[email protected]>
1 parent 1a65993 commit ac74aa5

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed

.spellcheck-en-custom.txt

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Conda
2222
config
2323
Containerfile
2424
cpp
25+
ctx
2526
cuBLAS
2627
CUDA
2728
customizations
@@ -165,3 +166,4 @@ XT
165166
XTX
166167
Xu
167168
YAML
169+
yaml

docs/cli/ilab-config-structure.md

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Modifying the ilab config structure to be more streamlined
2+
3+
Currently, the `config.yaml` is large with major expansions in training, evaluation, and serving. Expansions help the user understand what the various configuration options are for each of these commands. However, there is a fine line between a verbose config and a cluttered one.
4+
5+
This document describes a new structure for various parts of the config.yaml, and begins to outline how there are different levels of expertise in `ilab` which should dictate which options are available by default.
6+
7+
## `additional_arguments` as a field in training, serving and evaluation
8+
9+
Taking a look at the current training config it looks like:
10+
11+
```yaml
12+
train:
13+
torch_args:
14+
nnodes: 1
15+
node_rank: 0
16+
nproc_per_node: 1
17+
rdzv_endpoint: 127.0.0.1:12222
18+
rdzv_id: 123
19+
train_args:
20+
chat_tmpl_path: /home/ec2-user/instructlab/venv/lib64/python3.11/site-packages/instructlab/training/chat_templates/ibm_generic_tmpl.py
21+
ckpt_output_dir: checkpoints
22+
data_output_dir: train-output
23+
data_path: ./taxonomy_data
24+
deepspeed_options:
25+
cpu_offload_optimizer: true
26+
cpu_offload_optimizer_pin_memory: false
27+
cpu_offload_optimizer_ratio: 1
28+
save_samples: null
29+
effective_batch_size: 100
30+
is_padding_free: false
31+
learning_rate: 2e-6
32+
lora:
33+
alpha: 32
34+
dropout: 0.1
35+
quantize_data_type: nf4
36+
rank: 2
37+
target_modules:
38+
- q_proj
39+
- k_proj
40+
- v_proj
41+
- o_proj
42+
max_batch_len: 1000
43+
max_seq_len: 96
44+
mock_data: false
45+
mock_data_len: 0
46+
model_path: instructlab/granite-7b-lab
47+
num_epochs: 1
48+
random_seed: 42
49+
save_samples: 100
50+
warmup_steps: 10
51+
```
52+
While useful and clear to the user, this config is hard to maintain, and most users will not care about a large portion of the options.
53+
54+
Keeping some of the key options like `num_epochs`, `deepspeed`, `lora`, and key directories a possible training config could look like:
55+
56+
```yaml
57+
train:
58+
train_args:
59+
ckpt_output_dir: checkpoints
60+
data_output_dir: train-output
61+
data_path: ./taxonomy_data
62+
deepspeed_options:
63+
cpu_offload_optimizer: true
64+
cpu_offload_optimizer_pin_memory: false
65+
cpu_offload_optimizer_ratio: 1
66+
save_samples: null
67+
learning_rate: 2e-6
68+
lora:
69+
alpha: 32
70+
dropout: 0.1
71+
quantize_data_type: nf4
72+
rank: 2
73+
target_modules:
74+
- q_proj
75+
- k_proj
76+
- v_proj
77+
- o_proj
78+
max_batch_len: 1000
79+
model_path: instructlab/granite-7b-lab
80+
num_epochs: 1
81+
save_samples: 100
82+
warmup_steps: 10
83+
additional_arguments: ["--is-padding-free=False"...]
84+
```
85+
86+
`additional_arguments` holds the rest of the training arguments. `ilab` would validate these against an internally maintained list of supported options before passing to the respective library.
87+
88+
The same structure can be applied easily to the serve config.Currently this config looks like:
89+
90+
```yaml
91+
serve:
92+
backend: ''
93+
host_port: 127.0.0.1:8000
94+
llama_cpp:
95+
gpu_layers: -1
96+
llm_family: ''
97+
max_ctx_size: 4096
98+
model_path: models/merlinite-7b-lab-Q4_K_M.gguf
99+
vllm:
100+
vllm_args: []
101+
```
102+
103+
This has the opposite problem as training. The key here is that neither of these options are necessarily wrong, but to have both the verbose structure in the training config juxtaposed against the practically hidden structure of `vllm_args` is not ideal design practice. If we could merge the two approaches to use a common design language that exposes enough key arguments which are commonly edited while also not making the config confusing, this is what we should aim for.
104+
105+
Being very general, this would look something like:
106+
107+
```yaml
108+
serve:
109+
backend: 'vllm'
110+
host_port: 127.0.0.1:8000
111+
max_ctx_size: 5120
112+
gpus: 2
113+
llm_family: ''
114+
model_path: models/merlinite-7b-lab-Q4_K_M.gguf
115+
served_model_name: "merlinite"
116+
additional_arguments: ["--block-size=16", "--dtype=fp8"...]
117+
```
118+
119+
Backends like vllm have a large amount of command line options. Adding each and every one of these to our config.yaml is out of the question. However, supporting a large amount implicitly via additional_arguments is a good compromise. Additionally, the above structure lets us choose which ones we think deserve a spot in the config and which are more uncommon or preserved for power users.
120+
121+
This structure also allows us to flatten the config, something that is beneficial for flag mapping and config parsing. Options like max_ctx_size can apply to both vllm and llama-cpp. Options that are only applicable to a singular backend can be validated internally. Nested configurations within our config.yaml create a barrier both for the users and for flexible parsing of the config within `ilab`. additional_arguments will hopefully allow us to move generally away from nested configurations in both training and serving.

0 commit comments

Comments
 (0)