o
    wi                     @   sl   d Z ddlmZmZ ddlmZ ddlmZmZ dZ	dZ
dZG dd	 d	eZeeed
edefddZdS )zf
Implemented following the guide at https://www.promptingguide.ai/models/gemma#gemma-7b-prompt-format
    )CutMixedCut)registered_prompt_format_fn)ModalityPromptFormatterz<start_of_turn>z<end_of_turn>z

c                   @   sZ   e Zd ZdZdZdZdZde de de dde	j
id	ed
e dde	j
id	iZdS )GemmaPromptFormattergemma	assistantTuserzuser
|message|
zmodel
message)templateslotsz	|message|N)__name__
__module____qualname__NAMEOUTPUT_ROLE
INSERT_BOS
INSERT_EOS	GEMMA_BOSGEMMA_END_OF_TURNr   TextTEMPLATE r   r   b/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/nemo/collections/common/prompts/gemma.pyr      s     
r   cutpromptc                 C   s|   t | tr| j} | dr| j}n| dr| j}n| j}dd|idg}| jd j }d ur9|	dd|id |
|S )Ncontextquestionr
   r   )roler   r   r	   )
isinstancer   first_non_padding_cut
has_customr   r   default_contextsupervisionstextappendencode_dialog)r   r   r   turnsanswerr   r   r   gemma13   s   



r+   N)__doc__
lhotse.cutr   r   &nemo.collections.common.data.prompt_fnr   )nemo.collections.common.prompts.formatterr   r   r   r   GEMMA_NLr   r+   r   r   r   r   <module>   s   