+
    œ°³jæ~  ã                   ó,  € ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHtHt ^ RIt^RIHt ]! 4       '       d   ^ RIt^ RIHt ^ RIHt  ! R	 R
]4      t]P0                  ! 4       P2                  t]
! ]4      P8                  ^,          tR] R2P=                  4       tRRRRRRRR/t R2R R llt! ! R R4      t"R R lt#R R lt$R R lt%R R  lt&R! R" lt'R# R$ lt(R% R& lt)R' R( lt*R) R* lt+R+ R, lt,R3R- R. llt-R/ R0 lt.R1 t/R# )4é    N)ÚCallable)Údate)ÚPath)Ú	AnnotatedÚAnyÚcast)Úis_libcst_available)Ú
CSTVisitor)Úmatchersc                   ó`   a € ] tR t^$t o RtR tV 3R lR ltV 3R lR ltV 3R lR ltR	t	V t
R
# )ÚClassFinderz3
A visitor to find all classes in a python module.
c                ó0   € . V n         . V n        R V n        R# ©FN)ÚclassesÚpublic_classesÚis_in_class)Úselfs   &Úd/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/cli/add_new_model_like.pyÚ__init__ÚClassFinder.__init__)   s   € Ø!#ˆDŒLØ(*ˆDÔØ$ˆDÖó    c                ó8   <€ V ^8„  d   QhRS[ P                  RR/# )é   ÚnodeÚreturnN©ÚcstÚClassDef)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚClassFinder.__annotate__.   s   ø€ ÷ 	$ñ 	$¡s§|¡|ð 	$¸ñ 	$r   c                ór   € V P                   P                  VP                  P                  4       RV n        R# )zwRecord class names. We assume classes always only appear at top-level (i.e. no class definition in function or similar)TN)r   ÚappendÚnameÚvaluer   ©r   r   s   &&r   Úvisit_ClassDefÚClassFinder.visit_ClassDef.   s$   € à�L‰L×Ñ §	¡	§¡Ô0Ø#ˆDÖr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# ©r   r   r   )r   r    s   "€r   r!   r"   3   s   ø€ ÷ 	%ñ 	%¡s§|¡|ñ 	%r   c                ó   € R V n         R# r   )r   r'   s   &&r   Úleave_ClassDefÚClassFinder.leave_ClassDef3   s
   € Ø$ˆDÖr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# r+   )r   ÚSimpleStatementLine)r   r    s   "€r   r!   r"   6   s   ø€ ÷ 
	pñ 
	p±#×2IÑ2Iñ 
	pr   c                óê  € \         P                  ! \         P                  ! \         P                  ! \         P                  ! 4       R7      .R7      .R7      pV P
                  '       Eg   \         P                  ! W4      '       dç   \        \        P                  VP                  ^ ,          4      p\        \        P                  VP                  ^ ,          P                  4      P                  pVR8X  dt   \        \        P                  VP                  4      P                  pV Uu. uF1  p\        \        P                  VP                  4      P                  NK3  	  upV n        R# R# R# R# u upi )z:Record all public classes inside the `__all__` assignment.)Útarget)Útargets)ÚbodyÚ__all__N)Úmr0   ÚAssignÚAssignTargetÚNamer   Úmatchesr   r   r4   r3   r2   r&   ÚTupleÚelementsÚSimpleStringr   )r   r   Ú!simple_top_level_assign_structureÚstmtÚassigned_variabler<   Úelements   &&     r   Úvisit_SimpleStatementLineÚ%ClassFinder.visit_SimpleStatementLine6   sô   € ä01×0EÒ0EÜ—h’h¬¯ª¼a¿fºf»hÔ(GÐ'HÔIÐJô1Ð-ð ×#×#Ñ#¬¯	ª	°$×(ZÒ(ZÜœCŸJ™J¨¯	©	°!­Ó5�Ü$(¬¯©°4·<±<Àµ?×3IÑ3IÓ$J×$PÑ$PÐ!Ø$¨	Ô1Ü#¤C§I¡I¨t¯z©zÓ:×CÑC�HÙfnÓ*oÑfnÐ[b¬4´×0@Ñ0@À'Ç-Á-Ó+P×+VÔ+VÑfnÑ*o�DÖ'ñ 2ñ )[Ñ#ùò
 +ps   Ä)7E0)r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r(   r-   rB   Ú__static_attributes__Ú__classdictcell__©r    s   @r   r   r   $   s/   ø‡ € ñ	ò	%÷
	$ð 	$÷
	%ð 	%÷
	pö 
	pr   r   z
# coding=utf-8
# Copyright aN   the HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
zimage_processing_auto.pyÚIMAGE_PROCESSOR_MAPPING_NAMESzvideo_processing_auto.pyÚVIDEO_PROCESSOR_MAPPING_NAMESzprocessing_auto.pyÚPROCESSOR_MAPPING_NAMESzfeature_extraction_auto.pyÚFEATURE_EXTRACTOR_MAPPING_NAMESc                óv   € V ^8„  d   QhR\         \        R,          \        P                  ! RR7      3,          /# )r   Ú	repo_pathNzFWhen not using an editable install, the path to the Transformers repo.)Úhelp)r   ÚstrÚtyperÚArgument)r   s   "r   r!   r!   b   s/   € ÷ ñ ÜÜˆd�
”E—N’NÐ(pÔqÐqõñr   c                ój   € \        4       w  pppp\        V e   \        V 4      M\        VVVVR7       R# )z;
Add a new model to the library, based on an existing one.
N©rQ   Úold_model_infosÚnew_lowercase_nameÚnew_model_paper_nameÚfilenames_to_add)Úget_user_inputÚ_add_new_model_like_internalr   Ú	REPO_PATHrW   s   &    r   Úadd_new_model_liker_   b   s?   € ô 	ÓñØØØØô !Ø%.Ò%:”$�y”/Ä	Ø'Ø-Ø1Ø)÷r   c                   ó6   a € ] tR t^}t o RtV 3R lR ltRtV tR# )Ú
ModelInfoszA
Retrieve the basic information about an existing model classes.
c                ó    <€ V ^8„  d   QhRS[ /# )r   Úlowercase_name)rS   )r   r    s   "€r   r!   ÚModelInfos.__annotate__‚   s   ø€ ÷ Vñ V¡sñ Vr   c                óŽ  € ^RI Hp ^RIHp ^RIHp ^RIHp ^RIH	p ^RI
Hp VP                  4       P                  RR4      P                  R	R4      V n        V P                  V9  d   V P                  P                  RR	4       V P                  V9  d   \        V R
24      hW P                  ,          V n        V P                   P                  RR4      V n        V P                  V9   dD   RV n        W`P                  ,          V n        V P&                  R8X  d   RMV P&                  V n        MRRuV n        V n        VP)                  V P                  R4      V n        VP)                  V P                  R4      V n        VP)                  V P                  R4      V n        VP)                  V P                  R4      V n        R# )r   ©ÚCONFIG_MAPPING_NAMES)rO   )rL   )rN   )ÚTOKENIZER_MAPPING_NAMES)rM   Ú Ú_Ú-z is not a valid model nameÚConfigÚ NÚPreTrainedTokenizerFast)Úmodels.auto.configuration_autorg   Ú#models.auto.feature_extraction_autorO   Ú!models.auto.image_processing_autorL   Úmodels.auto.processing_autorN   Úmodels.auto.tokenization_autorh   Ú!models.auto.video_processing_autorM   ÚlowerÚreplacerc   Ú
ValueErrorÚconfig_classÚcamelcase_nameÚtokenizer_classÚfast_tokenizer_classÚgetÚimage_processor_classesÚvideo_processor_classÚfeature_extractor_classÚprocessor_class)r   rc   rg   rO   rL   rN   rh   rM   s   &&      r   r   ÚModelInfos.__init__‚   s‡  € ÝIÝYÝUÝIÝKÝUð -×2Ñ2Ó4×<Ñ<¸SÀ#ÓF×NÑNÈsÐTWÓXˆÔØ×ÑÐ&:Ô:Ø×Ñ×'Ñ'¨¨SÔ1Ø×ÑÐ&:Ô:Ü Ð/Ð/IÐJÓKÐKà0×1DÑ1DÕEˆÔØ"×/Ñ/×7Ñ7¸À"ÓEˆÔð ×ÑÐ"9Ô9Ø#'ˆDÔ Ø(?×@SÑ@SÕ(TˆDÔ%à×1Ñ1Ð5NÔN‘ÐTX×TmÑTmð Õ%ð ?CÀDÐ;ˆDÔ  $Ô";à'D×'HÑ'HÈ×I\ÑI\Ð^bÓ'cˆÔ$Ø%B×%FÑ%FÀt×GZÑGZÐ\`Ó%aˆÔ"Ø'F×'JÑ'JÈ4×K^ÑK^Ð`dÓ'eˆÔ$Ø6×:Ñ:¸4×;NÑ;NÐPTÓUˆÖr   )	ry   rx   r{   r   r}   rc   r€   rz   r~   N)rD   rE   rF   rG   rH   r   rI   rJ   rK   s   @r   ra   ra   }   s   ø‡ € ñ÷Vö Vr   ra   c                óf   € V ^8„  d   QhR\         \        P                  ,          R\         R\         /# )r   Ú	file_nameÚnew_contentÚ	add_after)rS   ÚosÚPathLike)r   s   "r   r!   r!   ¤   s+   € ÷ ñ ¤3¬¯©Õ#4ð Ä3ð ÔSVñ r   c                óf  € \        V RRR7      ;_uu_ 4       pVP                  4       pRRR4       XP                  V^4      w  rVWR,           V,           V,           p\        V RRR7      ;_uu_ 4       pVP                  V4       RRR4       R#   + '       g   i     Ll; i  + '       g   i     R# ; i)a?  
A utility to add some content inside a given file.

