import{s as Nt,o as At,n as Ft}from"../chunks/scheduler.4cd3e004.js";import{S as Vt,i as Et,e as o,s as l,c as h,h as Ht,a as r,d as a,b as s,f as J,g,j as c,k as w,l as t,m as p,n as M,t as f,o as y,p as u}from"../chunks/index.b664cb2d.js";import{D as U}from"../chunks/Docstring.9ceb4334.js";import{C as Yt}from"../chunks/CodeBlock.8601e34e.js";import{E as Qt}from"../chunks/ExampleCodeBlock.4f57b575.js";import{H as ut,E as zt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.179b63f8.js";function St(je){let b,Y="Example:",_,T,j;return T=new Yt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b0NvbmZpZyUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQWZyb20lMjBwZWZ0JTIwaW1wb3J0JTIwTG9yYUNvbmZpZyUyQyUyMFBlZnRNb2RlbCUyQyUyMGdldF9wZWZ0X21vZGVsJTJDJTIwcHJlcGFyZV9tb2RlbF9mb3Jfa2JpdF90cmFpbmluZyUwQSUwQW1vZGVsX2NvbmZpZyUyMCUzRCUyMEF1dG9Db25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMm1pc3RyYWxhaSUyRk1pc3RyYWwtN0ItSW5zdHJ1Y3QtdjAuMSUyMiklMEFjb25maWclMjAlM0QlMjBYTG9yYUNvbmZpZyglMEElMjAlMjAlMjAlMjB0YXNrX3R5cGUlM0QlMjJDQVVTQUxfTE0lMjIlMkMlMEElMjAlMjAlMjAlMjBoaWRkZW5fc2l6ZSUzRG1vZGVsX2NvbmZpZy5oaWRkZW5fc2l6ZSUyQyUwQSUyMCUyMCUyMCUyMHhsb3JhX2RlcHRoJTNENCUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJzJTNEJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYWRhcHRlcl8xJTIyJTNBJTIwJTIyLiUyRnBhdGglMkZ0byUyRnRoZSUyRmNoZWNrcG9pbnQlMkYlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJhZGFwdGVyXzIlMjIlM0ElMjAlMjIuJTJGcGF0aCUyRnRvJTJGdGhlJTJGY2hlY2twb2ludCUyRiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmFkYXB0ZXJfbiUyMiUzQSUyMCUyMi4lMkZwYXRoJTJGdG8lMkZ0aGUlMkZjaGVja3BvaW50JTJGJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBKSUwQWludDhfY29uZmlnJTIwJTNEJTIwQml0c0FuZEJ5dGVzQ29uZmlnKGxvYWRfaW5fOGJpdCUzRFRydWUpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIybWlzdHJhbGFpJTJGTWlzdHJhbC03Qi1JbnN0cnVjdC12MC4xJTIyJTJDJTBBJTIwJTIwJTIwJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMmZsYXNoX2F0dGVudGlvbl8yJTIyJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRCUyMmN1ZGElM0EwJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMHF1YW50aXphdGlvbl9jb25maWclM0RpbnQ4X2NvbmZpZyUyQyUwQSklMEFtb2RlbCUyMCUzRCUyMHByZXBhcmVfbW9kZWxfZm9yX2tiaXRfdHJhaW5pbmcoNCklMEF4bG9yYV9tb2RlbCUyMCUzRCUyMGdldF9wZWZ0X21vZGVsKG1vZGVsJTJDJTIwY29uZmlnKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoConfig, BitsAndBytesConfig
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> peft <span class="hljs-keyword">import</span> LoraConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training

<span class="hljs-meta">&gt;&gt;&gt; </span>model_config = AutoConfig.from_pretrained(<span class="hljs-string">&quot;mistralai/Mistral-7B-Instruct-v0.1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>config = XLoraConfig(
<span class="hljs-meta">... </span>    task_type=<span class="hljs-string">&quot;CAUSAL_LM&quot;</span>,
<span class="hljs-meta">... </span>    hidden_size=model_config.hidden_size,
<span class="hljs-meta">... </span>    xlora_depth=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    adapters={
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;adapter_1&quot;</span>: <span class="hljs-string">&quot;./path/to/the/checkpoint/&quot;</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;adapter_2&quot;</span>: <span class="hljs-string">&quot;./path/to/the/checkpoint/&quot;</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;adapter_n&quot;</span>: <span class="hljs-string">&quot;./path/to/the/checkpoint/&quot;</span>,
<span class="hljs-meta">... </span>    },
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>int8_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;mistralai/Mistral-7B-Instruct-v0.1&quot;</span>,
<span class="hljs-meta">... </span>    trust_remote_code=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>,
<span class="hljs-meta">... </span>    device_map=<span class="hljs-string">&quot;cuda:0&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.bfloat16,
<span class="hljs-meta">... </span>    quantization_config=int8_config,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = prepare_model_for_kbit_training(<span class="hljs-number">4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>xlora_model = get_peft_model(model, config)`,wrap:!1}}),{c(){b=o("p"),b.textContent=Y,_=l(),h(T.$$.fragment)},l(m){b=r(m,"P",{"data-svelte-h":!0}),c(b)!=="svelte-11lpom8"&&(b.textContent=Y),_=s(m),g(T.$$.fragment,m)},m(m,v){p(m,b,v),p(m,_,v),M(T,m,v),j=!0},p:Ft,i(m){j||(f(T.$$.fragment,m),j=!0)},o(m){y(T.$$.fragment,m),j=!1},d(m){m&&(a(b),a(_)),u(T,m)}}}function Dt(je){let b,Y,_,T,j,m,v,bt='Mixture of LoRA Experts (<a href="https://huggingface.co/papers/2402.07148" rel="nofollow">X-LoRA</a>) is a PEFT method enabling sparse or dense mixture of LoRA experts based on a high granularity (token, layer, sequence) scalings matrix. This leverages frozen LoRA adapters and a frozen base model to drastically reduces the number of parameters that need to be fine-tuned.',Ue,N,Jt="A unique aspect of X-LoRA is its versatility: it can be applied to any <code>transformers</code> base model with LoRA adapters. This means that, despite the mixture of experts strategy, no changes to the model code must be made.",ve,A,wt="The below graphic demonstrates how the scalings change for different prompts for each token. This highlights the activation of different adapters as the generation progresses and the sequence creates new context.",_e,F,Tt='<img src="https://github.com/EricLBuehler/xlora/raw/master/res/token_by_token_scalings.gif" alt="Token-by-token scalings"/>',xe,V,jt="The abstract from the paper is:",Ge,E,Ut="<em>We report a mixture of expert strategy to create fine-tuned large language models using a deep layer-wise token-level approach based on low-rank adaptation (LoRA). Starting with a set of pre-trained LoRA adapters, our gating strategy uses the hidden states to dynamically mix adapted layers, allowing the resulting X-LoRA model to draw upon different capabilities and create never-before-used deep layer-wise combinations to solve tasks. The design is inspired by the biological principles of universality and diversity, where neural network building blocks are reused in different hierarchical manifestations. Hence, the X-LoRA model can be easily implemented for any existing large language model (LLM) without a need for modifications of the underlying structure. We develop a tailored X-LoRA model that offers scientific capabilities including forward/inverse analysis tasks and enhanced reasoning capability, focused on biomaterial analysis, protein mechanics and design. The impact of this work include access to readily expandable and adaptable models with strong domain knowledge and the capability to integrate across areas of knowledge. Featuring experts in biology, mathematics, reasoning, bio-inspired materials, mechanics and materials, chemistry, protein biophysics, mechanics and quantum-mechanics based molecular properties, we conduct a series of physics-focused case studies. We examine knowledge recall, protein mechanics forward/inverse tasks, protein design, adversarial agentic modeling including ontological knowledge graph construction, as well as molecular design. The model is capable not only of making quantitative predictions of nanomechanical properties of proteins or quantum mechanical molecular properties, but also reasons over the results and correctly predicts likely mechanisms that explain distinct molecular behaviors.</em>.",Ze,H,vt="Please cite X-LoRA as:",Ie,Q,Ce,z,We,x,S,Se,pe,_t=`This is the configuration class to store the configuration of a <code>XLoraModel</code>. When the config is reloaded, the
paths of the <code>adapters</code> field is disregarded in favor of the saved adapters. As such, only the keys matter during
loading.`,Be,D,Re,i,q,De,de,xt=`Creates an X-LoRA (Mixture of LoRA experts), model from a pretrained transformers model. Currently, this X-LoRA
implementation only works with models with a transformer architecture.`,qe,ce,Gt='The method is described in detail in <a href="https://huggingface.co/papers/2402.07148" rel="nofollow">https://huggingface.co/papers/2402.07148</a>.',Pe,G,Oe,Z,P,Ke,me,Zt="Clear the scalings log.",et,I,O,tt,he,It="Disable scalings logging, without clearing the log.",at,C,K,lt,ge,Ct="Enable scalings logging.",st,W,ee,nt,Me,Wt=`Returns bucketed scalings, bucketed by seq_len. Each value consists of the positions (the first) and the
associated tensors. The positions are paired with the associated tensors and give the position in the scaling
log.`,ot,B,te,rt,fe,Bt="Get the global LoRA weight.",it,R,ae,pt,ye,Rt=`Returns the latest scalings prediction, or None if no scalings have been predicted. The tensor is of shape
(batch_size, seq_len, n_layers, n_classes).`,dt,X,le,ct,ue,Xt=`Returns a shallow (only copying the list itself not the tensors) copy of the list containing the scalings log.
Editing the list does not change the underlying log. The tensors are of shape (batch_size, seq_len, n_layers,
n_classes). The seq_len dim may vary with input dimension.`,mt,$,se,ht,be,$t=`Set the global LoRA weight, a scalar to multiply the output of each LoRA adapter by. This is by default 1. This
is reflected in the config.`,gt,k,ne,Mt,Je,kt=`Set the scaling pass value, the value to set the scalings to during the scaling pass. If the value is None, the
scaling pass value will be 1/n where n is the number of adapters.`,ft,L,oe,yt,we,Lt=`Sparsely select the specified top_k LoRA experts instead of the default dense method. Set to None to use dense.
This is reflected in the config.`,Xe,re,$e,Te,ke;return j=new ut({props:{title:"X-LoRA",local:"x-lora",headingTag:"h1"}}),Q=new Yt({props:{code:" ",highlighted:`@article{<span class="hljs-number">10.1063</span>/<span class="hljs-number">5.0203126</span>,
    author = {<span class="hljs-type">Buehler</span>, <span class="hljs-type">Eric</span> <span class="hljs-type">L</span>. and <span class="hljs-type">Buehler</span>, <span class="hljs-type">Markus</span> <span class="hljs-type">J</span>.},
    title = <span class="hljs-comment">&quot;{X-LoRA: Mixture of low-rank adapter experts, a flexible framework for large language models with applications in protein mechanics and molecular design}&quot;</span>,
    journal = {<span class="hljs-type">APL</span> <span class="hljs-type">Machine</span> <span class="hljs-type">Learning</span>},
    volume = {<span class="hljs-number">2</span>},
    number = {<span class="hljs-number">2</span>},
    pages = {<span class="hljs-number">026119</span>},
    year = {<span class="hljs-number">2024</span>},
    month = {<span class="hljs-number">05</span>},
    abstract = <span class="hljs-comment">&quot;{We report a mixture of expert strategy to create fine-tuned large language models using a deep layer-wise token-level approach based on low-rank adaptation (LoRA). Starting with a set of pre-trained LoRA adapters, our gating strategy uses the hidden states to dynamically mix adapted layers, allowing the resulting X-LoRA model to draw upon different capabilities and create never-before-used deep layer-wise combinations to solve tasks. The design is inspired by the biological principles of universality and diversity, where neural network building blocks are reused in different hierarchical manifestations. Hence, the X-LoRA model can be easily implemented for any existing large language model without a need for modifications of the underlying structure. We develop a tailored X-LoRA model that offers scientific capabilities, including forward/inverse analysis tasks and enhanced reasoning capability, focused on biomaterial analysis, protein mechanics, and design. The impact of this work includes access to readily expandable and adaptable models with strong domain knowledge and the capability to integrate across areas of knowledge. Featuring experts in biology, mathematics, reasoning, bio-inspired materials, mechanics and materials, chemistry, protein biophysics, mechanics, and quantum-mechanics based molecular properties, we conduct a series of physics-focused case studies. We examine knowledge recall, protein mechanics forward/inverse tasks, protein design, adversarial agentic modeling including ontological knowledge graph construction, and molecular design. The model is capable not only of making quantitative predictions of nanomechanical properties of proteins or quantum mechanical molecular properties but also reasoning over the results and correctly predicting likely mechanisms that explain distinct molecular behaviors.}&quot;</span>,
    issn = {<span class="hljs-number">2770</span><span class="hljs-number">-9019</span>},
    doi = {<span class="hljs-number">10.1063</span>/<span class="hljs-number">5.0203126</span>},
    url = {https://doi.org/<span class="hljs-number">10.1063</span>/<span class="hljs-number">5.0203126</span>},
    eprint = {https://pubs.aip.org/aip/aml/article-pdf/doi/<span class="hljs-number">10.1063</span>/<span class="hljs-number">5.0203126</span>/<span class="hljs-number">19964043</span>/<span class="hljs-number">026119</span>\\_1\\_5<span class="hljs-number">.0203126</span>.pdf},
}`,wrap:!1}}),z=new ut({props:{title:"XLoraConfig",local:"peft.XLoraConfig",headingTag:"h2"}}),S=new U({props:{name:"class peft.XLoraConfig",anchor:"peft.XLoraConfig",parameters:[{name:"task_type",val:": Optional[Union[str, TaskType]] = None"},{name:"peft_type",val:": Optional[Union[str, PeftType]] = None"},{name:"auto_mapping",val:": Optional[dict] = None"},{name:"peft_version",val:": Optional[str] = None"},{name:"base_model_name_or_path",val:": Optional[str] = None"},{name:"revision",val:": Optional[str] = None"},{name:"inference_mode",val:": bool = False"},{name:"hidden_size",val:": int = None"},{name:"adapters",val:": dict[str, str] = None"},{name:"enable_softmax",val:": bool = True"},{name:"enable_softmax_topk",val:": bool = False"},{name:"layerwise_scalings",val:": bool = False"},{name:"xlora_depth",val:": int = 1"},{name:"xlora_size",val:": int = 2048"},{name:"xlora_dropout_p",val:": float = 0.2"},{name:"use_trainable_adapters",val:": bool = False"},{name:"softmax_temperature",val:": float = 1.0"},{name:"top_k_lora",val:": Optional[int] = None"},{name:"scaling_pass_value",val:": float = 0.0"},{name:"global_scaling_weight",val:": float = 1.0"}],parametersDescription:[{anchor:"peft.XLoraConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>) &#x2014;
Hidden size of the base model.`,name:"hidden_size"},{anchor:"peft.XLoraConfig.adapters",description:`<strong>adapters</strong> (<code>dict</code>) &#x2014;
Mapping of adapter names to the LoRA adapter id, as per PeftModel.load_adapter. <em>They will be automatically
loaded</em>, to use as LoRA experts. When using from_pretrained, pass the new adapters dict as a keyword
argument.`,name:"adapters"},{anchor:"peft.XLoraConfig.enable_softmax",description:`<strong>enable_softmax</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Enable softmax application for the X-LoRA classifier.`,name:"enable_softmax"},{anchor:"peft.XLoraConfig.enable_softmax_topk",description:`<strong>enable_softmax_topk</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Enable softmax application for the top-k LoRA adapters. Mutually exclusive to <code>enable_softmax</code> and must
only be set if <code>top_k_lora</code> is.`,name:"enable_softmax_topk"},{anchor:"peft.XLoraConfig.softmax_temperature",description:`<strong>softmax_temperature</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Softmax temperature, lower yields sharper predictions`,name:"softmax_temperature"},{anchor:"peft.XLoraConfig.layerwise_scalings",description:`<strong>layerwise_scalings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, generate scalings for each LoRA adapter (each layer). If this is False, then scalings will be
broadcasted, the same, to each layer.`,name:"layerwise_scalings"},{anchor:"peft.XLoraConfig.top_k_lora",description:`<strong>top_k_lora</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Sparsely select the top_k LoRA experts instead of the default dense method.`,name:"top_k_lora"},{anchor:"peft.XLoraConfig.xlora_depth",description:`<strong>xlora_depth</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Depth of the X-LoRA classifier.`,name:"xlora_depth"},{anchor:"peft.XLoraConfig.xlora_size",description:`<strong>xlora_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Hidden size of the X-LoRA classifier, irrelevant if <code>xlora_depth=1</code>.`,name:"xlora_size"},{anchor:"peft.XLoraConfig.xlora_dropout_p",description:`<strong>xlora_dropout_p</strong> (<code>float</code>, <em>optional</em>, defaults to 0.2) &#x2014;
Dropout probability of the X-LoRA classifier, irrelevant if <code>xlora_depth=1</code>.`,name:"xlora_dropout_p"},{anchor:"peft.XLoraConfig.use_trainable_adapters",description:`<strong>use_trainable_adapters</strong> (<code>bool</code>, <em>optional</em>, defaults to False) &#x2014;
Make the adapters trainable.`,name:"use_trainable_adapters"},{anchor:"peft.XLoraConfig.scaling_pass_value",description:`<strong>scaling_pass_value</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
Scaling pass value.`,name:"scaling_pass_value"},{anchor:"peft.XLoraConfig.global_scaling_weight",description:`<strong>global_scaling_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Weight to multiply output of each LoRA adapter by.`,name:"global_scaling_weight"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/config.py#L25"}}),D=new ut({props:{title:"XLoraModel",local:"peft.XLoraModel",headingTag:"h2"}}),q=new U({props:{name:"class peft.XLoraModel",anchor:"peft.XLoraModel",parameters:[{name:"model",val:": nn.Module"},{name:"config",val:": Union[dict[str, XLoraConfig], XLoraConfig]"},{name:"adapter_name",val:": str"},{name:"torch_device",val:": Optional[str] = None"},{name:"ephemeral_gpu_offload",val:": bool = False"},{name:"autocast_adapter_dtype",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"peft.XLoraModel.model",description:"<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014; The model to be adapted.",name:"model"},{anchor:"peft.XLoraModel.config",description:'<strong>config</strong> (<a href="/docs/peft/main/en/package_reference/xlora#peft.XLoraConfig">XLoraConfig</a>) &#x2014; The configuration of the Lora model.',name:"config"},{anchor:"peft.XLoraModel.adapter_name",description:"<strong>adapter_name</strong> (<code>str</code>) &#x2014; The name of the adapter, does not affect the LoRA adapter names.",name:"adapter_name"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L156",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The X-LoRA model.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.nn.Module</code></p>
`}}),G=new Qt({props:{anchor:"peft.XLoraModel.example",$$slots:{default:[St]},$$scope:{ctx:je}}}),P=new U({props:{name:"clear_scalings_log",anchor:"peft.XLoraModel.clear_scalings_log",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L508"}}),O=new U({props:{name:"disable_scalings_logging",anchor:"peft.XLoraModel.disable_scalings_logging",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L501"}}),K=new U({props:{name:"enable_scalings_logging",anchor:"peft.XLoraModel.enable_scalings_logging",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L494"}}),ee=new U({props:{name:"get_bucketed_scalings_log",anchor:"peft.XLoraModel.get_bucketed_scalings_log",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L515"}}),te=new U({props:{name:"get_global_scaling_weight",anchor:"peft.XLoraModel.get_global_scaling_weight",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L471"}}),ae=new U({props:{name:"get_latest_scalings",anchor:"peft.XLoraModel.get_latest_scalings",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L478"}}),le=new U({props:{name:"get_scalings_log",anchor:"peft.XLoraModel.get_scalings_log",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L485"}}),se=new U({props:{name:"set_global_scaling_weight",anchor:"peft.XLoraModel.set_global_scaling_weight",parameters:[{name:"weight",val:": float"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L455"}}),ne=new U({props:{name:"set_scaling_pass_value",anchor:"peft.XLoraModel.set_scaling_pass_value",parameters:[{name:"value",val:": float | None"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L463"}}),oe=new U({props:{name:"set_topk_lora",anchor:"peft.XLoraModel.set_topk_lora",parameters:[{name:"value",val:": Optional[int]"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/xlora/model.py#L447"}}),re=new zt({props:{source:"https://github.com/huggingface/peft/blob/main/docs/source/package_reference/xlora.md"}}),{c(){b=o("meta"),Y=l(),_=o("p"),T=l(),h(j.$$.fragment),m=l(),v=o("p"),v.innerHTML=bt,Ue=l(),N=o("p"),N.innerHTML=Jt,ve=l(),A=o("p"),A.textContent=wt,_e=l(),F=o("p"),F.innerHTML=Tt,xe=l(),V=o("p"),V.textContent=jt,Ge=l(),E=o("p"),E.innerHTML=Ut,Ze=l(),H=o("p"),H.textContent=vt,Ie=l(),h(Q.$$.fragment),Ce=l(),h(z.$$.fragment),We=l(),x=o("div"),h(S.$$.fragment),Se=l(),pe=o("p"),pe.innerHTML=_t,Be=l(),h(D.$$.fragment),Re=l(),i=o("div"),h(q.$$.fragment),De=l(),de=o("p"),de.textContent=xt,qe=l(),ce=o("p"),ce.innerHTML=Gt,Pe=l(),h(G.$$.fragment),Oe=l(),Z=o("div"),h(P.$$.fragment),Ke=l(),me=o("p"),me.textContent=Zt,et=l(),I=o("div"),h(O.$$.fragment),tt=l(),he=o("p"),he.textContent=It,at=l(),C=o("div"),h(K.$$.fragment),lt=l(),ge=o("p"),ge.textContent=Ct,st=l(),W=o("div"),h(ee.$$.fragment),nt=l(),Me=o("p"),Me.textContent=Wt,ot=l(),B=o("div"),h(te.$$.fragment),rt=l(),fe=o("p"),fe.textContent=Bt,it=l(),R=o("div"),h(ae.$$.fragment),pt=l(),ye=o("p"),ye.textContent=Rt,dt=l(),X=o("div"),h(le.$$.fragment),ct=l(),ue=o("p"),ue.textContent=Xt,mt=l(),$=o("div"),h(se.$$.fragment),ht=l(),be=o("p"),be.textContent=$t,gt=l(),k=o("div"),h(ne.$$.fragment),Mt=l(),Je=o("p"),Je.textContent=kt,ft=l(),L=o("div"),h(oe.$$.fragment),yt=l(),we=o("p"),we.textContent=Lt,Xe=l(),h(re.$$.fragment),$e=l(),Te=o("p"),this.h()},l(e){const n=Ht("svelte-u9bgzb",document.head);b=r(n,"META",{name:!0,content:!0}),n.forEach(a),Y=s(e),_=r(e,"P",{}),J(_).forEach(a),T=s(e),g(j.$$.fragment,e),m=s(e),v=r(e,"P",{"data-svelte-h":!0}),c(v)!=="svelte-gbdjrn"&&(v.innerHTML=bt),Ue=s(e),N=r(e,"P",{"data-svelte-h":!0}),c(N)!=="svelte-1dty5ez"&&(N.innerHTML=Jt),ve=s(e),A=r(e,"P",{"data-svelte-h":!0}),c(A)!=="svelte-1ehagof"&&(A.textContent=wt),_e=s(e),F=r(e,"P",{"data-svelte-h":!0}),c(F)!=="svelte-bww8jk"&&(F.innerHTML=Tt),xe=s(e),V=r(e,"P",{"data-svelte-h":!0}),c(V)!=="svelte-1cwsb16"&&(V.textContent=jt),Ge=s(e),E=r(e,"P",{"data-svelte-h":!0}),c(E)!=="svelte-lk8d6w"&&(E.innerHTML=Ut),Ze=s(e),H=r(e,"P",{"data-svelte-h":!0}),c(H)!=="svelte-1tnuhv2"&&(H.textContent=vt),Ie=s(e),g(Q.$$.fragment,e),Ce=s(e),g(z.$$.fragment,e),We=s(e),x=r(e,"DIV",{class:!0});var ie=J(x);g(S.$$.fragment,ie),Se=s(ie),pe=r(ie,"P",{"data-svelte-h":!0}),c(pe)!=="svelte-yy9qtd"&&(pe.innerHTML=_t),ie.forEach(a),Be=s(e),g(D.$$.fragment,e),Re=s(e),i=r(e,"DIV",{class:!0});var d=J(i);g(q.$$.fragment,d),De=s(d),de=r(d,"P",{"data-svelte-h":!0}),c(de)!=="svelte-ghvlmv"&&(de.textContent=xt),qe=s(d),ce=r(d,"P",{"data-svelte-h":!0}),c(ce)!=="svelte-jtyyex"&&(ce.innerHTML=Gt),Pe=s(d),g(G.$$.fragment,d),Oe=s(d),Z=r(d,"DIV",{class:!0});var Le=J(Z);g(P.$$.fragment,Le),Ke=s(Le),me=r(Le,"P",{"data-svelte-h":!0}),c(me)!=="svelte-p2fczk"&&(me.textContent=Zt),Le.forEach(a),et=s(d),I=r(d,"DIV",{class:!0});var Ye=J(I);g(O.$$.fragment,Ye),tt=s(Ye),he=r(Ye,"P",{"data-svelte-h":!0}),c(he)!=="svelte-y5zhxl"&&(he.textContent=It),Ye.forEach(a),at=s(d),C=r(d,"DIV",{class:!0});var Ne=J(C);g(K.$$.fragment,Ne),lt=s(Ne),ge=r(Ne,"P",{"data-svelte-h":!0}),c(ge)!=="svelte-15elol4"&&(ge.textContent=Ct),Ne.forEach(a),st=s(d),W=r(d,"DIV",{class:!0});var Ae=J(W);g(ee.$$.fragment,Ae),nt=s(Ae),Me=r(Ae,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-yzfc15"&&(Me.textContent=Wt),Ae.forEach(a),ot=s(d),B=r(d,"DIV",{class:!0});var Fe=J(B);g(te.$$.fragment,Fe),rt=s(Fe),fe=r(Fe,"P",{"data-svelte-h":!0}),c(fe)!=="svelte-14xm3wg"&&(fe.textContent=Bt),Fe.forEach(a),it=s(d),R=r(d,"DIV",{class:!0});var Ve=J(R);g(ae.$$.fragment,Ve),pt=s(Ve),ye=r(Ve,"P",{"data-svelte-h":!0}),c(ye)!=="svelte-198elwx"&&(ye.textContent=Rt),Ve.forEach(a),dt=s(d),X=r(d,"DIV",{class:!0});var Ee=J(X);g(le.$$.fragment,Ee),ct=s(Ee),ue=r(Ee,"P",{"data-svelte-h":!0}),c(ue)!=="svelte-vm53ar"&&(ue.textContent=Xt),Ee.forEach(a),mt=s(d),$=r(d,"DIV",{class:!0});var He=J($);g(se.$$.fragment,He),ht=s(He),be=r(He,"P",{"data-svelte-h":!0}),c(be)!=="svelte-120x6fb"&&(be.textContent=$t),He.forEach(a),gt=s(d),k=r(d,"DIV",{class:!0});var Qe=J(k);g(ne.$$.fragment,Qe),Mt=s(Qe),Je=r(Qe,"P",{"data-svelte-h":!0}),c(Je)!=="svelte-1nfo7r9"&&(Je.textContent=kt),Qe.forEach(a),ft=s(d),L=r(d,"DIV",{class:!0});var ze=J(L);g(oe.$$.fragment,ze),yt=s(ze),we=r(ze,"P",{"data-svelte-h":!0}),c(we)!=="svelte-1s49adn"&&(we.textContent=Lt),ze.forEach(a),d.forEach(a),Xe=s(e),g(re.$$.fragment,e),$e=s(e),Te=r(e,"P",{}),J(Te).forEach(a),this.h()},h(){w(b,"name","hf:doc:metadata"),w(b,"content",qt),w(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){t(document.head,b),p(e,Y,n),p(e,_,n),p(e,T,n),M(j,e,n),p(e,m,n),p(e,v,n),p(e,Ue,n),p(e,N,n),p(e,ve,n),p(e,A,n),p(e,_e,n),p(e,F,n),p(e,xe,n),p(e,V,n),p(e,Ge,n),p(e,E,n),p(e,Ze,n),p(e,H,n),p(e,Ie,n),M(Q,e,n),p(e,Ce,n),M(z,e,n),p(e,We,n),p(e,x,n),M(S,x,null),t(x,Se),t(x,pe),p(e,Be,n),M(D,e,n),p(e,Re,n),p(e,i,n),M(q,i,null),t(i,De),t(i,de),t(i,qe),t(i,ce),t(i,Pe),M(G,i,null),t(i,Oe),t(i,Z),M(P,Z,null),t(Z,Ke),t(Z,me),t(i,et),t(i,I),M(O,I,null),t(I,tt),t(I,he),t(i,at),t(i,C),M(K,C,null),t(C,lt),t(C,ge),t(i,st),t(i,W),M(ee,W,null),t(W,nt),t(W,Me),t(i,ot),t(i,B),M(te,B,null),t(B,rt),t(B,fe),t(i,it),t(i,R),M(ae,R,null),t(R,pt),t(R,ye),t(i,dt),t(i,X),M(le,X,null),t(X,ct),t(X,ue),t(i,mt),t(i,$),M(se,$,null),t($,ht),t($,be),t(i,gt),t(i,k),M(ne,k,null),t(k,Mt),t(k,Je),t(i,ft),t(i,L),M(oe,L,null),t(L,yt),t(L,we),p(e,Xe,n),M(re,e,n),p(e,$e,n),p(e,Te,n),ke=!0},p(e,[n]){const ie={};n&2&&(ie.$$scope={dirty:n,ctx:e}),G.$set(ie)},i(e){ke||(f(j.$$.fragment,e),f(Q.$$.fragment,e),f(z.$$.fragment,e),f(S.$$.fragment,e),f(D.$$.fragment,e),f(q.$$.fragment,e),f(G.$$.fragment,e),f(P.$$.fragment,e),f(O.$$.fragment,e),f(K.$$.fragment,e),f(ee.$$.fragment,e),f(te.$$.fragment,e),f(ae.$$.fragment,e),f(le.$$.fragment,e),f(se.$$.fragment,e),f(ne.$$.fragment,e),f(oe.$$.fragment,e),f(re.$$.fragment,e),ke=!0)},o(e){y(j.$$.fragment,e),y(Q.$$.fragment,e),y(z.$$.fragment,e),y(S.$$.fragment,e),y(D.$$.fragment,e),y(q.$$.fragment,e),y(G.$$.fragment,e),y(P.$$.fragment,e),y(O.$$.fragment,e),y(K.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),y(ae.$$.fragment,e),y(le.$$.fragment,e),y(se.$$.fragment,e),y(ne.$$.fragment,e),y(oe.$$.fragment,e),y(re.$$.fragment,e),ke=!1},d(e){e&&(a(Y),a(_),a(T),a(m),a(v),a(Ue),a(N),a(ve),a(A),a(_e),a(F),a(xe),a(V),a(Ge),a(E),a(Ze),a(H),a(Ie),a(Ce),a(We),a(x),a(Be),a(Re),a(i),a(Xe),a($e),a(Te)),a(b),u(j,e),u(Q,e),u(z,e),u(S),u(D,e),u(q),u(G),u(P),u(O),u(K),u(ee),u(te),u(ae),u(le),u(se),u(ne),u(oe),u(re,e)}}}const qt='{"title":"X-LoRA","local":"x-lora","sections":[{"title":"XLoraConfig","local":"peft.XLoraConfig","sections":[],"depth":2},{"title":"XLoraModel","local":"peft.XLoraModel","sections":[],"depth":2}],"depth":1}';function Pt(je){return At(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class sa extends Vt{constructor(b){super(),Et(this,b,Pt,Dt,Nt,{})}}export{sa as component};
