§
    ­¸jè  ã                  óæ  — U d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ e	rddlmZ  e¦   «         Z ed	d	¬
¦  «         G d„ d¦  «        ¦   «         Z eddddd	¬¦  «         eddddd	d¬¦  «         eddddd	¬¦  «         eddddd ¬!¦  «         ed"d#d$d%d&¬!¦  «         ed'd(d)d*d+¬!¦  «         ed,d-d.d/d0¬!¦  «         ed1d2d3d4d5¬!¦  «        d6œZd7ed8<   ddd9œZd:ed;<   dCd?„ZdDdA„ZdEdB„ZdS )Fux  Which exporter class implements which export format, and how to reach it without importing the others.

Every format except ONNX sits behind an optional dependency â€” ``executorch``, ``coremltools``, ``coreai-torch``,
``openvino``, ``onnx2tf``/``tensorflow``, ``tensorrt``, ``litert_torch`` â€” and none of them may be imported by ``import
rfdetr``. The registry is therefore *data*: a format maps to the dotted path of its exporter class, and only
:func:`resolve_exporter` imports it. Adding a format is one entry here plus the module it names, which owns both the
exporter class and the configuration dataclass it is built from.
é    )ÚannotationsN)ÚMapping)Ú	dataclass)ÚTYPE_CHECKINGÚAny)Ú
get_logger)ÚExporterT)ÚfrozenÚslotsc                  óf   — e Zd ZU dZded<   ded<   ded<   ded<   dZd	ed
<   dZded<   dZded<   dS )ÚExporterEntryuž  Where one format's exporter class lives, what installs it, and the little that must be known before importing it.

    ``label``, ``supports_dynamic_batch`` and ``dynamic_batch_reason`` mirror the exporter class's own
    ``display_name``, ``supports_dynamic_batch`` and ``dynamic_batch_reason``. The duplication is deliberate and
    test-enforced (``tests/export/test_registry.py``): all three are needed *before* the format's module â€” and with it
    its heavy optional dependency â€” is imported, so a doomed request can be refused, in the format's own words, without
    paying for ``coremltools`` or TensorFlow.

    Attributes:
        module: Dotted path of the module defining the exporter class.
        attribute: Name of the exporter class within *module*.
        pip_extra: The ``rfdetr[...]`` extra that installs the format's dependencies, or ``None`` when it needs none.
        label: How the format is spelled in messages addressed to users.
        supports_dynamic_batch: Whether the format can bake a dynamic batch dimension into its artifact.
        dynamic_batch_reason: Why a fixed-batch format cannot honour ``dynamic_batch``, and what to do instead.
            Empty for formats that support it. Mirrors the exporter class's own ``dynamic_batch_reason`` so the
            pre-import refusal and the one the constructed exporter raises read identically.
        preimport: ``"module:function"`` to call before importing *module*, or ``None``. TFLite needs one: TensorFlow
            has to be loaded before anything pulls in ONNX's C extension, and importing the exporter's own package
            already reaches third-party code that could load ONNX first.
    ÚstrÚmoduleÚ	attributez
