o
    ̳i	                     @   s<   d dl Z d dlZd dlmZ d dlmZ G dd deZdS )    N)
Subcommand)get_all_recipesc                       s@   e Zd ZdZdZdejf fddZdejddfd	d
Z	  Z
S )Listz1Holds all the logic for the `tune ls` subcommand.z<>
subparsersc                    s>   t    |jddddtdtjd| _| jj| j	d d S )Nlsztune lsz%List all built-in recipes and configsa              examples:
                $ tune ls
                RECIPE                                   CONFIG
                full_finetune_single_device              llama2/7B_full_single_device
                full_finetune_distributed                llama2/7B_full
                                                         llama2/13B_full
                ...

            To run one of these recipes:
                $ tune run full_finetune_single_device --config full_finetune_single_device
            )proghelpdescriptionepilogformatter_class)func)
super__init__
add_parsertextwrapdedentargparseRawTextHelpFormatter_parserset_defaults_ls_cmd)selfr   	__class__ E/home/ubuntu/.local/lib/python3.10/site-packages/torchtune/_cli/ls.pyr      s   
zList.__init__argsreturnNc                 C   s   ddddd}t | t D ]8}|j}t|jdkr*|dd| jd}t | t|jD ]\}}|dkr9d}|dd|jd}t | q/qdS )z'List all available recipes and configs.RECIPEz<40 CONFIGr    N)printr   namelenconfigs
NULL_VALUE	enumerate)r   r   headerrecipe
recipe_strrowiconfigr   r   r   r   -   s   

zList._ls_cmd)__name__
__module____qualname____doc__r&   r   _SubParsersActionr   	Namespacer   __classcell__r   r   r   r   r      s
    r   )r   r   torchtune._cli.subcommandr   torchtune._recipe_registryr   r   r   r   r   r   <module>   s
   