Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BobaZooba committed Nov 13, 2023
1 parent 0ac465f commit 0061ca9
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
65 changes: 64 additions & 1 deletion DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,70 @@ the same data and models on each GPU, when you only need to do it once.

Это опциональный шаг

# Config
# `Config`

The `X—LLM` library uses a single config setup for all steps like preparing, training and the other steps. It's
designed in a way that
lets you easily understand the available features and what you can adjust. `Config` has control almost over every
single part of each step. Thanks to the config, you can pick your dataset, set your collator, manage the type of
quantization during training, decide if you want to use LoRA, if you need to push a checkpoint to the `HuggingFace Hub`,
and a
lot more.

Config path: `src.xllm.core.config.Config`

Or

```python
from xllm import Config
```

The most important `Config` keys are specified here: [How Config controls xllm](https://github.com/BobaZooba/xllm#how-config-controls-xllm)

You can initialize `Config` by specifying the necessary values, but also, if you are using command-line tools, you can pass values through the command line.

### Init `Config`

```python
from xllm import Config

config = Config(
model_name_or_path="mistralai/Mistral-7B-v0.1",
apply_lora=True,
stabilize=True,
)

# Do whatever you want using xllm (for example train the model)
```

### Pass values through CLI

1. Write for example a train script

`train.py`

```python
from xllm import Config
from xllm.cli import cli_run_train

if __name__ == '__main__':
... # initializing your dataset or registering
cli_run_train(config_cls=Config)
```

2. Run the script above using CLI and provide `Config` key values

```bash
python train.py \
--model_name_or_path mistralai/Mistral-7B-v0.1 \
--apply_lora True \
--stabilize True \
```

### Detailed Config explanation

<details>
<summary>Expand</summary>

| Key | Default value | Type | Entity | Comment |
|---------------------------------|---------------------------|----------------|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -142,6 +203,8 @@ the same data and models on each GPU, when you only need to do it once.
| `wandb_project` | None | Optional[str] | wandb | Weight & Biases project name |
| `wandb_entity` | None | Optional[str] | wandb | Weight & Biases entity name (user or company) |

</details>

# How do I choose the methods for training?

- It is recommended to use at least the ``stabilize`` feature and `use_flash_attention_2` (if your GPU allows it).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ from xllm import Config

## Useful materials

- [Important config fields for different steps](https://github.com/BobaZooba/xllm#fast-prototyping-)
- [How do I choose the methods for training?](!link)
- [Important config fields for different steps](https://github.com/BobaZooba/xllm#how-config-controls-xllm)
- [How do I choose the methods for training?](https://github.com/BobaZooba/xllm/blob/main/DOCS.md#how-do-i-choose-the-methods-for-training)
- [Detailed description of all config fields](!link)

# Customization options 🛠
Expand Down

0 comments on commit 0061ca9

Please sign in to comment.