o
    6ti?                     @   sZ   d dl Z d dlZd dlZdd Zdedededdfdd	Zdd
dZedkr+e  dS dS )    Nc                 C   s   dddddd}||  S )NztQ: {{Question.strip()}}
A: {{A}}
B: {{B}}
C: {{C}}
D: {{D}}
Please choose the correct answer from the options above:z{Question: {{Question.strip()}}
1: {{A}}
2: {{B}}
3: {{C}}
4: {{D}}
Please select the correct answer from the given choices:zInput Question: {{Question.strip()}}
Option A: {{A}}
Option B: {{B}}
Option C: {{C}}
Option D: {{D}}
Please indicate the correct option from the list above:zCritically analyze the question and select the most probable answer from the list:
{{Question.strip()}}
Choices:
A) {{A}}
B) {{B}}
C) {{C}}
D) {{D}}zAnswer the question and pick the correct answer from the options: {{Question.strip()}}
Options:
A. {{A}}
B. {{B}}
C. {{C}}
D. {{D}}
Please choose the correct option from the above list:prompt_1prompt_2prompt_3prompt_4prompt_5 )modelang
prompt_mapr   r   ]/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/afrobench/openai_mmlu/utils.pyprompt_func   s   r   
output_dir	overwriter	   returnc              	   C   s&  g }dddd}dddd}|  D ]n}z^d| d	}d| d
| }d}	|	||| t||| d}
tj| |}tj|dd t|  d| d| |rOdnddd}|d tj	|
|dd W d   n1 slw   Y  W q t
y   || Y qw t|dkrt
dd| dS )z
    Generate a yaml file for each language.

    :param output_dir: The directory to output the files to.
    :param overwrite: Whether to overwrite files if they already exist.
    ArabicSwahiliYoruba)araswayorAR_XYSW_KEYO_NGopenai_mmlu_z.yaml_openai_mmlu)includetaskdataset_namedoc_to_textT)exist_ok/wxutf8)encodingz# Generated by utils.py
)allow_unicodeNr   zJFiles were not created because they already exist (use --overwrite flag): z, )keysr   ospathjoinmakedirsopenwriteyamldumpFileExistsErrorappendlen)r   r   r	   err	languages
lang2_coder
   	file_name	task_nameyaml_templateyaml_details	file_pathfr   r   r   gen_lang_yamls   sZ   

r=   c                  C   s`   t  } | jddddd | jdddd	 | jd
dg ddd |  }t|j|j|jd dS )z9Parse CLI args and generate language-specific yaml files.z--overwriteT
store_truez%Overwrite files if they already exist)defaultactionhelpz--output-dirz./z Directory to write yaml files to)r?   rA   z--moder   r   zPrompt number)r?   choicesrA   )r   r   r	   N)argparseArgumentParseradd_argument
parse_argsr=   r   r   r	   )parserargsr   r   r   mainI   s(   rI   __main__)r   N)	rC   r)   r/   r   strboolr=   rI   __name__r   r   r   r   <module>   s    
7
