
    oi                    h    S SK Jr  S SKJrJr  S SKJrJr  S SKJ	r	  S SK
Jr  \ " S S\	5      5       rg)	    )annotations)	dataclassfield)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'   U 4S jrSrU =r$ )	OSFConfig
   a  
Configuration for Orthogonal Subspace Fine-tuning (OSF).

Args:
    effective_rank (`int` or `float`, *optional*):
        Preserved SVD rank ("high" subspace). The top-``effective_rank`` singular directions are frozen and
        retained across tasks; the remaining dimensions form the trainable low-rank subspace. If `None`, defaults
        to 50% of the smaller weight dimension per target module. Note: This differs from LoRA's `r` (trainable
        rank). In OSF, the trainable rank is `min(weight.shape) - effective_rank`.
    target_modules (`Union[list[str], str]`, *optional*):
        The names of the modules to apply OSF to. Can be a list of module names or `"all-linear"`.
    rank_pattern (`dict[str, int|float]`, *optional*):
        A dictionary of regex patterns to override `effective_rank` for specific modules. Values can be absolute
        integers or fractions in (0, 1], interpreted as a fraction of the smaller matrix dimension per target.
Nhelpa  Preserved SVD rank ("high" subspace). The top-`effective_rank` singular directions are frozen and retained across tasks; the remaining dimensions form the trainable low-rank subspace. Trainable rank equals min(weight.shape) - effective_rank. If None, defaults to 50% of the smaller weight dimension per target module. Floats in (0, 1] are interpreted as a fraction of the smaller matrix dimension per target.)defaultmetadatazOptional[Union[int, float]]effective_rankzXThe names of the modules to apply OSF to. Can be a list of module names or 'all-linear'.zOptional[Union[list[str], str]]target_moduleszA dictionary of regex patterns to override effective_rank per module. Values can be absolute integers or fractions in (0, 1], interpreted as a fraction of the smaller matrix dimension.z&Optional[dict[str, Union[int, float]]]rank_patternzIf provided, toggles custom weight initialization behavior for certain methods. OSF ignores this flag but accepts it for config compatibility.zOptional[bool]init_weightszOOptional list of module names to save separately (ignored by OSF but accepted).zOptional[list[str]]modules_to_savezOptional per-parameter SVD target rank mapping (e.g., {'lin0.weight': 8}). OSF currently ignores this field but accepts it for forward compatibility.zOptional[dict[str, int]]target_svd_configc                L   > [         TU ]  5         [        R                  U l        g )N)super__post_init__r	   OSF	peft_type)self	__class__s    P/home/james-whalen/.local/lib/python3.13/site-packages/peft/tuners/osf/config.pyr   OSFConfig.__post_init__N   s    !    )r   )__name__
__module____qualname____firstlineno____doc__r   r   __annotations__r   r   r   r   r   r   __static_attributes____classcell__)r   s   @r   r   r   
   s      38/
3N/  7<tu7N3  <An
<L8  $)@
$L.  ,1kl,O(  38G
3/ & &r   r   N)
__future__r   dataclassesr   r   typingr   r   peft.configr   
peft.utilsr	   r    r   r   <module>r.      s2    " ( " "  E&
 E& E&r   