Args:
    file_name (`str` or `os.PathLike`):
        The name of the file in which we want to insert some content.
    new_content (`str`):
        The content to add.
   add_after (`str`):
       The new content is added just after the first instance matching it.
Úrúutf-8©ÚencodingNÚw)ÚopenÚreadÚsplitÚwrite)rƒ   r„   r…   ÚfÚold_contentÚbeforeÚafters   &&&    r   Úadd_content_to_filer–   ¤   s‡   € ô 
ˆi˜ w×	/Õ	/°1Ø—f‘f“hˆ÷ 
0ð  ×%Ñ% i°Ó3�M€FØÕ$ {Õ2°UÕ:€Kä	ˆi˜ w×	/Õ	/°1Ø	�‰�Ô÷ 
0Ñ	/÷ 
0×	/ú÷ 
0×	/Ð	/ús   —BÁ0BÂB	ÂB0	c                óŒ   € V ^8„  d   QhR\         R\        R\        R\        R\        \        \        \
        3,          ,          /# ©r   rQ   rX   rY   rZ   r[   ©r   ra   rS   ÚlistÚtupleÚbool)r   s   "r   r!   r!   º   sO   € ÷ Iñ IÜðIäðIô ðIô ð	Iô
 œ5¤¤d Õ+Õ,ñIr   c           	     ó$  € RP                  R VP                  RR4      P                  R4       4       4      pVP                  pVP                  pVR,           UU	u. uF  w  r‰VP                  VR4      V	3NK  	  ppp	. p
V F;  w  r¹RV9   d   V
R,          w  rÍYÍ;'       g    T	3V
R&   K)  V
P                  W¹34       K=  	  \        V R,          R	,          R
,          R,          R,          RV RV R2RR7       V R,          R	,          R
,          R,          R,          P                  4       pV
 EFW  w  r‰V	'       g   K  V\        9   dv   \        V,          pRp\        P                  ! RV R2V\        P                  4      pVP                  ^4      p\        P                  ! RV R2V\        P                  4      pMoVP                  RR4      pV R,          R	,          R
