o
    }oi=
                     @   s   d dl Z d dlmZ d dlmZ d dlmZ 	 dd Ze	dkrce Z
eee
jZeee
jZeedZejed	e
j ee
je
jd
ZejdejddejdddZe Zej  ee dS dS )    N)Path)	lightning)llmc                  C   sd   t jdd} | jdtdd | jdddd	 | jd
ddd	 | jdtdd | jdddd |  S )Nz-Test Llama2 7B model model conversion from HF)descriptionz
--hf_modelzOriginal HF model)typehelpz--model
LlamaModelz,Model class from nemo.collections.llm module)defaultr   z--configLlama2Config7Bz-Config class from nemo.collections.llm modulez--output_pathzNeMo 2.0 export pathz--overwrite
store_truez$Overwrite the output model if exists)actionr   )argparseArgumentParseradd_argumentstr
parse_args)parser r   X/home/ubuntu/.local/lib/python3.10/site-packages/tests/collections/llm/test_hf_import.pyget_args)   s   r   __main__)configzhf://)modelsourceoutput_path	overwrite   )tensor_model_parallel_sizefp16)	precision)devicesstrategyplugins)r   pathlibr   nemor   nlnemo.collectionsr   r   __name__argsgetattrr   
ModelClassr   ModelConfigimport_ckpthf_modelr   r   
nemo2_pathTrainerMegatronStrategyMegatronMixedPrecisiontrainer	to_fabricfabricr!   setup_environment
load_modelr   r   r   r   <module>   s4   




