o
    Ni                     @   sl   d dl Z d dlmZmZ d dlmZmZ d dlmZ d dl	m
Z
 G dd dee jZeG dd	 d	eZdS )
    N)	dataclassfield)OptionalUnion)PromptLearningConfig)PeftTypec                   @   s   e Zd ZdZdZdZdS )PromptTuningInitTEXTSAMPLE_VOCABRANDOMN)__name__
__module____qualname__r	   r
   r    r   r   T/home/ubuntu/.local/lib/python3.10/site-packages/peft/tuners/prompt_tuning/config.pyr      s    r   c                       s   e Zd ZU dZeejddidZeee	f e
d< edddidZee	 e
d< eddd	idZee	 e
d
< edddidZee e
d<  fddZ  ZS )PromptTuningConfiga  
    This is the configuration class to store the configuration of a [`PromptEmbedding`].

    Args:
        prompt_tuning_init (Union[[`PromptTuningInit`], `str`]):
            The initialization of the prompt embedding. `TEXT` will initialize with your text. `SAMPLE_VOCAB` will
            initialize with randomly sampled tokens from the model's vocabulary. `RANDOM` will initialize with randomly
            sampled continuous, soft tokens (warning: sampled soft tokens may fall outside of embedding manifold)
        prompt_tuning_init_text (`str`, *optional*):
            The text to initialize the prompt embedding. Only used if `prompt_tuning_init` is `TEXT`.
        tokenizer_name_or_path (`str`, *optional*):
            The name or path of the tokenizer. Only used if `prompt_tuning_init` is `TEXT`.
        tokenizer_kwargs (`dict`, *optional*):
            The keyword arguments to pass to `AutoTokenizer.from_pretrained`. Only used if `prompt_tuning_init` is
            `TEXT`.
    helpz.How to initialize the prompt tuning parameters)defaultmetadataprompt_tuning_initNz[The text to use for prompt tuning initialization. Only used if prompt_tuning_init is `TEXT`prompt_tuning_init_textz`The tokenizer to use for prompt tuning initialization. Only used if prompt_tuning_init is `TEXT`tokenizer_name_or_pathzkThe keyword arguments to pass to `AutoTokenizer.from_pretrained`. Only used if prompt_tuning_init is `TEXT`tokenizer_kwargsc                    s   t    tj| _| jtjkr | js t	dtjj
 d| j d| jtjkr9| jd u r9t	dtjj
 d| j d| jrL| jtjkrNt	dtjj
 dd S d S )NzWhen prompt_tuning_init='z#', tokenizer_name_or_path can't be .z$', prompt_tuning_init_text can't be z;tokenizer_kwargs only valid when using prompt_tuning_init='z'.)super__post_init__r   PROMPT_TUNING	peft_typer   r   r	   r   
ValueErrorvaluer   r   )self	__class__r   r   r   K   s&   
z PromptTuningConfig.__post_init__)r   r   r   __doc__r   r   r   r   r   str__annotations__r   r   r   r   dictr   __classcell__r   r   r!   r   r      s.   
 
r   )enumdataclassesr   r   typingr   r   peft.configr   
peft.utilsr   r$   Enumr   r   r   r   r   r   <module>   s   