,          R,          V,          P                  4       p\        P                  ! RV R2V\        P                  4      pV FR  p\        V R,          R	,          R
,          R,          V,          VP                  Wb4      P                  Wu4      VR7       KT  	  EKZ  	  R# u up	pi )až  
Add a model to all the relevant mappings in the auto module.

Args:
    old_model_infos (`ModelInfos`):
        The structure containing the class information of the old model.
    new_lowercase_name (`str`):
        The new lowercase model name.
    new_model_paper_name (`str`):
        The fully cased name (as in the official paper name) of the new model.
    filenames_to_add (`list[tuple[str, bool]]`):
        A list of tuples of all potential filenames to add for a new model, along a boolean flag describing if we
        should add this file or not. For example, [(`modeling_xxx.px`, True), (`configuration_xxx.py`, True), (`tokenization_xxx.py`, False),...]
rm   c              3   ó@   "  € T F  qP                  4       x € K  	  R # 5i©N©Útitle©Ú.0Úxs   & r   Ú	<genexpr>Ú-add_model_to_auto_mappings.<locals>.<genexpr>Ï   ó   é € Ð`Ñ0_¨1ŸW™WŸY˜YÓ0_ùó   ‚rk   rj   ºé   NNÚautoztokenization_auto_fast.pyÚsrcÚtransformersÚmodelszauto_mappings.pyz("z", "zConfig"),
        z2CONFIG_MAPPING_NAMES = OrderedDict(
    [
        ©r„   r…   z[^\w_]z%\s*=\s*OrderedDict\(\s*\[(.*?)\]\s*\)z( {8,12}\(\s*"z",.*?\),\n)(?: {4,12}\(|\])ú_fast.pyú.pyNéÿÿÿÿ)Újoinrv   r�   rc   ry   r$   r–   Ú	read_textÚ_AUTO_MAPPING_NAMESÚreÚsearchÚDOTALLÚgroupÚfindall)rQ   rX   rY   rZ   r[   Únew_cased_nameÚold_lowercase_nameÚold_cased_nameÚfilenameÚto_addÚcorrected_filenames_to_addÚfileÚprevious_fileÚprevious_to_addÚautofileÚmapping_nameÚblock_matchÚblockÚmatching_linesÚmatchs   &&&&&               r   Úadd_model_to_auto_mappingsrÊ   º   sƒ  € ð* —W‘WÑ`Ð0B×0JÑ0JÈ3ÐPSÓ0T×0ZÑ0ZÐ[^Ô0_Ó`Ó`€NØ(×7Ñ7ÐØ$×3Ñ3€NàWgÐhjÖWkôÙWkÑCSÀ8ˆ×	Ñ	Ð,¨fÓ	5°vÓ>ÑWkð ñ ð "$ÐÛ(‰ˆØ&¨$Ô.Ø-GÈÕ-KÑ*ˆMØ.;×=VÐ=VÐPVÐ-WÐ& rÓ*à&×-Ñ-¨t¨nÖ=ñ )ô Ø�EÕ˜NÕ*¨XÕ5¸Õ>ÐASÕSØÐ+Ð,¨D°Ð0@Ð@SÐTØHõð
 ˜EÕ! NÕ2°XÕ=ÀÕFÐI[Õ[×fÑfÓh€Hä6Ñˆß‰6ØÔ.Ô.ä2°8Õ<�Ø-�Ü ŸišiØ˜l˜^Ð+PÐQÐS[Ô]_×]fÑ]fó�ð $×)Ñ)¨!Ó,�Ü!#§¢Ø'Ð(:Ð';Ð;XÐYÐ[`Ôbd×bkÑbkó"‘ð
 $×+Ñ+¨J¸Ó>�Ø! EÕ)¨NÕ:¸XÕEÈÕNÐQYÕY×dÑdÓf�ä!#§¢Ø'Ð(:Ð';Ð;XÐYÐ[_Ôac×ajÑajó"�ó (�Ü#Ø Õ%¨Õ6¸ÕAÀFÕJÈXÕUØ %§¡Ð.@Ó U× ]Ñ ]Ø&ó!ð $÷ô (ó- 7ùó)s   ÁJc                óF   € V ^8„  d   QhR\         R\        \         ,          /# )r   Únew_paper_namer   )rS   rš   )r   s   "r   r!   r!     s   € ÷ 5=ñ 5=¤Cð 5=¼¼c½ñ 5=r   c                óN  € Rp\         P                  ! RR\        4      P                  RR4      V,           p\        P
                  ! RV  RV  R24      p. pV F,  pR	V R
V 2pRV9   d
   VR,          pVP                  V4       K.  	  RP                  V4      pW4,           V,           # )a  
Create a new doc file to fill for the new model.

Args:
    new_paper_name (`str`):
        The fully cased name (as in the official paper name) of the new model.
    public_classes (`list[str]`):
        A list of all the public classes that the model will have in the library.
u®   

âš ï¸� Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer.

-->

