+
    œ°³j(&  ã                  ó  € R t ^ RIHt ^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^RIHt ^RIHtHt ^RIHt ^R	IHt ]P(                  ! ]4      t]	'       d$   ]! 4       '       d   ^ R
It^RIHt ^RIHt ^RIHt  ! R R]4      tR
# )z3Abstract base class for all Transformers exporters.)Úannotations)ÚABCÚabstractmethod)ÚMutableMapping)ÚTYPE_CHECKING)Úversion)Úlogging)Ú_is_package_availableÚis_torch_available)ÚExportConfigMixin)Údecompose_for_generationN)ÚCache)ÚGenerationConfig)ÚPreTrainedModelc                  óx   € ] tR t^+t$ Rt. tR]R&   / tR]R&   / tR]R&   R t	R t
]R	 R
 l4       tRR R lltRtR# )Ú
HfExporterz�
Abstract base class for all Transformers exporters.

Subclass and implement [`~HfExporter.export`] to add a new export backend.
z	list[str]Úrequired_packageszdict[str, str]Úmin_versionsÚtested_versionsc                	ó&   € V P                  4        R # )N)Úvalidate_environment)Úselfs   &Ú\/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/exporters/base.pyÚ__init__ÚHfExporter.__init__8   s   € Ø×!Ñ!Ö#ó    c           	     óR  a € . . rCS P                    F¤  p\        VRR7      w  rgV'       g   VP                  V4       K-  S P                  P	                  V4      pVf   KN  VR8w  g   KW  VP                  R^4      ^ ,          p	VP                  R^4      ^ ,          p
Wš8w  g   K‘  VP                  WYV
34       K¦  	  V'       d@   RP                  V 3R lV 4       4      p\        R\        S 4      P                   R	V 24      h. pS P                  P                  4        F}  w  r]\        VRR7      w  rçVR8X  gI   \        P                  ! VP                  R^4      ^ ,          4      \        P                  ! V4      8  g   Kc  VP                  V R
V RV R24       K  	  V'       d3   \        \        S 4      P                   RRP                  V4       24      hV'       dI   RP                  R V 4       4      p\        P                  \        S 4      P                   RV R24       R# R# )zYCheck `required_packages` are installed and warn on version drift from `tested_versions`.T)Úreturn_versionNzN/AÚ+z, c              3  óx   <"  € T F/  qSP                   9   d   V R SP                   V,           2MTx € K1  	  R# 5i)z==N)r   )Ú.0Úpkgr   s   & €r   Ú	<genexpr>Ú2HfExporter.validate_environment.<locals>.<genexpr>O   s>   øé € ð ÙipÐbeÀ×@TÑ@TÔ9T�3�%�r˜$×.Ñ.¨sÕ3Ð4Ñ5ÐZ]Ô]Óipùs   ƒ7:zTo use z-, please install the following dependencies: z>=z (found Ú)z requires newer versions of: c              3  ó:   "  € T F  w  rq1 R V RV 2x € K  	  R# 5i)z: installed z	, tested N© )r    r!   ÚgotÚwants   &   r   r"   r#   ^   s&   é € ÐeÑ_dÉ^ÈSÐW[ % |°C°5¸	À$ÀÕ HÓ_dùs   ‚u~    is experimental and patches many backend internals; behaviour may differ from what was validated. Version drift detected â€” z-. If you hit issues, try the tested versions.)r   r	   Úappendr   ÚgetÚsplitÚjoinÚImportErrorÚtypeÚ__name__r   Úitemsr   ÚparseÚloggerÚwarning)r   ÚargsÚkwargsÚmissingÚdriftr!   ÚexistsÚ	installedÚtestedÚinstalled_baseÚtested_baseÚspecsÚoutdatedÚminimumÚ_Údetailss   f*,             r   r   ÚHfExporter.validate_environment;   sò  ø€ ð ˜R�Ø×)Ô)ˆCÜ 5°cÈ$Ô OÑˆFßØ—‘˜sÔ#ÙØ×)Ñ)×-Ñ-¨cÓ2ˆFØÔ! i°5Ö&8Ø!*§¡°°aÓ!8¸Õ!;�Ø$Ÿl™l¨3°Ó2°1Õ5�Ø!Ö0Ø—L‘L #°{Ð!CÖDñ *÷ Ø—I‘Iô Ùipóó ˆEô  ¬¨T«
×(;Ñ(;Ð'<Ð<iÐjoÐipÐqÓrÐrð ˆØ ×-Ñ-×3Ñ3Ö5‰LˆCÜ0°ÀTÔJ‰LˆAØ˜EÔ!¤W§]¢]°9·?±?À3ÈÓ3JÈ1Õ3MÓ%NÔQX×Q^ÒQ^Ð_fÓQgÖ%gØ—‘ 3 % r¨'¨°(¸9¸+ÀQÐ GÖHñ 6÷ Ü¤ d£×!4Ñ!4Ð 5Ð5RÐSW×S\ÑS\Ð]eÓSfÐRgÐhÓiÐiçØ—i‘iÑeÑ_dÓeÓeˆGÜ�N‰NÜ˜“:×&Ñ&Ð'ð (\Ø\cÐ[dð e>ð?öñ r   c               ó$   € V ^8„  d   QhRRRRRR/# )é   Úmodelr   Úsample_inputsú)MutableMapping[str, torch.Tensor | Cache]Úconfigr   r&   )Úformats   "r   Ú__annotate__ÚHfExporter.__annotate__f   s)   € ÷ 
ñ 
àð
ð Að
ð "ñ	
r   c                óD   € \        \        V 4      P                   R24      h)u  
Export the model and return the backend-specific program object.

Args:
    model ([`PreTrainedModel`]):
        The model to export.
    sample_inputs (`dict[str, torch.Tensor | Cache]`):
        **Forward** kwargs â€” what you'd pass to `model(**sample_inputs)`. These are used
        directly as the example inputs during tracing. For an autoregressive decode-step
        export, this means you need to include `past_key_values`, `cache_position`, etc.
        If you only have generation-style inputs, use [`~HfExporter.export_for_generation`]
        instead â€” it runs `model.generate` for you and exports each stage.
    config ([`~transformers.exporters.configs.ExportConfigMixin`]):
        Backend-specific configuration.

Returns:
    Backend-specific export artifact.
zø does not implement `export`. Pick a concrete exporter (`DynamoExporter`, `OnnxExporter`, `ExecutorchExporter`), or override `export` in your subclass with a backend-specific tracing pipeline that consumes `config` and returns the runtime artifact.)ÚNotImplementedErrorr.   r/   )r   rE   rF   rH   s   &&&&r   ÚexportÚHfExporter.exporte   s+   € ô2 "Ü�D‹z×"Ñ"Ð#ð $0ð 0ó
ð 	
r   Nc               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )rD   rE   r   rF   rG   rH   z0ExportConfigMixin | dict[str, ExportConfigMixin]Úgeneration_configzGenerationConfig | NoneÚmulti_token_decodeÚboolÚreturnzdict[str, object]r&   )rI   s   "r   rJ   rK   …   sP   € ÷ Hñ HàðHð AðHð Að	Hð
 3ðHð !ðHð 
