U
    &ºcF  ã                   @   s   d Z dd„ ZdS )z2 Classes to support Encoder-Decoder architectures c                  K   s€   dd„ |   ¡ D ƒ}d|kr(| d¡| d< | ¡ }| ¡ }| dd„ |   ¡ D ƒ¡ | dd„ |   ¡ D ƒ¡ | dd¡|d	< ||fS )
aD   Prepare the encoder and decoder's keyword arguments.

    Keyword arguments come in 3 flavors:
    - encoder-specific (prefixed by `encoder_`)
    - decoder-specific (prefixed by `decoder_`)
    - those that apply to the model as whole.

    We let the specific kwargs override the common ones in case of
    conflict.
    c                 S   s*   i | ]"\}}|  d ¡s|  d¡s||“qS )Úencoder_Údecoder_)Ú
startswith©Ú.0ÚargumentÚvalue© r   úF/tmp/pip-unpacked-wheel-ymerj3tt/transformers/utils_encoder_decoder.pyÚ
<dictcomp>   s
   
 
þ z8prepare_encoder_decoder_model_kwargs.<locals>.<dictcomp>Z	input_idsZencoder_input_idsc                 S   s,   i | ]$\}}|  d ¡r|td ƒd… |“qS )r   N©r   Úlenr   r   r   r	   r
   )   s     
  c                 S   s,   i | ]$\}}|  d ¡r|td ƒd… |“qS )r   Nr   r   r   r   r	   r
   ,   s     
  Zattention_maskNZencoder_attention_mask)ÚitemsÚpopÚcopyÚupdateÚget)ÚkwargsZkwargs_commonZdecoder_kwargsZencoder_kwargsr   r   r	   Ú$prepare_encoder_decoder_model_kwargs   s    þÿÿr   N)Ú__doc__r   r   r   r   r	   Ú<module>   s   