Ë
    )täi¬  ã                   óT   — d dl Z d dlZd dlZd dlmZmZ d dlmZmZ dZ	dd„Z
d„ Zd„ Zy)	é    N)ÚVersionÚparse)Údefault_config_fileÚload_config_from_filezQRun commands across TPU VMs for initial setup before running `accelerate launch`.c                 ó\  — | �| j                  dt        ¬«      }nt        j                  dt        ¬«      }|j	                  dd«      }|j                  dt        d d¬«       |j                  d	d d
¬«       |j                  dd d¬«       |j	                  dd«      }|j                  ddd¬«       |j                  dd d¬«       |j                  dddd¬«       |j                  ddd¬«       |j                  ddd¬«       |j                  d dd!¬«       | �|j                  t        ¬"«       |S )#Nz
tpu-config)ÚdescriptionzAccelerate tpu-config commandzConfig Argumentsz=Arguments that can be configured through `accelerate config`.z--config_filez.Path to the config file to use for accelerate.)ÚtypeÚdefaultÚhelpz
--tpu_namez\The name of the TPU to use. If not specified, will use the TPU specified in the config file.)r
   r   z
--tpu_zonez]The zone of the TPU to use. If not specified, will use the zone specified in the config file.zTPU Argumentsz)Arguments for options ran inside the TPU.z--use_alphaÚ
store_truezWWhether to use `gcloud alpha` when running the TPU training script instead of `gcloud`.)Úactionr   z--command_filezJThe path to the file containing the commands to run on the pod on startup.ú	--commandÚappendÚ+z:A command to run on the pod. Can be passed multiple times.)r   Únargsr   z--install_acceleratez<Whether to install accelerate on the pod. Defaults to False.z--accelerate_versionÚlatestzŠThe version of accelerate to install on the pod. If not specified, will use the latest pypi version. Specify 'dev' to install from GitHub.z--debugzGIf set, will print the command that would be run instead of running it.)Úfunc)	Ú
add_parserÚ_descriptionÚargparseÚArgumentParserÚadd_argument_groupÚadd_argumentÚstrÚset_defaultsÚtpu_command_launcher)Ú
subparsersÚparserÚconfig_argsÚpod_argss       úf/Volumes/fast/ai/experiments/MLX_z-image/.venv/lib/python3.12/site-packages/accelerate/commands/tpu.pyÚtpu_command_parserr"      s�  € ØÐØ×&Ñ& |ÄÐ&ÓN‰ä×(Ñ(Ð)HÔVbÔcˆà×+Ñ+ØÐ[ó€Kð ×ÑØÜØØ=ð	 ô ð ×ÑØØØkð ô ð
 ×ÑØØØlð ô ð
 ×(Ñ(¨Ð:eÓf€HØ×ÑØØØfð ô ð
 ×ÑØØØYð ô ð
 ×ÑØØØØIð	 ô ð ×ÑØØØKð ô ð
 ×ÑØØð Zð ô ð
 ×ÑØ˜,Ð-vð ô ð ÐØ×ÑÔ!5ÐÔ6Ø€Mó    c                 óÄ  — d }| j                   €#t        j                  j                  t        «      r­t        | j                   «      }| j                  s)|j                  �| j                  s|j                  | _        | j                  s|j                  �|j                  | _        | j                  s|j                  | _	        | j                  s|j                  | _
        | j                  dk(  rd| _        nN| j                  dk(  rd| _        n7t        t        | j                  «      t        «      rd| j                  › �| _        | j                  s| j                  st        d«      ‚| j                  rBt!        | j                  «      5 }|j#                  «       j%                  «       g| _        d d d «       t        | j                  d   t&        «      r(| j                  D ��cg c]  }|D ]  }|‘Œ Œ c}}| _        dg}| j(                  r|d	| j                  › �gz  }|| j                  z  }d
j+                  |«      | _        dg}| j,                  r|dgz  }|dddd| j                  d| j                  d| j                  ddgz  }| j.                  rt1        ddj+                  |«      › �«       y t3        j4                  |«       t1        d«       y # 1 sw Y   �Œ$xY wc c}}w )NÚdevz1git+https://github.com/huggingface/accelerate.gitr   zaccelerate -Uzaccelerate==zFYou must specify either a command file or a command to run on the pod.r   zcd /usr/sharezpip install z; ÚgcloudÚalphaÚcomputeÚtpusztpu-vmÚsshz--zoner   z--workerÚallzRunning Ú zSuccessfully setup pod.)Úconfig_fileÚosÚpathÚisfiler   r   Úcommand_fileÚcommandÚcommandsÚtpu_nameÚtpu_zoneÚaccelerate_versionÚ
isinstancer   r   Ú
ValueErrorÚopenÚreadÚ
splitlinesÚlistÚinstall_accelerateÚjoinÚ	use_alphaÚdebugÚprintÚ
subprocessÚrun)ÚargsÚdefaultsÚfÚcmdÚlineÚnew_cmds         r!   r   r   Z   sl  € Ø€Hð ×ÑÐ#¤r§w¡w§~¡~Ô6IÔ'JÜ(¨×)9Ñ)9Ó:ˆØ× Ò  X×%:Ñ%:Ð%FÈtÏ|Ê|Ø (× 5Ñ 5ˆDÔØ�|Š| × 1Ñ 1Ð =Ø#×,Ñ,ˆDŒLØ�}Š}Ø$×-Ñ-ˆDŒMØ�}Š}Ø$×-Ñ-ˆDŒMØ×Ñ %Ò'Ø"UˆÕØ	×	 Ñ	  HÒ	,Ø"1ˆÕÜ	”E˜$×1Ñ1Ó2´GÔ	<Ø$0°×1HÑ1HÐ0IÐ"JˆÔà×Ò T§\¢\ÜÐaÓbÐbà×ÒÜ�$×#Ñ#Ô$¨ØŸF™F›H×/Ñ/Ó1Ð2ˆDŒL÷ %ô �$—,‘,˜q‘/¤4Ô(Ø(,¯ªÔE© Ã¸šÀ˜¨ÒEˆŒàÐ€GØ×ÒØ�l 4×#:Ñ#:Ð";Ð<Ð=Ñ=ˆØˆt�|‰|Ñ€GØ—9‘9˜WÓ%€D„Lð ˆ*€CØ‡~‚~Ø�ˆyÑˆØØØØØØ�‰ØØ�‰ØØ�‰ØØðñ €Cð ‡z‚zÜ�˜Ÿ™ #›˜Ð(Ô)ØÜ‡N�N�3ÔÜ	Ð
#Õ$÷G %Ñ$üó
 Fs   Æ%KÇ!KËKc                  óN   — t        «       } | j                  «       }t        |«       y ©N)r"   Ú
parse_argsr   )r   rD   s     r!   ÚmainrM   ™   s    € ÜÓ!€FØ×ÑÓ€Dä˜Õr#   rK   )r   r.   rB   Úpackaging.versionr   r   Ú&accelerate.commands.config.config_argsr   r   r   r"   r   rM   © r#   r!   Ú<module>rQ      s/   ðó" Û 	Û ç ,ç ]ð c€ó:òz<%ó~r#   