o
    Wli,                     @   sZ   d dl Z d dlZd dlmZ d dlZddlmZ eeZ	d	ddZ
edkr+e
  dS dS )
    N)Path   )	VitsModelreturnc                  C   s  t d t } | jdddd | jdddd | jdd	d
d |  }|jr0tjtj	d ntjtj
d t| t|j}|jjddd t|j}tj|dd}|j}|  t   |j  W d   n1 spw   Y  |j|_t || td| dS )zMain entry pointi  z--checkpointTz Path to model checkpoint (.ckpt))requiredhelpz--generatorzPath to output file (.pt)z--debug
store_truez#Print DEBUG messages to the console)actionr   )level)parentsexist_okcpu)Zmap_locationNzExported generator to %s)torchZmanual_seedargparseArgumentParseradd_argument
parse_argsdebugloggingbasicConfigDEBUGINFO_LOGGERr   	generatorparentmkdir
checkpointr   Zload_from_checkpointmodel_gevalZno_graddecZremove_weight_normZinferforwardsaveinfo)parserargsZgenerator_pathZcheckpoint_pathmodelr    r&   V/home/kim/smarthome/.venv/lib/python3.10/site-packages/piper/train/export_generator.pymain   s4   




r(   __main__)r   N)r   r   pathlibr   r   Zvits.lightningr   	getLogger__name__r   r(   r&   r&   r&   r'   <module>   s   

/
