
    PiV                     V    d dl Z d dlZd dlZd dlZd dlZd dlZd dlZdefdZd Z	d Z
dS )    Nreturnc                      t           j                                        rt           j                                        S t	          j                    S )N)torchcudais_availableget_device_nameplatformmachine     i/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchao/_models/utils.pyget_arch_namer      s=    z   "z))+++ !!!r   c                    fdt          |          D             }dd|d         |d         |d         |d         |d         d	d
|d         ddgd|d         |d         g|d         dd}t          t          j                            |           d          dd          5 }t          t          j        |          |           ddd           dS # 1 swxY w Y   dS )aM  
    Write the result into JSON format, so that it can be uploaded to the benchmark database
    to be displayed on OSS dashboard. The JSON format is defined at
    https://github.com/pytorch/pytorch/wiki/How-to-integrate-with-PyTorch-OSS-benchmark-database

    OSS CI version, that will leave many fields to be filled in by CI
    c                 (    i | ]\  }}|         |S r   r   .0ivheaderss      r   
<dictcomp>z+write_json_result_ossci.<locals>.<dictcomp>    #    @@@Awqz1@@@r   TorchAO benchmark	inferencedtypedevicearchmin_sqnrcompiler   r   r   r   namemoder   
extra_infor!   modeltorchaor!   typeoriginsmetricactualtargetr!   benchmark_valuestarget_value)	benchmarkr$   r)   r   .jsonafileN)	enumerateopenospathsplitextprintjsondumps)output_json_pathr   rowmapping_headersrecordfs    `    r   write_json_result_osscirA      sg    A@@@3@@@O ($W-)(3'/+J7*95 	
 
 $F+!{
 
 $H-!0!: ;+H5
 
% F2 
!!"233A6===s	C	C *qdj  q))))* * * * * * * * * * * * * * * * * *s   #$CCCc                    fdt          |          D             }t          j                                        }t	          j        t          |                              d                                                    }t          j        	                    |t          j
        j                  }t          |                                          }|dz   }t          t          j
                              dddd||d|dd	|d
         |d         |d         |d         |d         dd|d         ddgd|d         |d         g|d         dd}	t          t          j                            |           d          dd          5 }
t%          t'          j        |	          |
           ddd           dS # 1 swxY w Y   dS )a]  
    Write the result into JSON format, so that it can be uploaded to the benchmark database
    to be displayed on OSS dashboard. The JSON format is defined at
    https://github.com/pytorch/pytorch/wiki/How-to-integrate-with-PyTorch-OSS-benchmark-database

    Local version (filling in dummy values for fields that should be populated by CI)
    c                 (    i | ]\  }}|         |S r   r   r   s      r   r   z+write_json_result_local.<locals>.<dictcomp>F   r   r   zutf-8   v3zdevvm local benchmarkz
pytorch/aomainr   r   r   r   r   r   r   r   r    r!   r$   r%   r&   r)   r*   r+   r,   )	timestampschema_versionr!   repohead_branchhead_shaworkflow_idrun_attemptjob_idr/   r$   r)   r   r0   r1   r2   N)r4   datetimedatetodayhashlibsha256strencode	hexdigestcombinetimeminintrG   r5   r6   r7   r8   r9   r:   r;   )r<   r   r=   r>   rQ   sha_hashfirst_secondrL   rN   r?   r@   s    `         r   write_json_result_localr]   >   s    A@@@3@@@OM!!E~c%jj//8899CCEEH$,,UHM4EFFLl,,..//K1_F%%'"'$W-)(3'/+J7*95 	
 
 $F+!{
 
 $H-!0!: ;+H5
 
7   FD 
!!"233A6===s	C	C *qdj  q))))* * * * * * * * * * * * * * * * * *s   $F44F8;F8)rO   rR   r:   r6   r	   rX   r   rT   r   rA   r]   r   r   r   <module>r^      s       				   "s " " " "#* #* #*L1* 1* 1* 1* 1*r   