a
    
d                     @   sJ   d dl Z d dlmZ d dlmZ dZG dd dejZG dd deZdS )    N)versionz3sgm.modules.diffusionmodules.wrappers.OpenAIWrapperc                       s,   e Zd Zded fddZdd Z  ZS )IdentityWrapperF)compile_modelc                    s@   t    ttjtdkr*|r*tjndd }||| _d S )Nz2.0.0c                 S   s   | S N )xr   r   l/var/www/html/stable-diffusion-webui/repositories/generative-models/sgm/modules/diffusionmodules/wrappers.py<lambda>       z*IdentityWrapper.__init__.<locals>.<lambda>)super__init__r   parsetorch__version__compilediffusion_model)selfr   r   r   	__class__r   r   r   	   s    
zIdentityWrapper.__init__c                 O   s   | j |i |S r   )r   )r   argskwargsr   r   r   forward   s    zIdentityWrapper.forward)F)__name__
__module____qualname__boolr   r   __classcell__r   r   r   r   r      s   
r   c                   @   s&   e Zd ZejejeejdddZdS )OpenAIWrapper)r   tcreturnc                 K   sP   t j||dt g |fdd}| j|f||dd |dd d|S )Nconcat   )dim	crossattnvector)	timestepscontexty)r   catgetTensortype_asr   )r   r   r   r   r   r   r   r   r      s    &

zOpenAIWrapper.forwardN)r   r   r   r   r+   dictr   r   r   r   r   r      s   
r   )	r   torch.nnnn	packagingr   ZOPENAIUNETWRAPPERModuler   r   r   r   r   r   <module>   s
   