str | NoneÚ	pip_extraÚlabelFÚboolÚsupports_dynamic_batchÚ Údynamic_batch_reasonNÚ	preimport)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   r   © ó    úf/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/rfdetr/export/registry.pyr   r      sz   € € € € € € ðð ð, €K€K�KØ€N€N�NØÐÐÑØ€J€J�JØ#(ÐÐ(Ð(Ð(Ñ(Ø "ÐÐ"Ð"Ð"Ñ"Ø €IÐ Ð Ð Ñ Ð Ð r   r   zrfdetr.export._onnx.exporterÚOnnxExporterÚonnxÚONNX)r   zrfdetr.export._tflite.exporterÚTFLiteExporterÚtfliteÚTFLitez5rfdetr.export._backend:preload_tensorflow_before_onnx)r   r   z rfdetr.export._tensorrt.exporterÚTensorRTExporterÚtensorrtÚTensorRTz"rfdetr.export._executorch.exporterÚExecuTorchExporterÚ
executorchÚ
ExecuTorchzR(see the ExecuTorch exporter for details). Export one .pte per batch size instead.)r   zrfdetr.export._coreml.exporterÚCoreMLExporterÚcoremlÚCoreMLzl(fixed shapes are required for reliable ANE / GPU scheduling). Export one .mlpackage per batch size instead.zrfdetr.export._coreai.exporterÚCoreAIExporterÚcoreaizCore AIzR(the asset bakes a fixed input shape). Export one .aimodel per batch size instead.z rfdetr.export._openvino.exporterÚOpenVINOExporterÚopenvinoÚOpenVINOzR(the IR graph bakes a fixed input shape). Export one model per batch size instead.zrfdetr.export._litert.exporterÚLiteRTExporterÚlitertÚLiteRTzQ(the .tflite bakes a fixed input shape). Export one model per batch size instead.)r!   r$   r'   r*   r-   r0   r2   r5   zMapping[str, ExporterEntry]ÚREGISTRY)ÚtrtÚptezMapping[str, str]ÚALIASESÚformatr   Úreturnc                ó8   — t                                | | ¦  «        S )aV  Resolve an alias to the canonical format name.

    Args:
        format: Format name or alias as the caller spelled it.

    Returns:
        The canonical format name, unchanged when *format* is already canonical.

    Examples:
        >>> normalize_format("trt")
        'tensorrt'
        >>> normalize_format("onnx")
        'onnx'
    )r:   Úget)r;   s    r   Únormalize_formatr?   }   s   € õ �;Š;�v˜vÑ&Ô&Ð&r   útype[Exporter[Any]]c                ó¤  — t          | ¦  «        }|j        �H|j                             d¦  «        \  }}} t          t	          j        |¦  «        |¦  «        ¦   «          	 t	          j        |j        ¦  «        }nA# t          $ r4 |j        �+t           
                    d|j        › d|j        › d�¦  «         ‚ w xY wt          ||j        ¦  «        }|S )a  Import and return the exporter class implementing *format*.

    Args:
        format: Canonical format name (pass it through :func:`normalize_format` first).

    Returns:
        The exporter class registered for *format*.

    Raises:
        ValueError: If *format* is not a known export format.
        ImportError: If the format's optional dependencies are not installed.

    Examples:
        >>> resolve_exporter("onnx").format
        'onnx'
        >>> sorted(REGISTRY)
        ['coreai', 'coreml', 'executorch', 'litert', 'onnx', 'openvino', 'tensorrt', 'tflite']
        >>> resolve_exporter("nonesuch")  # doctest: +IGNORE_EXCEPTION_DETAIL
        Traceback (most recent call last):
        ...
        ValueError: Unsupported export format 'nonesuch'.
    Nú:zIt seems some dependencies for z4 export are missing. Please run `pip install rfdetr[z]` and try again.)Úrequire_entryr   Ú	partitionÚgetattrÚ	importlibÚimport_moduler   ÚImportErrorr   ÚloggerÚerrorr   r   )r;   ÚentryÚpreimport_moduleÚ_Úpreimport_attributer   Úexporter_classs          r   Úresolve_exporterrP   �   sù   € õ. ˜&Ñ!Ô!€EØ„Ð"Ø38´?×3LÒ3LÈSÑ3QÔ3QÑ0Ð˜!Ð0ØO�•	Ô'Ð(8Ñ9Ô9Ð;NÑOÔOÑQÔQÐQðÝÔ(¨¬Ñ6Ô6ˆˆøÝð ð ð ØŒ?Ð&Ý�LŠLðV°%´+ð Vð VØ38´?ðVð Vð Vñô ð ð 	ðøøøõ +2°&¸%¼/Ñ*JÔ*J€NØÐs   Á A: Á:>B8c                óŽ   — t                                | ¦  «        }|€(t          d| ›dt          t           ¦  «        › d�¦  «        ‚|S )aD  Look up *format*'s registry entry without importing anything.

    Args:
        format: Canonical format name.

    Returns:
        The registry entry for *format*.

    Raises:
        ValueError: If *format* is not a known export format.

    Examples:
        >>> require_entry("tensorrt").label
        'TensorRT'
    NzUnsupported export format z. Choose from: ú.)r7   r>   Ú
ValueErrorÚsorted)r;   rK   s     r   rC   rC   ·   sJ   € õ  �LŠL˜Ñ Ô €EØ€}ÝÐb°fÐbÐbÍvÕV^ÑO_ÔO_ÐbÐbÐbÑcÔcÐcØ€Lr   )r;   r   r<   r   )r;   r   r<   r@   )r;   r   r<   r   )r   Ú
__future__r   rF   Úcollections.abcr   Údataclassesr   Útypingr   r   Úrfdetr.utilities.loggerr   Úrfdetr.export.baser	   rI   r   r7   r   r:   r?   rP   rC   r   r   r   ú<module>r[      s“  ððð ð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ø !Ð !Ð !Ð !Ð !Ð !Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à .Ð .Ð .Ð .Ð .Ð .àð ,Ø+Ð+Ð+Ð+Ð+Ð+à	ˆ‰Œ€ð €�$˜dÐ#Ñ#Ô#ð!ð !ð !ð !ð !ñ !ô !ñ $Ô#ð!ðD ˆMÐ8¸.È&ÐRXÐquÐvÑvÔvØˆmØ(ØØØØ#ØIðñ ô ð �Ø*ØØØØ#ðñ ô ð  �-Ø,ØØØØqðñ ô ð ˆmØ(ØØØð=ð	ñ 	ô 	ð ˆmØ(ØØØØqðñ ô ð �Ø*ØØØØqðñ ô ð ˆmØ(ØØØØpðñ ô ða7)ð 7)€ð 7ð 7ð 7ñ 7ðt &0¸ÐEÐE€Ð EÐ EÐ EÑ Eð'ð 'ð 'ð 'ð$%ð %ð %ð %ðPð ð ð ð ð r   