o
    }oi                     @   sn   d dl Zd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZ G dd	 d	ZdS )
    N)pretrain)MockDataModule)SquadDataModule)Nemotron3Config8BNemotronModelnemotron3_8b)Trainerc                   @   sZ   e Zd Zejdddd Zdd Zdd Zd	d
 Zej	
dg ddd Zdd ZdS )TestNemotron3_8Bclass)scopec                 C   s   t S Nr   )self r   c/home/ubuntu/.local/lib/python3.10/site-packages/tests/collections/llm/recipes/test_nemotron3_8b.pyrecipe_module   s   zTestNemotron3_8B.recipe_modulec                 C   s*   |  }t|tjsJ |jtksJ d S r   )model
isinstancerunConfig__fn_or_cls__r   )r   r   r   r   r   r   
test_model   s   zTestNemotron3_8B.test_modelc                 C   sh   |  }|j}t|tjsJ |jtksJ |jdksJ |jdks$J |j	dks+J |j
dks2J d S )N       )r   configr   r   r   r   r   
num_layershidden_size
seq_lengthnum_attention_heads)r   r   r   nemotron_configr   r   r   test_model_config_parameters$   s   z-TestNemotron3_8B.test_model_config_parametersc                 C   s   |  }t|tjsJ |jtksJ t|jtjsJ |jjtks$J t|j	tjs-J |j	jt
ks5J t|jtjs>J |jjtksFJ |jjdksNJ |jjdksVJ |jjdks^J d S )Nr   r      )pretrain_reciper   r   Partialr   r   r   r   r   trainerr	   datar   r   global_batch_sizemicro_batch_sizer   r   reciper   r   r   test_pretrain_recipe.   s   z%TestNemotron3_8B.test_pretrain_recipeznum_nodes,num_gpus_per_node))      )r!      )r-   r!   c                 C   s2   |j ||d}|jj|ksJ |jj|ksJ d S )N)	num_nodesnum_gpus_per_node)r"   r$   r.   devices)r   r   r.   r/   r)   r   r   r   2test_pretrain_recipe_with_different_configurations<   s   zCTestNemotron3_8B.test_pretrain_recipe_with_different_configurationsc                 C   s   |  }t|tjsJ t|tjsJ t|jtjsJ |jjtks%J t|jtjs.J |jjt	ks6J t|j
tjs?J |j
jtksGJ |j
jdksOJ |j
jdksWJ |j
jdks_J d S )Ni      r+   )finetune_reciper   r   r#   r   r   r   r   r$   r	   r%   r   r   r&   r'   r(   r   r   r   test_finetune_recipeB   s   z%TestNemotron3_8B.test_finetune_recipeN)__name__
__module____qualname__pytestfixturer   r   r    r*   markparametrizer1   r4   r   r   r   r   r
      s    



r
   )nemo_runr   r8   nemo.collections.llm.apir   "nemo.collections.llm.gpt.data.mockr   #nemo.collections.llm.gpt.data.squadr   'nemo.collections.llm.gpt.model.nemotronr   r   nemo.collections.llm.recipesr   nemo.lightningr	   r
   r   r   r   r   <module>   s   