z# ?rm   zcoding=utf-8
z<!--z
        # z#

        ## Overview

        The a<   model was proposed in [<INSERT PAPER NAME HERE>](<INSERT PAPER LINK HERE>) by <INSERT AUTHORS HERE>.
        <INSERT SHORT SUMMARY HERE>

        The abstract from the paper is the following:

        <INSERT PAPER ABSTRACT HERE>

        Tips:

        <INSERT TIPS ABOUT MODEL HERE>

        This model was contributed by [INSERT YOUR HF USERNAME HERE](https://huggingface.co/<INSERT YOUR HF USERNAME HERE>).
        The original code can be found [here](<INSERT LINK TO GITHUB REPO HERE>).

        ## Usage examples

        <INSERT SOME NICE EXAMPLES HERE>

        z## z

[[autodoc]] ÚModelz
    - forwardú

)r¶   ÚsubÚ	COPYRIGHTrv   ÚtextwrapÚdedentr$   r³   )	rÌ   r   Ú
added_noteÚcopyright_for_markdownÚdoc_templateÚdoc_for_classesÚclass_ÚdocÚ	class_docs	   &&       r   Úcreate_doc_filerÛ     sÊ   € ð	Kð ô  ŸVšV F¨B´	Ó:×BÑBÐCSÐU[Ó\Ð_iÕiÐä—?’?ðØÐ
ð ð Ðð 	ð	ó€Lð8 €OÛ ˆØ�F�8Ð+¨F¨8Ð4ˆØ�fÔØÐ$Õ$ˆCØ×Ñ˜sÖ#ñ	 !ð —‘˜OÓ,€Ià!Õ0°9Õ<Ð<r   c                óH   € V ^8„  d   QhR\         R\        R\        R\        /# )r   rQ   r¼   rY   rZ   )r   rS   )r   s   "r   r!   r!   >  s,   € ÷ ñ ÜðÜ),ðÜBEðÜ]`ñr   c                ó¢  € V R,          R,          R,          R,          p\        VR4      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! RV R2X4      pVf   \	        R	V 24      hVP                  ^ 4      pR
V RV R2p	\        V R,          R,          R,          R,          W˜R7       R#   + '       g   i     L‚; i)a\  
Insert the new model in the doc `_toctree.yaml`, in the same section as the old model.

Args:
    old_lowercase_name (`str`):
        The old lowercase model name.
    new_lowercase_name (`str`):
        The new lowercase model name.
    new_model_paper_name (`str`):
        The fully cased name (as in the official paper name) of the new model.
ÚdocsÚsourceÚenz_toctree.ymlr‰   Nz- local: model_doc/z\n {8}title: .*?\nzCould not find TOC entry for z      - local: model_doc/z
        title: Ú
r¯   )rŽ   r�   r¶   r·   rw   r¹   r–   )
rQ   r¼   rY   rZ   Útoc_filer’   ÚcontentÚ	toc_matchÚold_model_tocÚnew_tocs
   &&&&      r   Úinsert_model_in_doc_tocrç   >  sÉ   € ð ˜6Õ! HÕ,¨tÕ3°nÕD€HÜ	ˆh˜×	Ô	 Ø—&‘&“(ˆ÷ 
ô —	’	Ð0Ð1CÐ0DÐDXÐYÐ[bÓc€IØÒÜÐ8Ð9KÐ8LÐMÓNÐNØ—O‘O AÓ&€MØ)Ð*<Ð)=Ð=NÐOcÐNdÐdfÐg€GÜØ�FÕ˜XÕ%¨Õ,¨~Õ=È7÷÷ 
×	ús   ³B>Â>C	c          	      ót   € V ^8„  d   QhR\         R\         R\        \        \         \        3,          ,          /# )r   r¼   rY   r[   )rS   rš   r›   rœ   )r   s   "r   r!   r!   Z  s4   € ÷ #ñ #¬ð #Ä#ð #ÔY]Ô^cÔdgÔimÐdmÕ^nÕYoñ #r   c                óø   € V UUu. uF(  w  r4VP                  W4      P                  RR4      V3NK*  	  pppRP                  R V 4       4      p\        \        P                  ! RV R24      ,           pV# u uppi )a  
Create the `__init__.py` file to add in the new model folder.

Args:
    old_lowercase_name (`str`):
        The old lowercase model name.
    new_lowercase_name (`str`):
        The new lowercase model name.
    filenames_to_add (`list[tuple[str, bool]]`):
        A list of tuples of all potential filenames to add for a new model, along a boolean flag describing if we
        should add this file or not. For example, [(`modeling_xxx.px`, True), (`configuration_xxx.py`, True), (`tokenization_xxx.py`, False),...]
r±   rm   ú
            c              3   óF   "  € T F  w  rV'       g   K  R V R2x € K  	  R# 5i)zfrom .z	 import *N© )r£   rÁ   r¿   s   &  r   r¥   Ú#create_init_file.<locals>.<genexpr>k  s#   é € Ð#lÑQaÁÀÔekÔ$< f¨T¨F°)Õ$<ÓQaùs   ‚!“!z¾
        from typing import TYPE_CHECKING

        from ...utils import _LazyModule
        from ...utils.import_utils import define_import_structure


        if TYPE_CHECKING:
            zÐ
        else:
            import sys

            _file = globals()["__file__"]
            sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
        )rv   r³   rÑ   rÒ   rÓ   )r¼   rY   r[   r¾   r¿   ÚimportsÚ	init_files   &&&    r   Úcreate_init_filerð   Z  s˜   € ñ !1ôá 0ÑˆHð 
×	Ñ	Ð,Ó	A×	IÑ	IÈ%ÐQSÓ	TÐV\Ó]Ù 0ð ñ ð ×#Ñ#Ñ#lÑQaÓ#lÓl€GÜœHŸOšOðð ˆIð 	ð	óõ €Ið" Ðùó-s   †.A6c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úmodule_namer   )rS   Úset)r   s   "r   r!   r!   €  s   € ÷ 3ñ 3¬Cð 3´Cñ 3r   c                ó  € \        V RRR7      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! X4      p\	        4       pVP                  V4       VP                  VP                  3#   + '       g   i     LY; i)zÐ
Find the name of all classes defined in `module_name`, including public ones (defined in `__all__`).

Args:
    module_name (`str`):
        The full path to the python module from which to extract classes.