ñHr   c                ó6  € \        VVVVR7      p\        V\        4      '       dK   \        V4      \        V4      ,
          pV'       d%   \	        R\        V4       R\        V4       R24      hTpM\        P                  Wc4      p/ p	VP                  4        F$  w  p
w  r¼ V P                  W¼WŠ,          R7      Wš&   K&  	  V	#   \         dM   p\        \        T 4      P                   RT
 R\        T4      P                   R\        T4       R	24      ThR
p?ii ; i)uÃ  
Decompose a generative model and export each component independently.

Thin wrapper around [`~exporters.utils.decompose_for_generation`] that calls
[`~HfExporter.export`] on every returned `(submodel, forward_inputs)` pair. If you need
the intermediate `(submodel, forward_inputs)` pairs (for verification, custom inputs,
skipping a stage, â€¦), call [`~exporters.utils.decompose_for_generation`] directly.

Args:
    model ([`PreTrainedModel`]):
        The generative model to export. Must support `model.generate(**sample_inputs)`.
    sample_inputs (`dict[str, torch.Tensor | Cache]`):
        **Generate** kwargs â€” what you'd pass to `model.generate(**sample_inputs)`
        (typically `input_ids` + `attention_mask`, plus any modality inputs like
        `pixel_values` / `input_features` for multi-modal models). Per-stage forward
        kwargs are captured internally.
    config ([`~transformers.exporters.configs.ExportConfigMixin`] or `dict[str, ExportConfigMixin]`):
        Backend-specific configuration. Pass a single config to apply to every
        component, or a `dict` keyed by component name (e.g. `"image_encoder"`,
        `"language_model"`, `"lm_head"`, `"decode"`) to override per-component â€”
        all component names must be present in the dict.
    generation_config ([`~generation.GenerationConfig`], *optional*):
        Forwarded to the `generate()` capture (defaults to the model's own). Pass one with
        `cache_implementation="static"` to export against a fixed-size `StaticCache`.
    multi_token_decode (`bool`, *optional*, defaults to `False`):
        Whether the `decode` component processes multiple query tokens at once â€” a dynamic
        query axis (prefill on an empty cache, continuation-from-past otherwise) â€” vs the
        classic single-token step (see [`~exporters.utils.decompose_for_generation`]). Only
        stays dynamic under a dynamic-shape export (`config.dynamic=True`).

Returns:
    `dict[str, Any]`: `{component_name: backend_specific_artifact}` â€” same keys as
    [`~exporters.utils.decompose_for_generation`]. Values are whatever
    [`~HfExporter.export`] returns for the concrete backend (`ExportedProgram`,
    `ONNXProgram`, `ExecutorchProgramManager`).
)rQ   rR   z4Per-component `config` dict is missing entries for: z$. Expected one entry per component: Ú.)rH   z.export failed on component 'z' (submodel=z, input keys=z).N)r   Ú
isinstanceÚdictÚsetÚ
ValueErrorÚsortedÚfromkeysr0   rN   Ú	ExceptionÚRuntimeErrorr.   r/   Úlist)r   rE   rF   rH   rQ   rR   Ú
componentsr6   ÚconfigsÚexportedÚnameÚsubmodelÚ	subinputsÚes   &&&&&&        r   Úexport_for_generationÚ HfExporter.export_for_generation…   s.  € ôX .ØØØ/Ø1ô	
ˆ
ô �fœd×#Ò#Ü˜*“o¬¨F«Õ3ˆGßÜ ØJÌ6ÐRYË?ÐJ[ð \9Ü9?À
Ó9KÐ8LÈAðOóð ð ‰Gä—m‘m JÓ7ˆGà&(ˆØ+5×+;Ñ+;Ö+=Ñ'ˆDÑ'�8ðØ!%§¡¨XÈÍ Ó!W�“ñ ,>ð ˆøô ô Ü"Ü˜D“z×*Ñ*Ð+Ð+HÈÈð O!Ü!% h£×!8Ñ!8Ð 9¸ÄtÈIÃÐFWÐWYð[óð ðûðús   Â CÃDÃADÄDr&   )NF)r/   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   r   r   r   r   rN   rg   Ú__static_attributes__r&   r   r   r   r   +   sS   ‡ ñð $&Ð�yÓ%à#%€L�.Ó%à&(€O�^Ó(ò$ò(ðT ô
ó ð
÷>Hó Hr   r   )rl   Ú
__future__r   Úabcr   r   Úcollections.abcr   Útypingr   Ú	packagingr   Úutilsr   Úutils.import_utilsr	   r
   ra   r   r   Ú
get_loggerr/   r2   ÚtorchÚcache_utilsr   Ú
generationr   Úmodeling_utilsr   r   r&   r   r   Ú<module>r{      s_   ðñ :å "ç #Ý *Ý  å å ß JÝ &Ý +ð 
×	Ò	˜HÓ	%€÷ Ù×ÒÛå'Ý1Ý4ôb�ö br   