o
    }oi                     @   s:   d dl Zd dlZd dlmZmZmZmZ G dd dZdS )    N)finetune_recipemodelpretrain_recipe	tokenizerc                   @   s   e Zd Zdd Zdd Zejdddgdd	 Zd
d Z	ejdddgdd Z
dd Zdd Zdd Zdd Zdd ZdS )TestHyena1Bc                 C   s*   t  }t|tjsJ |jjdksJ dS )z6
        Test the tokenizer factory function.
        get_nmt_tokenizerN)r   
isinstancerunConfig__fn_or_cls____name__)selftokenizer_config r   _/home/ubuntu/.local/lib/python3.10/site-packages/tests/collections/llm/recipes/test_hyena_1b.pytest_tokenizer   s   zTestHyena1B.test_tokenizerc                 C   sJ   t  }t|tjsJ |jjdksJ |jjdksJ |jjdu s#J dS )zJ
        Test the model factory function with default parameters.
        
HyenaModeli    FN)	r   r   r	   r
   r   r   config
seq_lengthtp_comm_overlap)r   model_configr   r   r   test_model_default    
   zTestHyena1B.test_model_defaultztp_comm_overlap,seq_length)Ti   )Fi @  c                 C   0   t ||d}|jj|ksJ |jj|ksJ dS )zR
        Test the model factory function with different parameter values.
        )r   r   N)r   r   r   r   )r   r   r   r   r   r   r   test_model_with_parameters*      z&TestHyena1B.test_model_with_parametersc                 C   sJ   t  }t|tjsJ |jjdksJ |jjdksJ |jjdks#J dS )zT
        Test the pretrain_recipe factory function with default parameters.
        pretrain      N)	r   r   r	   Partialr   r   trainer	num_nodesdevicesr   reciper   r   r   test_pretrain_recipe_default3   r   z(TestHyena1B.test_pretrain_recipe_defaultznum_nodes,num_gpus_per_node)r      )   r   c                 C   r   )zZ
        Test the pretrain_recipe factory function with different configurations.
        )r!   num_gpus_per_nodeN)r   r    r!   r"   )r   r!   r(   r$   r   r   r   $test_pretrain_recipe_with_parameters=   r   z0TestHyena1B.test_pretrain_recipe_with_parametersc                 C   sN   t dd}t|tjsJ |jjdksJ |jjdksJ |jjdks%J dS )zR
        Test the finetune_recipe factory function with valid parameters.
        
dummy_path)resume_pathfinetuner   r   N)	r   r   r	   r   r   r   r    r!   r"   r#   r   r   r   $test_finetune_recipe_with_parametersF   s
   
z0TestHyena1B.test_finetune_recipe_with_parametersc                 C      t jdusJ dS )z@
        Ensure the tokenizer function has a docstring.
        N)r   __doc__r   r   r   r   test_tokenizer_docstringP      z$TestHyena1B.test_tokenizer_docstringc                 C   r.   )z<
        Ensure the model function has a docstring.
        N)r   r/   r0   r   r   r   test_model_docstringV   r2   z TestHyena1B.test_model_docstringc                 C   r.   )zF
        Ensure the pretrain_recipe function has a docstring.
        N)r   r/   r0   r   r   r   test_pretrain_recipe_docstring\   r2   z*TestHyena1B.test_pretrain_recipe_docstringc                 C   r.   )zF
        Ensure the finetune_recipe function has a docstring.
        N)r   r/   r0   r   r   r   test_finetune_recipe_docstringb   r2   z*TestHyena1B.test_finetune_recipe_docstringN)r   
__module____qualname__r   r   pytestmarkparametrizer   r%   r)   r-   r1   r3   r4   r5   r   r   r   r   r      s    




r   )	nemo_runr	   r8   %nemo.collections.llm.recipes.hyena_1br   r   r   r   r   r   r   r   r   <module>   s   