o
    6ti                  	   @   sr  d Z ddlZddlZddlZddlZddlmZ ddlmZ dZdd Z	e
dkr7e	 Zejejd	 Zeejd
dZeeZW d   n1 sLw   Y  ejdurvddlZeejd
dZeeZW d   n1 sqw   Y  dd Zee  dd e D Zedd eD D ]QZeejdkrdej de nde eedZejde d Ze de de  eedd
dZ!ej"ee!e#dddd W d   n1 sw   Y  qejdkrdej nddd eD dd d!d"d#d d!d"gd$d%id&Z$dej ej d Zeedd
dZ%ej"e$e%e#dddd W d   dS 1 s0w   Y  dS dS )'z<
Take in a YAML, and output all other splits with this YAML
    N)tqdm)loggingzGhttps://datasets-server.huggingface.co/splits?dataset=facebook/belebelec                  C   sH   t  } | jddd | jddd | jdd d | jdd	d |  S )
Nz--base_yaml_pathT)requiredz--save_prefix_pathbelebeledefaultz--cot_prompt_pathz--task_prefix )argparseArgumentParseradd_argument
parse_args)parser r   \/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/belebele/_generate_configs.pyr      s   r   __main__zutf-8)encodingc                  C   s   t t} |  d S )Nsplits)requestsgetAPI_URLjson)responser   r   r   query)   s   
r   c                 C   s   g | ]}|d  qS )splitr   ).0r   r   r   r   
<listcomp>.   s    r   c                 C   s   g | ]}d |vr|qS r   r   r   langr   r   r   r   0   s    r   	belebele__)includetask
test_splitfewshot_splitz.yamlzSaving yaml for subset z to winfT")widthallow_unicodedefault_styler   c                 C   s:   g | ]}d |vrt jdkrdt j d| nd| qS )r   r   r   r    )argstask_prefixr   r   r   r   r   K   s    
accmeanF)metricaggregationweight_by_sizeacc_normversiong        )groupr"   aggregate_metric_listmetadata)&__doc__r	   osr   yamlr   lm_eval.utilsr   r   r   __name__r+   pathr   base_yaml_pathbase_yaml_nameopenf	full_load	base_yamlcot_prompt_pathr   loadcot_filer   print	languagesr   r,   	yaml_dictsave_prefix_pathfile_save_pathinfo	yaml_filedumpfloatgroup_yaml_dictgroup_yaml_filer   r   r   r   <module>   s    
	


	



$