o
    }oi_                     @   s@   d dl mZ d dlmZ d dlmZ dgZG dd deeZdS )    )GPT2LMHeadModel)	GPTModule)	typecheckGPT2Encoderc                       s<   e Zd ZdZe 										d fdd	Z  ZS )r   zg
    Wraps around the Huggingface transformers implementation repository for easy use within NeMo.
    NF   c                    s,   t  j|||||||||
|	d
}|s|S |S )N)
	input_idsattention_masktoken_type_idsreturn_dictlabelsoutput_attentionsoutput_hidden_statespast_key_valuesposition_ids	use_cache)superforward)selfr   r   r	   r   r
   r   r   r   r   r   
max_lengthres	__class__ h/home/ubuntu/.local/lib/python3.10/site-packages/nemo/collections/nlp/modules/common/huggingface/gpt2.pyr      s   zGPT2Encoder.forward)
NNNFFFNFNr   )__name__
__module____qualname____doc__r   r   __classcell__r   r   r   r   r      s    N)transformersr   .nemo.collections.nlp.modules.common.gpt_moduler   nemo.core.classesr   __all__r   r   r   r   r   <module>   s
   