o
    6ti                     @   s*   d dl Z d dlZdefddZdd ZdS )    Nreturnc                 C   s   | d S )Nanswer )docr   r   Y/home/ubuntu/.local/lib/python3.10/site-packages/lm_eval/tasks/careqa/utils_perplexity.pydoc_to_target   s   r   c                 C   s^   |\}t tdt| }t t| d}tdt| |   ||f||f||fdS )Nz\s+zutf-8zperplexity: )word_perplexitybyte_perplexitybits_per_byte)lenresplitr   encodeprintmathexp)r   resultsloglikelihood_words_bytesr   r   r   process_results	   s   r   )r   r   strr   r   r   r   r   r   <module>   s    