r‰   rŠ   r‹   N)rŽ   r�   r   Úparse_moduler   Úvisitr   r   )rò   rÁ   Úsource_codeÚmoduleÚvisitors   &    r   Úfind_all_classes_from_filerú   €  sf   € ô 
ˆk˜3¨×	1Õ	1°TØ—i‘i“kˆ÷ 
2ä×Ò˜kÓ*€FÜ‹m€GØ
‡L�L�ÔØ�?‰?˜G×2Ñ2Ð2Ð2÷ 
2×	1ús   —A9Á9B		c                ót   € V ^8„  d   QhR\         R\        R\        R\        \        \        \        3,          /# )r   rò   rX   r»   r   )r   ra   rS   r›   rš   )r   s   "r   r!   r!   �  s7   € ÷ 4ñ 4Üð4Ü(2ð4ÜDGð4ä
Œ3””Tˆ>Õñ4r   c                óZ  aa	€ \        V 4      w  r4RP                  V P                  RR 4      P                  RR4      pVP                  o	RV RRP                  R V 4       4       2pR	P                  VV	3R
 lV 4       4      pV Uu. uF  qˆP                  S	S4      NK  	  ppWgV3# u upi )ak  
Extract the modular structure that will be needed to copy a file `module_name` using modular.

Args:
    module_name (`str`):
        The full path to the python module to copy with modular.
    old_model_infos (`ModelInfos`):
        The structure containing the class information of the old model.
    new_cased_name (`str`):
        The new cased model name.
Ú.Nr±   rm   zfrom ..z import z, c              3   ó$   "  € T F  qx € K  	  R # 5irŸ   rì   )r£   rØ   s   & r   r¥   Ú)find_modular_structure.<locals>.<genexpr>¡  s   é € Ð:\ÑP[Àf¼6ÓP[ùs   ‚rÏ   c              3   óV   <"  € T F  pR VP                  SS4       RV R2x € K   	  R# 5i)zclass Ú(z):
    passN)rv   )r£   rØ   r»   r½   s   & €€r   r¥   rÿ   ¢  s1   øé € ð "ÙepÐ[aˆ&�—‘ °Ó?Ð@ÀÀ&ÀÈÕVÓepùs   ƒ&)éþÿÿÿ)rú   r³   Úpartsrv   ry   )
rò   rX   r»   Úall_classesr   Úimport_locationrî   Úmodular_classesrØ   r½   s
   &&f      @r   Úfind_modular_structurer  �  s¸   ù€ ô #=¸[Ó"IÑ€KØ—h‘h˜{×0Ñ0°°Ð5Ó6×>Ñ>¸uÀbÓI€OØ$×3Ñ3€NØ˜Ð(¨°·±Ñ:\ÑP[Ó:\Ó1\Ð0]Ð^€GØ—k‘kõ "Ùepó"ó €Oñ TbÓbÑSaÈ—n‘n ^°^ÖDÑSa€NÐbØ ^Ð3Ð3ùò cs   ÂB(c                óŒ   € V ^8„  d   QhR\         R\        R\        R\        \        \        \
        3,          ,          R\        /# )r   rQ   rX   rY   r[   r   r™   )r   s   "r   r!   r!   ©  sH   € ÷ 2,ñ 2,Üð2,äð2,ô ð2,ô œ5¤¤d Õ+Õ,ð	2,ô
 	ñ2,r   c                ód  € RP                  R VP                  RR4      P                  R4       4       4      pVP                  pV R,          R,          R,          V,          pRpRp. p	V FM  w  r«V'       g   K  \	        Wj,          W4      w  rÍpVRV 2,          pVR	V 2,          pV	P                  V4       KO  	  R
P                  R V	 4       4      p\        P                  ! RV R24      p\        V,           V,           V,           pV	 Uu. uF  pVP                  RR4      NK  	  p	pVV	3# u upi )am  
Create a new modular file which will copy the old model, based on the new name and the different filenames
(modules) to add.

Args:
    old_model_infos (`ModelInfos`):
        The structure containing the class information of the old model.
    new_lowercase_name (`str`):
        The new lowercase model name.
    filenames_to_add (`list[tuple[str, bool]]`):
        A list of tuples of all potential filenames to add for a new model, along a boolean flag describing if we
        should add this file or not. For example, [(`modeling_xxx.px`, True), (`configuration_xxx.py`, True), (`tokenization_xxx.py`, False),...]
rm   c              3   ó@   "  € T F  qP                  4       x € K  	  R # 5irŸ   r    r¢   s   & r   r¥   Ú&create_modular_file.<locals>.<genexpr>¼  r§   r¨   rk   rj   r¬   r­   r®   rá   rÏ   rê   c              3   ó*   "  € T F	  q R 2x € K  	  R# 5i)Ú,Nrì   )r£   Úpublic_classs   & r   r¥   r  Î  s   é € Ð4oÑ\nÈL°~ÀQÕ5GÓ\nùs   ‚z"

        __all__ = [
            z
        ]
        Ú")	r³   rv   r�   rc   r  ÚextendrÒ   rÓ   rÑ   )rQ   rX   rY   r[   r»   r¼   Úold_folder_rootÚall_importsÚ
all_bodiesÚall_public_classesr¾   r¿   rî   r4   r   Úpublic_classes_formattedÚall_statementÚmodular_filer  s   &&&&               r   Úcreate_modular_filer  ©  sO  € ð& —W‘WÑ`Ð0B×0JÑ0JÈ3ÐPSÓ0T×0ZÑ0ZÐ[^Ô0_Ó`Ó`€NØ(×7Ñ7ÐØ %Õ'¨.Õ8¸8ÕCÐFXÕX€Oð €KØ€JØÐÛ,Ñˆß‰6Ü,BØÕ*¨Oó-Ñ)ˆG˜>ð ˜R ˜y˜>Õ)ˆKØ˜D  ˜-Õ'ˆJØ×%Ñ% nÖ5ñ -ð  0×4Ñ4Ñ4oÑ\nÓ4oÓoÐÜ—O’Oðð &Ð&ð '	ð	ó€Mô ˜{Õ*¨ZÕ7¸-ÕG€LáL^Ó_ÑL^¸L˜,×.Ñ.¨s°BÖ7ÑL^ÐÐ_ØÐ+Ð+Ð+ùò `s   ÄD-c          	      ót   € V ^8„  d   QhR\         R\        R\        \        \        \
        3,          ,          /# )r   rQ   rX   r[   )r   ra   rš   r›   rS   rœ   )r   s   "r   r!   r!   Þ  s6   € ÷ 1ñ 1Üð1Ü&0ð1ÜX\Ô]bÔcfÔhlÐclÕ]mÕXnñ1r   c           	     óê  € RP                  R VP                  RR4      P                  R4       4       4      pVP                  pVP                  pVR,           UUu. uF  w  rxRVP                  WR4      ,           V3NK!  	  ppp. p	V FU  w  r¨\
        P                  ! RV R2V
