ó
    ;‡i¬  ã                   óV   • S SK r S SKrS SKrS SKJrJr  S SKJrJr  Sr	SS jr
S rS rg)	é    N)ÚVersionÚparse)Údefault_config_fileÚload_config_from_filezQRun commands across TPU VMs for initial setup before running `accelerate launch`.c                 ó  • U b  U R                  S[        S9nO[        R                  " S[        S9nUR	                  SS5      nUR                  S[        S SS9  UR                  S	S S
S9  UR                  SS SS9  UR	                  SS5      nUR                  SSSS9  UR                  SS SS9  UR                  SSSSS9  UR                  SSSS9  UR                  SSSS9  UR                  S SS!S9  U b  UR                  [        S"9  U$ )#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       Úg/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/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                 ól  • S nU R                   c(  [        R                  R                  [        5      (       aÈ  [        U R                   5      nU R                  (       d/  UR                  b"  U R                  (       d  UR                  U l        U R                  (       d  UR                  b  UR                  U l        U R                  (       d  UR                  U l	        U R                  (       d  UR                  U l
        U R                  S:X  a  SU l        OTU R                  S:X  a  SU l        O<[        [        U R                  5      [        5      (       a  SU R                   3U l        U R                  (       d  U R                  (       d  [        S5      eU R                  (       aB  [!        U R                  5       nUR#                  5       R%                  5       /U l        S S S 5        [        U R                  S   [&        5      (       a,  U R                   VVs/ s H  o3  H  oDPM     M     snnU l        S/nU R(                  (       a  US	U R                   3/-  nXPR                  -  nS
R+                  U5      U l        S/nU R,                  (       a  US/-  nUSSSSU R                  SU R                  SU R                  SS/-  nU R.                  (       a  [1        SSR+                  U5       35        g [2        R4                  " U5        [1        S5        g ! , (       d  f       GNA= fs  snnf )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   ss  € Ø€Hð ×ÑÑ#¤r§w¡w§~¡~Ô6I×'JÑ'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×#:Ñ#:Ð";Ð<Ð=Ñ=ˆØ|‰|Ñ€GØ—9‘9˜WÓ%€D„Lð ˆ*€CØ‡~‡~ØˆyÑˆØØØØØØ‰ØØ‰ØØ‰ØØðñ €Cð ‡z‡zÜ˜Ÿ™ #›˜Ð(Ô)ØÜ‡N‚N3ÔÜ	Ð
#Õ$÷G %Ö$üó
 Fs   Æ?%LÈL0Ì
L-c                  óN   • [        5       n U R                  5       n[        U5        g ©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#   