o
    x¡·i?  ã                   @   sF   d dl mZ d dlmZ d dlmZ ddlmZmZ G dd„ dƒZ	dS )	é    )ÚSequence)ÚAny)ÚResponseé   )ÚSUPPORTED_MULTIMODAL_PIPELINESÚ#DiffusersMultiModalPipelineResolverc                   @   sH   e Zd ZdZddd„Zdee deeef de	d	e
d
e
defdd„ZdS )ÚDiffusersPipelineResolvera$  Resolver for `DiffusionPipeline` request and responses from [HuggingFace Diffusers](https://huggingface.co/docs/diffusers/index), providing necessary data transformations, formatting, and logging.

    This is based off `wandb.sdk.integration_utils.auto_logging.RequestResponseResolver`.
    ÚreturnNc                 C   s   d | _ d| _d S )Nr   )Úwandb_tableÚpipeline_call_count)Úself© r   úa/home/ubuntu/.local/lib/python3.10/site-packages/wandb/integration/diffusers/pipeline_resolver.pyÚ__init__   s   
z"DiffusersPipelineResolver.__init__ÚargsÚkwargsÚresponseÚ
start_timeÚtime_elapsedc           	      C   sF   |d j j}d}|tv rt|| jƒ}|  jd7  _||||||ƒ}|S )a1  Main call method for the `DiffusersPipelineResolver` class.

        Args:
            args: (Sequence[Any]) List of arguments.
            kwargs: (Dict[str, Any]) Dictionary of keyword arguments.
            response: (wandb.sdk.integration_utils.auto_logging.Response) The response from
                the request.
            start_time: (float) Time when request started.
            time_elapsed: (float) Time elapsed for the request.

        Returns:
            Packed data as a dictionary for logging to wandb, None if an exception occurred.
        r   Nr   )Ú	__class__Ú__name__r   r   r   )	r   r   r   r   r   r   Úpipeline_nameÚresolverÚloggable_dictr   r   r   Ú__call__   s   ÿz"DiffusersPipelineResolver.__call__)r	   N)r   Ú
__module__Ú__qualname__Ú__doc__r   r   r   ÚdictÚstrr   Úfloatr   r   r   r   r   r      s     
þ
ýüûúùr   N)
Úcollections.abcr   Útypingr   Ú(wandb.sdk.integration_utils.auto_loggingr   Ú	resolversr   r   r   r   r   r   r   Ú<module>   s
    