
    oi                    l    S SK Jr  S SKJrJr  S SKJrJrJr  S SK	J
r
  S SKJr  \ " S S\
5      5       rg)	    )annotations)	dataclassfield)LiteralOptionalUnion)
PeftConfig)PeftTypec                  *  ^  \ rS rSr% Sr\" SSS0S9rS\S'   \" S	SS
0S9rS\S'   \" S	SS0S9r	S\S'   \" S	SS0S9r
S\S'   \" SSS0S9rS\S'   \" SSS0S9rS\S'   \" SSS0S9rS\S'   \" SSS0S9rS\S'   \" SSS 0S9rS\S!'   U 4S" jrS#rU =r$ )$
PolyConfig   a@  
This is the configuration class to store the configuration of a [`PolyModel`].
    - [Polytropon (Poly)](https://huggingface.co/papers/2202.13914)
    - [Multi-Head Routing (MHR)](https://huggingface.co/papers/2211.03831)

Args:
    r (`int`): Attention dimension of each Lora in Poly.
    target_modules (`Union[List[str],str]`): The names of the modules to apply Poly to.
    exclude_modules (`Optional[Union[List[str], str]]`):
        The names of the modules to not apply the adapter. When passing a string, a regex match will be performed.
        When passing a list of strings, either an exact match will be performed or it is checked if the name of the
        module ends with any of the passed strings.
    modules_to_save (`List[str]`): List of modules apart from Poly layers to be set as trainable
        and saved in the final checkpoint.
    init_weights (bool): Whether to perform initialization of Poly weights.
    poly_type (`Literal["poly"]`): The variant of the Poly module to use. Currently, only "poly"
        is supported.
    n_tasks (`int`): The number of tasks in a multitasking scenario.
    n_skills (`int`): The number of skills (LoRA) in each Poly layer.
    n_splits (`int`): The number of splits within each LoRA of a Poly layer. A value greater
        than 1 indicates the use of Multi-Head Routing (MHR).
   helpzLora attention dimension)defaultmetadataintrNzList of module names or regex expression of the module names to replace with Poly.For example, ['q', 'v'] or '.*decoder.*(SelfAttention|EncDecAttention).*(q|v)$' zOptional[Union[list[str], str]]target_moduleszRList of module names or regex expression of the module names to exclude from Poly.exclude_modulesa  List of modules apart from Poly layers to be set as trainable and saved in the final checkpoint. For example, in Sequence Classification or Token Classification tasks, the final layer `classifier/score` are randomly initialized and as such need to be trainable and saved.zOptional[list[str]]modules_to_saveTzWhether to initialize the weights of the Poly layers with their default initialization. Don't change this setting, except if you know exactly what you're doing.boolinit_weightspolyzDType of Poly modules to be used. Currently only "poly" is supported.zLiteral['poly']	poly_type   z)Number of tasks in multitasking scenario.n_tasks   z+Number of skills (LoRA) in each Poly layer.n_skillsz2Number of splits within each LoRA of a Poly layer.n_splitsc                l  > [         TU ]  5         [        R                  U l        [        U R                  [        5      (       a  [        U R                  5      OU R                  U l        [        U R                  [        5      (       a  [        U R                  5      U l	        g U R                  U l	        g )N)
super__post_init__r
   POLY	peft_type
isinstancer   listsetr   )self	__class__s    Q/home/james-whalen/.local/lib/python3.13/site-packages/peft/tuners/poly/config.pyr"   PolyConfig.__post_init___   s    !(243F3F(M(MC##$SWSfSf 	 *4D4H4H$)O)OC$$% 	UYUiUi 	    )r   r$   r   )__name__
__module____qualname____firstlineno____doc__r   r   __annotations__r   r   r   r   r   r   r   r   r"   __static_attributes____classcell__)r)   s   @r*   r   r      s3   . 10J'KLAsL6; _
7N3  8=no8O4  ,1 v
,O(  N
L$  "'`a"I  EFGS  GHHc  NOHc 

 
r,   r   N)
__future__r   dataclassesr   r   typingr   r   r   peft.configr	   
peft.utilsr
   r    r,   r*   <module>r;      s7    # ( + + "  N
 N
 N
r,   