Skip to content

Commit 20801e3

Browse files
committed
Update documentation to include 'tune cat' command and its usage
1 parent 8853bde commit 20801e3

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

docs/source/tune_cli.rst

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ with a short description of each.
1717
.. code-block:: bash
1818
1919
$ tune --help
20-
usage: tune [-h] {download,ls,cp,run,validate} ...
20+
usage: tune [-h] {download,ls,cp,run,validate,cat} ...
2121
2222
Welcome to the torchtune CLI!
2323
2424
options:
2525
-h, --help show this help message and exit
2626
2727
subcommands:
28-
{download,ls,cp,run,validate}
28+
{download,ls,cp,run,validate,cat}
2929
download Download a model from the Hugging Face Hub.
3030
ls List all built-in recipes and configs
3131
...
@@ -233,3 +233,72 @@ The ``tune validate <config>`` command will validate that your config is formatt
233233
# If you've copied over a built-in config and want to validate custom changes
234234
$ tune validate my_configs/llama3/8B_full.yaml
235235
Config is well-formed!
236+
237+
.. _tune_cat_cli_label:
238+
239+
Inspect a config
240+
---------------------
241+
242+
The ``tune cat <config>`` command pretty prints a configuration file, making it easy to use ``tune run`` with confidence. This command is useful for inspecting the structure and contents of a config file before running a recipe, ensuring that all parameters are correctly set.
243+
244+
You can also use the ``--sort`` option to print the config in sorted order, which can help in quickly locating specific keys.
245+
246+
.. list-table::
247+
:widths: 30 60
248+
249+
* - \--sort
250+
- Print the config in sorted order.
251+
252+
**Workflow Example**
253+
254+
1. **List all available configs:**
255+
256+
Use the ``tune ls`` command to list all the built-in recipes and configs within torchtune.
257+
258+
.. code-block:: bash
259+
260+
$ tune ls
261+
RECIPE CONFIG
262+
full_finetune_single_device llama2/7B_full_low_memory
263+
code_llama2/7B_full_low_memory
264+
llama3/8B_full_single_device
265+
mistral/7B_full_low_memory
266+
phi3/mini_full_low_memory
267+
full_finetune_distributed llama2/7B_full
268+
llama2/13B_full
269+
llama3/8B_full
270+
llama3/70B_full
271+
...
272+
273+
2. **Inspect the contents of a config:**
274+
275+
Use the ``tune cat`` command to pretty print the contents of a specific config. This helps you understand the structure and parameters of the config.
276+
277+
.. code-block:: bash
278+
279+
$ tune cat llama2/7B_full
280+
output_dir: /tmp/torchtune/llama2_7B/full
281+
tokenizer:
282+
_component_: torchtune.models.llama2.llama2_tokenizer
283+
path: /tmp/Llama-2-7b-hf/tokenizer.model
284+
max_seq_len: null
285+
...
286+
287+
You can also print the config in sorted order:
288+
289+
.. code-block:: bash
290+
291+
$ tune cat llama2/7B_full --sort
292+
293+
3. **Run a recipe with parameter override:**
294+
295+
After inspecting the config, you can use the ``tune run`` command to run a recipe with the config. You can also override specific parameters directly from the command line. For example, to override the `output_dir` parameter:
296+
297+
.. code-block:: bash
298+
299+
$ tune run full_finetune_distributed --config llama2/7B_full output_dir=./
300+
301+
Learn more about config overrides :ref:`here <cli_override>`.
302+
303+
.. note::
304+
You can find all the cat-able configs via the ``tune ls`` command.

0 commit comments

Comments
 (0)