4      '       d   V	R,          w  r¼Y¼;'       g    T3V	R&   KC  V	P                  W¨34       KW  	  / pV	 Fñ  w  rèV'       g   K  VP                  W%4      pV R	,          R
,          V,          V,          pVP                  4       '       g   KV  \        VR4      ;_uu_ 4       pVP                  4       pRRR4       XP                  R4      p^ pVV,          P                  R4      '       d   V^,          pK)  \        RP                  VVR 4      ,           pVP                  Wd4      WÞ&   Kó  	  V# u uppi   + '       g   i     LŠ; i)aa  
Create the test files for the new model. It basically copies over the old test files and adjust the class names.

Args:
    old_model_infos (`ModelInfos`):
        The structure containing the class information of the old model.
    new_lowercase_name (`str`):
        The new lowercase model name.
    filenames_to_add (`list[tuple[str, bool]]`):
        A list of tuples of all potential filenames to add for a new model, along a boolean flag describing if we
        should add this file or not. For example, [(`modeling_xxx.px`, True), (`configuration_xxx.py`, True), (`tokenization_xxx.py`, False),...]
rm   c              3   ó@   "  € T F  qP                  4       x € K  	  R # 5irŸ   r    r¢   s   & r   r¥   Ú$create_test_files.<locals>.<genexpr>í  r§   r¨   rk   rj   r©   Útest_z+test_(?:tokenization)|(?:image_processing)_r°   Útestsr®   r‰   Nrá   Ú#r²   )r³   rv   r�   rc   ry   r¶   r·   r$   Úis_filerŽ   r�   Ú
startswithrÑ   )rQ   rX   rY   r[   r»   r¼   r½   r¾   r¿   rÀ   rÁ   rÂ   rÃ   Ú
test_filesÚnew_fileÚoriginal_test_fileÚoriginal_test_pathr’   Ú	test_codeÚ
test_linesÚidxs   &&&&                 r   Úcreate_test_filesr)  Þ  sà  € ð —W‘WÑ`Ð0B×0JÑ0JÈ3ÐPSÓ0T×0ZÑ0ZÐ[^Ô0_Ó`Ó`€NØ(×7Ñ7ÐØ$×3Ñ3€Nð !1°Ö 4ôá 4ÑˆHð 
�8×#Ñ#Ð$6ÓKÕ	KÈVÓTÙ 4ð ñ ð
 "$ÐÛ(‰ˆÜ�9Š9ÐCÐDVÐCWÐW_Ð`Ðbf×gÒgØ-GÈÕ-KÑ*ˆMØ.;×=VÐ=VÐPVÐ-WÐ& rÓ*à&×-Ñ-¨t¨nÖ=ñ )ð €JÛ6Ñˆß‰6Ø!)×!1Ñ!1Ð2DÓ!YÐØ!*¨WÕ!4°xÕ!?ÐBTÕ!TÐWiÕ!iÐà%×-Ñ-×/Ò/ÙÜÐ(¨#×.Ô.°!ØŸF™F›H�	÷ /ð #Ÿ™¨Ó.ˆJØˆCØ˜S•/×,Ñ,¨S×1Ò1Ø�q•’Ü! D§I¡I¨j¸¸Ð.>Ó$?Õ?ˆIØ#,×#4Ñ#4°^Ó#TˆJÓ ñ 7ð" Ðùó?÷* /×.ús   Á%GÅG"Ç"G2c                óŒ   € V ^8„  d   QhR\         R\        R\        R\        R\        \        \        \
        3,          ,          /# r˜   r™   )r   s   "r   r!   r!     sO   € ÷ \ñ \Üð\äð\ô ð\ô ð	\ô
 œ5¤¤d Õ+Õ,ñ\r   c                ó"  € \        4       '       g   \        R4      hVP                  pV R,          R,          R,          V,          p\        P                  ! VRR7       \        WW$4      w  rx\        VRV R2,          R	4      ;_uu_ 4       p	V	P                  V4       R
R
R
4       \        WRV4      p
\        VR,          R	4      ;_uu_ 4       p	V	P                  V
4       R
R
R
4       \        V R,          R,          R,          R,          RV R2RR7       \        WW#V4       V R,          R,          V,          p\        P                  ! VRR7       \        VR,          R	4      ;_uu_ 4         R
R
R
4       \        WW$4      pVP                  4        F9  w  rÞ\        W½,          R	4      ;_uu_ 4       p	V	P                  V4       R
R
R
4       K;  	  \        W84      p\        V R,          R,          R,          R,          V R2,          R	4      ;_uu_ 4       p	V	P                  V4       R
R
R
4       \        WW#4       V R,          R,          R,          R,          p\        P                   ! RRWkVR.V \        P"                  R7       \        P                   ! RRWkV.V \        P"                  R7       \        P                   ! . ROV \        P"                  R7       \        P                   ! RR.V \        P"                  R7       \        P                   ! RRV.V \        P"                  R7       R
#   + '       g   i     EL˜; i  + '       g   i     ELk; i  + '       g   i     ELð; i  + '       g   i     EKé  ; i  + '       g   i     ELa; i)a  
Creates a new model module like a given model of the Transformers library.

Args:
    repo_path (`Path`):
        The path to the root of the Transformers repository.
    old_model_infos (`ModelInfos`):
        The structure containing the class information of the old model.
    new_lowercase_name (`str`):
        The new lowercase model name.
    new_model_paper_name (`str`):
        The fully cased name (as in the official paper name) of the new model.
    filenames_to_add (`list[tuple[str, bool]]`):
        A list of tuples of all potential filenames to add for a new model, along a boolean flag describing if we
        should add this file or not. For example, [(`modeling_xxx.px`, True), (`configuration_xxx.py`, True), (`tokenization_xxx.py`, False),...]
zHYou need to install `libcst` to run this command -> `pip install libcst`r¬   r­   r®   T)Úexist_okÚmodular_r±   r�   Nz__init__.pyz
    from .z
 import *
