import{s as Ft,o as Vt,n as Et}from"../chunks/scheduler.78382b47.js";import{S as Ht,i as zt,e as o,s as l,c as m,h as Qt,a as r,d as a,b as s,f as J,g as h,j as c,k as w,l as t,m as p,n as g,t as f,o as M,p as y}from"../chunks/index.6dd35eb6.js";import{C as St,H as Jt,E as Dt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8d7e60c0.js";import{D as v}from"../chunks/Docstring.57cb1354.js";import{C as At}from"../chunks/CodeBlock.4d4112a9.js";import{E as qt}from"../chunks/ExampleCodeBlock.7440be11.js";function Pt(ve){let b,Y="Example:",_,T,j;return T=new At({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(),m(T.$$.fragment)},l(u){b=r(u,"P",{"data-svelte-h":!0}),c(b)!=="svelte-11lpom8"&&(b.textContent=Y),_=s(u),h(T.$$.fragment,u)},m(u,U){p(u,b,U),p(u,_,U),g(T,u,U),j=!0},p:Et,i(u){j||(f(T.$$.fragment,u),j=!0)},o(u){M(T.$$.fragment,u),j=!1},d(u){u&&(a(b),a(_)),y(T,u)}}}function Ot(ve){let b,Y,_,T,j,u,U,Ue,N,wt='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.',_e,A,Tt="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.",xe,F,jt="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.",Ge,V,vt='<img src="https://github.com/EricLBuehler/xlora/raw/master/res/token_by_token_scalings.gif" alt="Token-by-token scalings"/>',Ze,E,Ut="The abstract from the paper is:",Ie,H,_t="<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>.",Ce,z,xt="Please cite X-LoRA as:",We,Q,$e,S,Be,x,D,qe,de,Gt=`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.`,Re,q,Xe,i,P,Pe,ce,Zt=`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.`,Oe,me,It='The method is described in detail in <a href="https://huggingface.co/papers/2402.07148" rel="nofollow">https://huggingface.co/papers/2402.07148</a>.',Ke,G,et,Z,O,tt,he,Ct="Clear the scalings log.",at,I,K,lt,ge,Wt="Disable scalings logging, without clearing the log.",st,C,ee,nt,fe,$t="Enable scalings logging.",ot,W,te,rt,Me,Bt=`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.`,it,$,ae,pt,ye,Rt="Get the global LoRA weight.",dt,B,le,ct,ue,Xt=`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).`,mt,R,se,ht,be,kt=`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.`,gt,X,ne,ft,Je,Lt=`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.`,Mt,k,oe,yt,we,Yt=`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.`,ut,L,re,bt,Te,Nt=`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.`,ke,ie,Le,je,Ye;return j=new St({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),U=new Jt({props:{title:"X-LoRA",local:"x-lora",headingTag:"h1"}}),Q=new At({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}}),S=new Jt({props:{title:"XLoraConfig",local:"peft.XLoraConfig",headingTag:"h2"}}),D=new v({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/v0.18.0.rc0/src/peft/tuners/xlora/config.py#L25"}}),q=new Jt({props:{title:"XLoraModel",local:"peft.XLoraModel",headingTag:"h2"}}),P=new v({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/v0.18.0.rc0/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/v0.18.0.rc0/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:[Pt]},$$scope:{ctx:ve}}}),O=new v({props:{name:"clear_scalings_log",anchor:"peft.XLoraModel.clear_scalings_log",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L510"}}),K=new v({props:{name:"disable_scalings_logging",anchor:"peft.XLoraModel.disable_scalings_logging",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L503"}}),ee=new v({props:{name:"enable_scalings_logging",anchor:"peft.XLoraModel.enable_scalings_logging",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L496"}}),te=new v({props:{name:"get_bucketed_scalings_log",anchor:"peft.XLoraModel.get_bucketed_scalings_log",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L517"}}),ae=new v({props:{name:"get_global_scaling_weight",anchor:"peft.XLoraModel.get_global_scaling_weight",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L473"}}),le=new v({props:{name:"get_latest_scalings",anchor:"peft.XLoraModel.get_latest_scalings",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L480"}}),se=new v({props:{name:"get_scalings_log",anchor:"peft.XLoraModel.get_scalings_log",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L487"}}),ne=new v({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/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L457"}}),oe=new v({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/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L465"}}),re=new v({props:{name:"set_topk_lora",anchor:"peft.XLoraModel.set_topk_lora",parameters:[{name:"value",val:": Optional[int]"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/xlora/model.py#L449"}}),ie=new Dt({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(),m(j.$$.fragment),u=l(),m(U.$$.fragment),Ue=l(),N=o("p"),N.innerHTML=wt,_e=l(),A=o("p"),A.innerHTML=Tt,xe=l(),F=o("p"),F.textContent=jt,Ge=l(),V=o("p"),V.innerHTML=vt,Ze=l(),E=o("p"),E.textContent=Ut,Ie=l(),H=o("p"),H.innerHTML=_t,Ce=l(),z=o("p"),z.textContent=xt,We=l(),m(Q.$$.fragment),$e=l(),m(S.$$.fragment),Be=l(),x=o("div"),m(D.$$.fragment),qe=l(),de=o("p"),de.innerHTML=Gt,Re=l(),m(q.$$.fragment),Xe=l(),i=o("div"),m(P.$$.fragment),Pe=l(),ce=o("p"),ce.textContent=Zt,Oe=l(),me=o("p"),me.innerHTML=It,Ke=l(),m(G.$$.fragment),et=l(),Z=o("div"),m(O.$$.fragment),tt=l(),he=o("p"),he.textContent=Ct,at=l(),I=o("div"),m(K.$$.fragment),lt=l(),ge=o("p"),ge.textContent=Wt,st=l(),C=o("div"),m(ee.$$.fragment),nt=l(),fe=o("p"),fe.textContent=$t,ot=l(),W=o("div"),m(te.$$.fragment),rt=l(),Me=o("p"),Me.textContent=Bt,it=l(),$=o("div"),m(ae.$$.fragment),pt=l(),ye=o("p"),ye.textContent=Rt,dt=l(),B=o("div"),m(le.$$.fragment),ct=l(),ue=o("p"),ue.textContent=Xt,mt=l(),R=o("div"),m(se.$$.fragment),ht=l(),be=o("p"),be.textContent=kt,gt=l(),X=o("div"),m(ne.$$.fragment),ft=l(),Je=o("p"),Je.textContent=Lt,Mt=l(),k=o("div"),m(oe.$$.fragment),yt=l(),we=o("p"),we.textContent=Yt,ut=l(),L=o("div"),m(re.$$.fragment),bt=l(),Te=o("p"),Te.textContent=Nt,ke=l(),m(ie.$$.fragment),Le=l(),je=o("p"),this.h()},l(e){const n=Qt("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),h(j.$$.fragment,e),u=s(e),h(U.$$.fragment,e),Ue=s(e),N=r(e,"P",{"data-svelte-h":!0}),c(N)!=="svelte-gbdjrn"&&(N.innerHTML=wt),_e=s(e),A=r(e,"P",{"data-svelte-h":!0}),c(A)!=="svelte-1dty5ez"&&(A.innerHTML=Tt),xe=s(e),F=r(e,"P",{"data-svelte-h":!0}),c(F)!=="svelte-1ehagof"&&(F.textContent=jt),Ge=s(e),V=r(e,"P",{"data-svelte-h":!0}),c(V)!=="svelte-bww8jk"&&(V.innerHTML=vt),Ze=s(e),E=r(e,"P",{"data-svelte-h":!0}),c(E)!=="svelte-1cwsb16"&&(E.textContent=Ut),Ie=s(e),H=r(e,"P",{"data-svelte-h":!0}),c(H)!=="svelte-lk8d6w"&&(H.innerHTML=_t),Ce=s(e),z=r(e,"P",{"data-svelte-h":!0}),c(z)!=="svelte-1tnuhv2"&&(z.textContent=xt),We=s(e),h(Q.$$.fragment,e),$e=s(e),h(S.$$.fragment,e),Be=s(e),x=r(e,"DIV",{class:!0});var pe=J(x);h(D.$$.fragment,pe),qe=s(pe),de=r(pe,"P",{"data-svelte-h":!0}),c(de)!=="svelte-yy9qtd"&&(de.innerHTML=Gt),pe.forEach(a),Re=s(e),h(q.$$.fragment,e),Xe=s(e),i=r(e,"DIV",{class:!0});var d=J(i);h(P.$$.fragment,d),Pe=s(d),ce=r(d,"P",{"data-svelte-h":!0}),c(ce)!=="svelte-ghvlmv"&&(ce.textContent=Zt),Oe=s(d),me=r(d,"P",{"data-svelte-h":!0}),c(me)!=="svelte-jtyyex"&&(me.innerHTML=It),Ke=s(d),h(G.$$.fragment,d),et=s(d),Z=r(d,"DIV",{class:!0});var Ne=J(Z);h(O.$$.fragment,Ne),tt=s(Ne),he=r(Ne,"P",{"data-svelte-h":!0}),c(he)!=="svelte-p2fczk"&&(he.textContent=Ct),Ne.forEach(a),at=s(d),I=r(d,"DIV",{class:!0});var Ae=J(I);h(K.$$.fragment,Ae),lt=s(Ae),ge=r(Ae,"P",{"data-svelte-h":!0}),c(ge)!=="svelte-y5zhxl"&&(ge.textContent=Wt),Ae.forEach(a),st=s(d),C=r(d,"DIV",{class:!0});var Fe=J(C);h(ee.$$.fragment,Fe),nt=s(Fe),fe=r(Fe,"P",{"data-svelte-h":!0}),c(fe)!=="svelte-15elol4"&&(fe.textContent=$t),Fe.forEach(a),ot=s(d),W=r(d,"DIV",{class:!0});var Ve=J(W);h(te.$$.fragment,Ve),rt=s(Ve),Me=r(Ve,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-yzfc15"&&(Me.textContent=Bt),Ve.forEach(a),it=s(d),$=r(d,"DIV",{class:!0});var Ee=J($);h(ae.$$.fragment,Ee),pt=s(Ee),ye=r(Ee,"P",{"data-svelte-h":!0}),c(ye)!=="svelte-14xm3wg"&&(ye.textContent=Rt),Ee.forEach(a),dt=s(d),B=r(d,"DIV",{class:!0});var He=J(B);h(le.$$.fragment,He),ct=s(He),ue=r(He,"P",{"data-svelte-h":!0}),c(ue)!=="svelte-198elwx"&&(ue.textContent=Xt),He.forEach(a),mt=s(d),R=r(d,"DIV",{class:!0});var ze=J(R);h(se.$$.fragment,ze),ht=s(ze),be=r(ze,"P",{"data-svelte-h":!0}),c(be)!=="svelte-vm53ar"&&(be.textContent=kt),ze.forEach(a),gt=s(d),X=r(d,"DIV",{class:!0});var Qe=J(X);h(ne.$$.fragment,Qe),ft=s(Qe),Je=r(Qe,"P",{"data-svelte-h":!0}),c(Je)!=="svelte-120x6fb"&&(Je.textContent=Lt),Qe.forEach(a),Mt=s(d),k=r(d,"DIV",{class:!0});var Se=J(k);h(oe.$$.fragment,Se),yt=s(Se),we=r(Se,"P",{"data-svelte-h":!0}),c(we)!=="svelte-1nfo7r9"&&(we.textContent=Yt),Se.forEach(a),ut=s(d),L=r(d,"DIV",{class:!0});var De=J(L);h(re.$$.fragment,De),bt=s(De),Te=r(De,"P",{"data-svelte-h":!0}),c(Te)!=="svelte-1s49adn"&&(Te.textContent=Nt),De.forEach(a),d.forEach(a),ke=s(e),h(ie.$$.fragment,e),Le=s(e),je=r(e,"P",{}),J(je).forEach(a),this.h()},h(){w(b,"name","hf:doc:metadata"),w(b,"content",Kt),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($,"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(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),g(j,e,n),p(e,u,n),g(U,e,n),p(e,Ue,n),p(e,N,n),p(e,_e,n),p(e,A,n),p(e,xe,n),p(e,F,n),p(e,Ge,n),p(e,V,n),p(e,Ze,n),p(e,E,n),p(e,Ie,n),p(e,H,n),p(e,Ce,n),p(e,z,n),p(e,We,n),g(Q,e,n),p(e,$e,n),g(S,e,n),p(e,Be,n),p(e,x,n),g(D,x,null),t(x,qe),t(x,de),p(e,Re,n),g(q,e,n),p(e,Xe,n),p(e,i,n),g(P,i,null),t(i,Pe),t(i,ce),t(i,Oe),t(i,me),t(i,Ke),g(G,i,null),t(i,et),t(i,Z),g(O,Z,null),t(Z,tt),t(Z,he),t(i,at),t(i,I),g(K,I,null),t(I,lt),t(I,ge),t(i,st),t(i,C),g(ee,C,null),t(C,nt),t(C,fe),t(i,ot),t(i,W),g(te,W,null),t(W,rt),t(W,Me),t(i,it),t(i,$),g(ae,$,null),t($,pt),t($,ye),t(i,dt),t(i,B),g(le,B,null),t(B,ct),t(B,ue),t(i,mt),t(i,R),g(se,R,null),t(R,ht),t(R,be),t(i,gt),t(i,X),g(ne,X,null),t(X,ft),t(X,Je),t(i,Mt),t(i,k),g(oe,k,null),t(k,yt),t(k,we),t(i,ut),t(i,L),g(re,L,null),t(L,bt),t(L,Te),p(e,ke,n),g(ie,e,n),p(e,Le,n),p(e,je,n),Ye=!0},p(e,[n]){const pe={};n&2&&(pe.$$scope={dirty:n,ctx:e}),G.$set(pe)},i(e){Ye||(f(j.$$.fragment,e),f(U.$$.fragment,e),f(Q.$$.fragment,e),f(S.$$.fragment,e),f(D.$$.fragment,e),f(q.$$.fragment,e),f(P.$$.fragment,e),f(G.$$.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),f(ie.$$.fragment,e),Ye=!0)},o(e){M(j.$$.fragment,e),M(U.$$.fragment,e),M(Q.$$.fragment,e),M(S.$$.fragment,e),M(D.$$.fragment,e),M(q.$$.fragment,e),M(P.$$.fragment,e),M(G.$$.fragment,e),M(O.$$.fragment,e),M(K.$$.fragment,e),M(ee.$$.fragment,e),M(te.$$.fragment,e),M(ae.$$.fragment,e),M(le.$$.fragment,e),M(se.$$.fragment,e),M(ne.$$.fragment,e),M(oe.$$.fragment,e),M(re.$$.fragment,e),M(ie.$$.fragment,e),Ye=!1},d(e){e&&(a(Y),a(_),a(T),a(u),a(Ue),a(N),a(_e),a(A),a(xe),a(F),a(Ge),a(V),a(Ze),a(E),a(Ie),a(H),a(Ce),a(z),a(We),a($e),a(Be),a(x),a(Re),a(Xe),a(i),a(ke),a(Le),a(je)),a(b),y(j,e),y(U,e),y(Q,e),y(S,e),y(D),y(q,e),y(P),y(G),y(O),y(K),y(ee),y(te),y(ae),y(le),y(se),y(ne),y(oe),y(re),y(ie,e)}}}const Kt='{"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 ea(ve){return Vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ra extends Ht{constructor(b){super(),zt(this,b,ea,Ot,Ft,{})}}export{ra as component};
