o
    }oi
                     @   sb   d dl Zd dl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)Nemotron3Config4BNemotronModelnemotron3_4b)Trainerc                   @   sR   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S )TestNemotron3_4Bclass)scopec                 C   s   t S Nr   )self r   c/home/ubuntu/.local/lib/python3.10/site-packages/tests/collections/llm/recipes/test_nemotron3_4b.pyrecipe_module   s   zTestNemotron3_4B.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_4B.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    i         )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_4B.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_4B.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_4B.test_pretrain_recipe_with_different_configurationsN)__name__
__module____qualname__pytestfixturer   r   r    r)   markparametrizer0   r   r   r   r   r	      s    


r	   )nemo_runr   r4   nemo.collections.llm.apir   "nemo.collections.llm.gpt.data.mockr   'nemo.collections.llm.gpt.model.nemotronr   r   nemo.collections.llm.recipesr   nemo.lightningr   r	   r   r   r   r   <module>   s   