zif TYPE_CHECKING:
r¯   r  rÞ   rß   rà   Ú	model_docz.mdÚruffÚcheckz--fix)ÚcwdÚstdoutr   Úpythonzutils/sort_auto_mappings.pyz utils/modular_model_converter.py)r3  zutils/check_doc_toc.pyz--fix_and_overwrite)r	   rw   rc   r†   Úmakedirsr  rŽ   r‘   rð   r–   rÊ   r)  ÚitemsrÛ   rç   Ú
subprocessÚrunÚDEVNULL)rQ   rX   rY   rZ   r[   r¼   Únew_module_folderr  r   r’   rï   Útests_folderr"  r¾   rã   Údoc_fileÚmodel_init_files   &&&&&            r   r]   r]     s  € ô0 × Ò ÜÐcÓdÐdà(×7Ñ7Ðð " EÕ)¨NÕ:¸XÕEÐHZÕZÐÜ‡K‚KÐ!¨DÕ1ô $7ØÐ$6ó$Ñ €Lô 
Ð HÐ-?Ð,@ÀÐ"DÕDÀc×	JÔ	JÈaØ	�‰�Ô÷ 
Kô !Ð!3ÐIYÓZ€IÜ	Ð -Õ/°×	5Ô	5¸Ø	�‰�	Ô÷ 
6ô Ø�EÕ˜NÕ*¨XÕ5¸ÕEØ Ð!3Ð 4°KÐ@Ø'õô ˜yÐ;MÐeuÔvð ˜wÕ&¨Õ1Ð4FÕF€LÜ‡K‚K� tÕ,ä	ˆl˜]Õ*¨C×	0Õ	0Ø÷ 
1ä" 9Ð?QÓd€JØ'×-Ñ-Ö/ÑˆÜ�,Õ)¨3×/Ô/°1Ø�G‰G�GÔ÷ 0Ñ/ñ 0ô
 Ð3ÓD€HÜ	ˆi˜&Õ  8Õ+¨dÕ2°[Õ@ÐFXÐEYÐY\ÐC]Õ]Ð_b×	cÔ	cÐghØ	�‰�Ô÷ 
dä˜IÐ;MÔdð   %Õ'¨.Õ8¸8ÕCÀmÕS€OÜ‡N‚NØ	�Ð+¸?ÈGÐTØÜ×!Ñ!õô
 ‡N‚NØ	�Ð,¸OÐLØÜ×!Ñ!õô
 ‡N‚NÚCÈÔ[e×[mÑ[mõô ‡N‚N�HÐ;Ð<À)ÔT^×TfÑTfÕgô ‡N‚NØ	Ð5Ð7IÐJÐPYÔbl×btÑbt÷÷k 
K×	JÐ	Jú÷
 
6×	5Ð	5ú÷" 
1×	0Ð	0ú÷ 0×/Ñ/ú÷
 
d×	cÐ	cús<   ÂL,ÃM Å+MÆ0M(ÈM=Ì,L=	Í M	ÍM%	Í(M:Í=N	c          
      ó~   € V ^8„  d   QhR\         R\         R,          R\        R,          R\         R,          R\        /# )r   ÚquestionÚdefault_valueNÚ
convert_toÚfallback_messager   )rS   r   r   )r   s   "r   r!   r!   q  sF   € ÷ .ñ .Üð.ä˜•:ð.ô ˜4•ð.ô ˜D•jð	.ô
 	ñ.r   c                ó,  € V P                  R4      '       g
   V R,           p Ve	   V  RV R2p RpV'       gK   \        V 4      pVe   \        V4      ^ 8X  d   TpVe    V! V4      pRpMRpV'       d   KE  \	        V4       KR  X#   \         d    Rp L(i ; i)aø  
A utility function that asks a question to the user to get an answer, potentially looping until it gets a valid
answer.

Args:
    question (`str`):
        The question to ask the user.
    default_value (`str`, *optional*):
        A potential default value that will be used when the answer is empty.
    convert_to (`Callable`, *optional*):
        If set, the answer will be passed to this function. If this function raises an error on the provided
        answer, the question will be asked again.
    fallback_message (`str`, *optional*):
        A message that will be displayed each time the question is asked again to the user.

Returns:
    `Any`: The answer provided by the user (or the default), passed through the potential conversion function.
ri   z [z] FT)ÚendswithÚinputÚlenÚ	ExceptionÚprint)r>  r?  r@  rA  Úvalid_answerÚanswers   &&&&  r   Úget_user_fieldrJ  q  s§   € ð0 ×Ñ˜S×!Ò!Ø˜c•>ˆØÒ Ø�Z˜r - °Ð3ˆà€LßÜ�x“ˆØÒ$¬¨V«¸Ô)9Ø"ˆFØÒ!ð%Ù# FÓ+�Ø#‘ð  ˆLç‰|ÜÐ"Ö#à€Møô ô %Ø$’ð%ús   Á
B ÂBÂBc                ó0   € V ^8„  d   QhR\         R\        /# )r   r¤   r   )rS   rœ   )r   s   "r   r!   r!   ¢  s   € ÷ Mñ M”sð Mœtñ Mr   c                óz   € V P                  4       R9   d   R# V P                  4       R9   d   R# \        V  R24      h)z
Converts a string to a bool.
TFz0 is not a value that can be converted to a bool.)Ú1ÚyÚyesÚtrue)Ú0ÚnÚnoÚfalse)ru   rw   )r¤   s   &r   Úconvert_to_boolrU  ¢  s;   € ð 	‡w�wƒyÐ-Ô-ÙØ‡w�wƒyÐ-Ô-ÙÜ
˜�sÐJÐKÓ
LÐLr   c            
     ó:  € ^ RI Hp  \        V P                  4       4      pRpV'       g~   \	        R4      pW19   d   RpK  \        V R24       \        P                  ! W14      p\        V4      ^8¼  g   KS  \        V4      ^8”  d   RP                  V4      p\        RV R24       K…  \        X4      p\        R	4      p\        R
