import{s as $t,n as At,o as xt}from"../chunks/scheduler.8a2cc2fa.js";import{S as wt,i as zt,e as o,s as i,c as l,h as Tt,a as s,d as e,b as n,f as A,g as m,j as dt,k as x,l as d,m as r,n as c,t as p,o as _,p as b}from"../chunks/index.7079e750.js";import{C as kt,H as lt,E as Ct}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.70817bb7.js";import{D as H}from"../chunks/Docstring.4d167ccc.js";function Et(ut){let g,B,S,O,w,R,z,U,T,ht='<a href="https://jmlr.org/papers/v12/duchi11a.html" rel="nofollow">AdaGrad (Adaptive Gradient)</a> is an adaptive learning rate optimizer. AdaGrad stores a sum of the squared past gradients for each parameter and uses it to scale their learning rate. This allows the learning rate to be automatically lower or higher depending on the magnitude of the gradient, eliminating the need to manually tune the learning rate.',F,k,J,u,C,mt,v,E,ct,M,ft="Base Adagrad optimizer.",K,D,Q,h,L,pt,y,P,_t,V,vt="8-bit Adagrad optimizer.",X,j,Y,f,N,bt,$,G,gt,q,yt="32-bit Adagrad optimizer.",Z,I,tt,W,et;return w=new kt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),z=new lt({props:{title:"AdaGrad",local:"adagrad",headingTag:"h1"}}),k=new lt({props:{title:"Adagrad",local:"api-class ][ bitsandbytes.optim.Adagrad",headingTag:"h2"}}),C=new H({props:{name:"class bitsandbytes.optim.Adagrad",anchor:"bitsandbytes.optim.Adagrad",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.01"},{name:"lr_decay",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"initial_accumulator_value",val:" = 0"},{name:"eps",val:" = 1e-10"},{name:"optim_bits",val:" = 32"},{name:"args",val:" = None"},{name:"min_8bit_size",val:" = 4096"},{name:"percentile_clipping",val:" = 100"},{name:"block_wise",val:" = True"}],source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/v0.49.0/bitsandbytes/optim/adagrad.py#L8"}}),E=new H({props:{name:"__init__",anchor:"bitsandbytes.optim.Adagrad.__init__",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.01"},{name:"lr_decay",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"initial_accumulator_value",val:" = 0"},{name:"eps",val:" = 1e-10"},{name:"optim_bits",val:" = 32"},{name:"args",val:" = None"},{name:"min_8bit_size",val:" = 4096"},{name:"percentile_clipping",val:" = 100"},{name:"block_wise",val:" = True"}],parametersDescription:[{anchor:"bitsandbytes.optim.Adagrad.__init__.params",description:`<strong>params</strong> (<code>torch.tensor</code>) &#x2014;
The input parameters to optimize.`,name:"params"},{anchor:"bitsandbytes.optim.Adagrad.__init__.lr",description:`<strong>lr</strong> (<code>float</code>, defaults to 1e-2) &#x2014;
The learning rate.`,name:"lr"},{anchor:"bitsandbytes.optim.Adagrad.__init__.lr_decay",description:`<strong>lr_decay</strong> (<code>int</code>, defaults to 0) &#x2014;
The learning rate decay.`,name:"lr_decay"},{anchor:"bitsandbytes.optim.Adagrad.__init__.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, defaults to 0.0) &#x2014;
The weight decay value for the optimizer.`,name:"weight_decay"},{anchor:"bitsandbytes.optim.Adagrad.__init__.initial_accumulator_value",description:`<strong>initial_accumulator_value</strong> (<code>int</code>, defaults to 0) &#x2014;
The initial momemtum values.`,name:"initial_accumulator_value"},{anchor:"bitsandbytes.optim.Adagrad.__init__.eps",description:`<strong>eps</strong> (<code>float</code>, defaults to 1e-10) &#x2014;
The epsilon value prevents division by zero in the optimizer.`,name:"eps"},{anchor:"bitsandbytes.optim.Adagrad.__init__.optim_bits",description:`<strong>optim_bits</strong> (<code>int</code>, defaults to 32) &#x2014;
The number of bits of the optimizer state.`,name:"optim_bits"},{anchor:"bitsandbytes.optim.Adagrad.__init__.args",description:`<strong>args</strong> (<code>object</code>, defaults to <code>None</code>) &#x2014;
An object with additional arguments.`,name:"args"},{anchor:"bitsandbytes.optim.Adagrad.__init__.min_8bit_size",description:`<strong>min_8bit_size</strong> (<code>int</code>, defaults to 4096) &#x2014;
The minimum number of elements of the parameter tensors for 8-bit optimization.`,name:"min_8bit_size"},{anchor:"bitsandbytes.optim.Adagrad.__init__.percentile_clipping",description:`<strong>percentile_clipping</strong> (<code>int</code>, defaults to 100) &#x2014;
Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.`,name:"percentile_clipping"},{anchor:"bitsandbytes.optim.Adagrad.__init__.block_wise",description:`<strong>block_wise</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.`,name:"block_wise"}],source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/v0.49.0/bitsandbytes/optim/adagrad.py#L9"}}),D=new lt({props:{title:"Adagrad8bit",local:"bitsandbytes.optim.Adagrad8bit",headingTag:"h2"}}),L=new H({props:{name:"class bitsandbytes.optim.Adagrad8bit",anchor:"bitsandbytes.optim.Adagrad8bit",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.01"},{name:"lr_decay",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"initial_accumulator_value",val:" = 0"},{name:"eps",val:" = 1e-10"},{name:"optim_bits",val:" = 8"},{name:"args",val:" = None"},{name:"min_8bit_size",val:" = 4096"},{name:"percentile_clipping",val:" = 100"},{name:"block_wise",val:" = True"}],source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/v0.49.0/bitsandbytes/optim/adagrad.py#L75"}}),P=new H({props:{name:"__init__",anchor:"bitsandbytes.optim.Adagrad8bit.__init__",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.01"},{name:"lr_decay",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"initial_accumulator_value",val:" = 0"},{name:"eps",val:" = 1e-10"},{name:"optim_bits",val:" = 8"},{name:"args",val:" = None"},{name:"min_8bit_size",val:" = 4096"},{name:"percentile_clipping",val:" = 100"},{name:"block_wise",val:" = True"}],parametersDescription:[{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.params",description:`<strong>params</strong> (<code>torch.tensor</code>) &#x2014;
The input parameters to optimize.`,name:"params"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.lr",description:`<strong>lr</strong> (<code>float</code>, defaults to 1e-2) &#x2014;
The learning rate.`,name:"lr"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.lr_decay",description:`<strong>lr_decay</strong> (<code>int</code>, defaults to 0) &#x2014;
The learning rate decay.`,name:"lr_decay"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, defaults to 0.0) &#x2014;
The weight decay value for the optimizer.`,name:"weight_decay"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.initial_accumulator_value",description:`<strong>initial_accumulator_value</strong> (<code>int</code>, defaults to 0) &#x2014;
The initial momemtum values.`,name:"initial_accumulator_value"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.eps",description:`<strong>eps</strong> (<code>float</code>, defaults to 1e-10) &#x2014;
The epsilon value prevents division by zero in the optimizer.`,name:"eps"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.optim_bits",description:`<strong>optim_bits</strong> (<code>int</code>, defaults to 8) &#x2014;
The number of bits of the optimizer state.`,name:"optim_bits"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.args",description:`<strong>args</strong> (<code>object</code>, defaults to <code>None</code>) &#x2014;
An object with additional arguments.`,name:"args"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.min_8bit_size",description:`<strong>min_8bit_size</strong> (<code>int</code>, defaults to 4096) &#x2014;
The minimum number of elements of the parameter tensors for 8-bit optimization.`,name:"min_8bit_size"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.percentile_clipping",description:`<strong>percentile_clipping</strong> (<code>int</code>, defaults to 100) &#x2014;
Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.`,name:"percentile_clipping"},{anchor:"bitsandbytes.optim.Adagrad8bit.__init__.block_wise",description:`<strong>block_wise</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.`,name:"block_wise"}],source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/v0.49.0/bitsandbytes/optim/adagrad.py#L76"}}),j=new lt({props:{title:"Adagrad32bit",local:"bitsandbytes.optim.Adagrad32bit",headingTag:"h2"}}),N=new H({props:{name:"class bitsandbytes.optim.Adagrad32bit",anchor:"bitsandbytes.optim.Adagrad32bit",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.01"},{name:"lr_decay",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"initial_accumulator_value",val:" = 0"},{name:"eps",val:" = 1e-10"},{name:"optim_bits",val:" = 32"},{name:"args",val:" = None"},{name:"min_8bit_size",val:" = 4096"},{name:"percentile_clipping",val:" = 100"},{name:"block_wise",val:" = True"}],source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/v0.49.0/bitsandbytes/optim/adagrad.py#L143"}}),G=new H({props:{name:"__init__",anchor:"bitsandbytes.optim.Adagrad32bit.__init__",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.01"},{name:"lr_decay",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"initial_accumulator_value",val:" = 0"},{name:"eps",val:" = 1e-10"},{name:"optim_bits",val:" = 32"},{name:"args",val:" = None"},{name:"min_8bit_size",val:" = 4096"},{name:"percentile_clipping",val:" = 100"},{name:"block_wise",val:" = True"}],parametersDescription:[{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.params",description:`<strong>params</strong> (<code>torch.tensor</code>) &#x2014;
The input parameters to optimize.`,name:"params"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.lr",description:`<strong>lr</strong> (<code>float</code>, defaults to 1e-2) &#x2014;
The learning rate.`,name:"lr"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.lr_decay",description:`<strong>lr_decay</strong> (<code>int</code>, defaults to 0) &#x2014;
The learning rate decay.`,name:"lr_decay"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, defaults to 0.0) &#x2014;
The weight decay value for the optimizer.`,name:"weight_decay"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.initial_accumulator_value",description:`<strong>initial_accumulator_value</strong> (<code>int</code>, defaults to 0) &#x2014;
The initial momemtum values.`,name:"initial_accumulator_value"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.eps",description:`<strong>eps</strong> (<code>float</code>, defaults to 1e-10) &#x2014;
The epsilon value prevents division by zero in the optimizer.`,name:"eps"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.optim_bits",description:`<strong>optim_bits</strong> (<code>int</code>, defaults to 32) &#x2014;
The number of bits of the optimizer state.`,name:"optim_bits"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.args",description:`<strong>args</strong> (<code>object</code>, defaults to <code>None</code>) &#x2014;
An object with additional arguments.`,name:"args"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.min_8bit_size",description:`<strong>min_8bit_size</strong> (<code>int</code>, defaults to 4096) &#x2014;
The minimum number of elements of the parameter tensors for 8-bit optimization.`,name:"min_8bit_size"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.percentile_clipping",description:`<strong>percentile_clipping</strong> (<code>int</code>, defaults to 100) &#x2014;
Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.`,name:"percentile_clipping"},{anchor:"bitsandbytes.optim.Adagrad32bit.__init__.block_wise",description:`<strong>block_wise</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.`,name:"block_wise"}],source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/v0.49.0/bitsandbytes/optim/adagrad.py#L144"}}),I=new Ct({props:{source:"https://github.com/bitsandbytes-foundation/bitsandbytes/blob/main/docs/source/reference/optim/adagrad.mdx"}}),{c(){g=o("meta"),B=i(),S=o("p"),O=i(),l(w.$$.fragment),R=i(),l(z.$$.fragment),U=i(),T=o("p"),T.innerHTML=ht,F=i(),l(k.$$.fragment),J=i(),u=o("div"),l(C.$$.fragment),mt=i(),v=o("div"),l(E.$$.fragment),ct=i(),M=o("p"),M.textContent=ft,K=i(),l(D.$$.fragment),Q=i(),h=o("div"),l(L.$$.fragment),pt=i(),y=o("div"),l(P.$$.fragment),_t=i(),V=o("p"),V.textContent=vt,X=i(),l(j.$$.fragment),Y=i(),f=o("div"),l(N.$$.fragment),bt=i(),$=o("div"),l(G.$$.fragment),gt=i(),q=o("p"),q.textContent=yt,Z=i(),l(I.$$.fragment),tt=i(),W=o("p"),this.h()},l(t){const a=Tt("svelte-u9bgzb",document.head);g=s(a,"META",{name:!0,content:!0}),a.forEach(e),B=n(t),S=s(t,"P",{}),A(S).forEach(e),O=n(t),m(w.$$.fragment,t),R=n(t),m(z.$$.fragment,t),U=n(t),T=s(t,"P",{"data-svelte-h":!0}),dt(T)!=="svelte-1l8niyc"&&(T.innerHTML=ht),F=n(t),m(k.$$.fragment,t),J=n(t),u=s(t,"DIV",{class:!0});var at=A(u);m(C.$$.fragment,at),mt=n(at),v=s(at,"DIV",{class:!0});var it=A(v);m(E.$$.fragment,it),ct=n(it),M=s(it,"P",{"data-svelte-h":!0}),dt(M)!=="svelte-2ft5mo"&&(M.textContent=ft),it.forEach(e),at.forEach(e),K=n(t),m(D.$$.fragment,t),Q=n(t),h=s(t,"DIV",{class:!0});var nt=A(h);m(L.$$.fragment,nt),pt=n(nt),y=s(nt,"DIV",{class:!0});var rt=A(y);m(P.$$.fragment,rt),_t=n(rt),V=s(rt,"P",{"data-svelte-h":!0}),dt(V)!=="svelte-1jvi8fr"&&(V.textContent=vt),rt.forEach(e),nt.forEach(e),X=n(t),m(j.$$.fragment,t),Y=n(t),f=s(t,"DIV",{class:!0});var ot=A(f);m(N.$$.fragment,ot),bt=n(ot),$=s(ot,"DIV",{class:!0});var st=A($);m(G.$$.fragment,st),gt=n(st),q=s(st,"P",{"data-svelte-h":!0}),dt(q)!=="svelte-r8ezau"&&(q.textContent=yt),st.forEach(e),ot.forEach(e),Z=n(t),m(I.$$.fragment,t),tt=n(t),W=s(t,"P",{}),A(W).forEach(e),this.h()},h(){x(g,"name","hf:doc:metadata"),x(g,"content",Dt),x(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,a){d(document.head,g),r(t,B,a),r(t,S,a),r(t,O,a),c(w,t,a),r(t,R,a),c(z,t,a),r(t,U,a),r(t,T,a),r(t,F,a),c(k,t,a),r(t,J,a),r(t,u,a),c(C,u,null),d(u,mt),d(u,v),c(E,v,null),d(v,ct),d(v,M),r(t,K,a),c(D,t,a),r(t,Q,a),r(t,h,a),c(L,h,null),d(h,pt),d(h,y),c(P,y,null),d(y,_t),d(y,V),r(t,X,a),c(j,t,a),r(t,Y,a),r(t,f,a),c(N,f,null),d(f,bt),d(f,$),c(G,$,null),d($,gt),d($,q),r(t,Z,a),c(I,t,a),r(t,tt,a),r(t,W,a),et=!0},p:At,i(t){et||(p(w.$$.fragment,t),p(z.$$.fragment,t),p(k.$$.fragment,t),p(C.$$.fragment,t),p(E.$$.fragment,t),p(D.$$.fragment,t),p(L.$$.fragment,t),p(P.$$.fragment,t),p(j.$$.fragment,t),p(N.$$.fragment,t),p(G.$$.fragment,t),p(I.$$.fragment,t),et=!0)},o(t){_(w.$$.fragment,t),_(z.$$.fragment,t),_(k.$$.fragment,t),_(C.$$.fragment,t),_(E.$$.fragment,t),_(D.$$.fragment,t),_(L.$$.fragment,t),_(P.$$.fragment,t),_(j.$$.fragment,t),_(N.$$.fragment,t),_(G.$$.fragment,t),_(I.$$.fragment,t),et=!1},d(t){t&&(e(B),e(S),e(O),e(R),e(U),e(T),e(F),e(J),e(u),e(K),e(Q),e(h),e(X),e(Y),e(f),e(Z),e(tt),e(W)),e(g),b(w,t),b(z,t),b(k,t),b(C),b(E),b(D,t),b(L),b(P),b(j,t),b(N),b(G),b(I,t)}}}const Dt='{"title":"AdaGrad","local":"adagrad","sections":[{"title":"Adagrad","local":"api-class ][ bitsandbytes.optim.Adagrad","sections":[],"depth":2},{"title":"Adagrad8bit","local":"bitsandbytes.optim.Adagrad8bit","sections":[],"depth":2},{"title":"Adagrad32bit","local":"bitsandbytes.optim.Adagrad32bit","sections":[],"depth":2}],"depth":1}';function Lt(ut){return xt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class It extends wt{constructor(g){super(),zt(this,g,Lt,Et,$t,{})}}export{It as component};
