-
Notifications
You must be signed in to change notification settings - Fork 37
introduce additional_arguments in config.yaml #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cdoern
wants to merge
1
commit into
instructlab:main
Choose a base branch
from
cdoern:config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Modifying the ilab config structure to be more streamlined | ||
|
||
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. | ||
|
||
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. | ||
|
||
## `additional_arguments` as a field in training, serving and evaluation | ||
|
||
Taking a look at the current training config it looks like: | ||
|
||
```yaml | ||
train: | ||
torch_args: | ||
nnodes: 1 | ||
node_rank: 0 | ||
nproc_per_node: 1 | ||
rdzv_endpoint: 127.0.0.1:12222 | ||
rdzv_id: 123 | ||
train_args: | ||
chat_tmpl_path: /home/ec2-user/instructlab/venv/lib64/python3.11/site-packages/instructlab/training/chat_templates/ibm_generic_tmpl.py | ||
ckpt_output_dir: checkpoints | ||
data_output_dir: train-output | ||
data_path: ./taxonomy_data | ||
deepspeed_options: | ||
cpu_offload_optimizer: true | ||
cpu_offload_optimizer_pin_memory: false | ||
cpu_offload_optimizer_ratio: 1 | ||
save_samples: null | ||
effective_batch_size: 100 | ||
is_padding_free: false | ||
learning_rate: 2e-6 | ||
lora: | ||
alpha: 32 | ||
dropout: 0.1 | ||
quantize_data_type: nf4 | ||
rank: 2 | ||
target_modules: | ||
- q_proj | ||
- k_proj | ||
- v_proj | ||
- o_proj | ||
max_batch_len: 1000 | ||
max_seq_len: 96 | ||
mock_data: false | ||
mock_data_len: 0 | ||
model_path: instructlab/granite-7b-lab | ||
num_epochs: 1 | ||
random_seed: 42 | ||
save_samples: 100 | ||
warmup_steps: 10 | ||
``` | ||
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. | ||
|
||
Keeping some of the key options like `num_epochs`, `deepspeed`, `lora`, and key directories a possible training config could look like: | ||
|
||
```yaml | ||
train: | ||
train_args: | ||
ckpt_output_dir: checkpoints | ||
data_output_dir: train-output | ||
data_path: ./taxonomy_data | ||
deepspeed_options: | ||
cpu_offload_optimizer: true | ||
cpu_offload_optimizer_pin_memory: false | ||
cpu_offload_optimizer_ratio: 1 | ||
save_samples: null | ||
learning_rate: 2e-6 | ||
lora: | ||
alpha: 32 | ||
dropout: 0.1 | ||
quantize_data_type: nf4 | ||
rank: 2 | ||
target_modules: | ||
- q_proj | ||
- k_proj | ||
- v_proj | ||
- o_proj | ||
max_batch_len: 1000 | ||
model_path: instructlab/granite-7b-lab | ||
num_epochs: 1 | ||
save_samples: 100 | ||
warmup_steps: 10 | ||
additional_arguments: ["--is-padding-free=False"...] | ||
``` | ||
|
||
`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. | ||
|
||
The same structure can be applied easily to the serve config.Currently this config looks like: | ||
|
||
```yaml | ||
serve: | ||
backend: '' | ||
host_port: 127.0.0.1:8000 | ||
llama_cpp: | ||
gpu_layers: -1 | ||
llm_family: '' | ||
max_ctx_size: 4096 | ||
model_path: models/merlinite-7b-lab-Q4_K_M.gguf | ||
vllm: | ||
vllm_args: [] | ||
``` | ||
|
||
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. | ||
|
||
Being very general, this would look something like: | ||
|
||
```yaml | ||
serve: | ||
backend: 'vllm' | ||
host_port: 127.0.0.1:8000 | ||
max_ctx_size: 5120 | ||
gpus: 2 | ||
llm_family: '' | ||
model_path: models/merlinite-7b-lab-Q4_K_M.gguf | ||
served_model_name: "merlinite" | ||
additional_arguments: ["--block-size=16", "--dtype=fp8"...] | ||
``` | ||
|
||
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. | ||
|
||
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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this work if there are multiple commands callable from one config section? Would we not need the additional_arguments name to indicate where in particular the additional args are being passed through to?
With serving, you could choose to use the same args field to pass values to vllm or llama_cpp or another serving technology. But If there are two calls to make to vllm or llama_cpp, it becomes less clear.