RP                  R VP                  R4       4       4      R7      pRpRp	Rp
RpRpRpVP                  e   \        RV R2\        RR7      pVP                  e   \        RV R2\        RR7      p	VP                   e   \        RV R2\        RR7      p
VP"                  e   \        RV R2\        RR7      pVP$                  e   \        RV R2\        RR7      pVP&                  e   \        RV R2\        RR7      pVP(                  pRV R2R3RV R2R3RV R2V3RV R2V	3RV R2V
3RV R2V3RV R2V3R V R2V33pWVW3# )!z=
Ask the user for the necessary inputs to add the new model.
rf   FzWWhat model would you like to duplicate? Please provide it as lowercase, e.g. `llama`): Tz is not a valid model type.z or zDid you mean Ú?zSWhat is the new model name? Please provide it as snake lowercase, e.g. `new_model`?zUWhat is the fully cased name you would like to appear in the doc (e.g. `NeW ModEl`)? rm   c              3   ó@   "  € T F  qP                  4       x € K  	  R # 5irŸ   r    r¢   s   & r   r¥   Ú!get_user_input.<locals>.<genexpr>Í  s   é € ÐOÑ1N¨AŸg™gŸi˜iÓ1Nùr¨   rj   )r?  zHDo you want to create a new tokenizer? If `no`, it will use the same as z (y/n)?z.Please answer yes/no, y/n, true/false or 1/0. )r@  rA  zMDo you want to create a new fast tokenizer? If `no`, it will use the same as zNDo you want to create a new image processor? If `no`, it will use the same as zNDo you want to create a new video processor? If `no`, it will use the same as zPDo you want to create a new feature extractor? If `no`, it will use the same as zHDo you want to create a new processor? If `no`, it will use the same as Úconfiguration_r±   Ú	modeling_Útokenization_r°   Úimage_processing_Úvideo_processing_Úfeature_extraction_Úprocessing_)Ú+transformers.models.auto.configuration_autorg   rš   ÚkeysrD  rG  ÚdifflibÚget_close_matchesrE  r³   ra   rJ  r�   rz   rU  r{   r}   r~   r   r€   rc   )rg   Úmodel_typesÚvalid_model_typeÚold_model_typeÚnear_choicesrX   rY   rZ   Úadd_tokenizerÚadd_fast_tokenizerÚadd_image_processorÚadd_video_processorÚadd_feature_extractorÚadd_processorr¼   r[   s                   r   r\   r\   ­  sÚ  € õ QäÐ+×0Ñ0Ó2Ó3€Kð ÐßÜØeó
ˆð Ô(Ø#Òä�^Ð$Ð$?Ð@ÔAÜ"×4Ò4°^ÓQˆLÜ�<Ó  AÖ%Ü�|Ó$ qÔ(Ø#)§;¡;¨|Ó#<�LÜ˜ l ^°1Ð5Ö6ä  Ó0€Oô (Ø]óÐô *Ø_Ø—g‘gÑOÐ1C×1IÑ1IÈ#Ô1NÓOÓOôÐð €MØÐØÐØÐØ!ÐØ€MØ×&Ñ&Ò2Ü&ØVÐWeÐVfÐfmÐnÜ&ØMô
ˆð
 ×+Ñ+Ò7Ü+Ø[Ð\jÐ[kÐkrÐsÜ&ØMô
Ðð
 ×.Ñ.Ò:Ü,Ø\Ð]kÐ\lÐlsÐtÜ&ØMô
Ðð
 ×,Ñ,Ò8Ü,Ø\Ð]kÐ\lÐlsÐtÜ&ØMô
Ðð
 ×.Ñ.Ò:Ü .Ø^Ð_mÐ^nÐnuÐvÜ&ØMô!
Ðð
 ×&Ñ&Ò2Ü&ØVÐWeÐVfÐfmÐnÜ&ØMô
ˆð )×7Ñ7Ðð Ð,Ð-¨SÐ	1°4Ð8ØÐ'Ð(¨Ð	,¨dÐ3ØÐ+Ð,¨CÐ	0°-Ð@ØÐ+Ð,¨HÐ	5Ð7IÐJØÐ/Ð0°Ð	4Ð6IÐJØÐ/Ð0°Ð	4Ð6IÐJØÐ1Ð2°#Ð	6Ð8MÐNØÐ)Ð*¨#Ð	.°Ð>ð	Ðð Ð0DÐVÐVr   rŸ   )NNN)0rc  r†   r¶   r6  rÒ   Úcollections.abcr   Údatetimer   Úpathlibr   Útypingr   r   r   rT   Úutilsr	   Úlibcstr   r
   r   r6   r   ÚtodayÚyearÚCURRENT_YEARÚ__file__Úparentsr^   ÚlstriprÑ   rµ   r_   ra   r–   rÊ   rÛ   rç   rð   rú   r  r  r)  r]   rJ  rU  r\   rì   r   r   Ú<module>r{     s  ðó Û 	Û 	Û Û Ý $Ý Ý ß 'Ñ 'ã å 'ñ
 ×ÒÛÝ!Ý$ôp�jô pð> �zŠz‹|× Ñ €Ù�‹N×"Ñ" 1Õ%€	ðàˆNð ð÷ �FƒHð 
ð& Ð ?ØÐ ?ØÐ3Ø Ð"Cð	Ð ÷÷6$Vñ $VõNõ,IõX5=õpõ8#õL3õ 4õ22,õj1õh\÷~.õbMô\Wr   