import{s as ht,n as dt,o as ft}from"../chunks/scheduler.0cf4ef2e.js";import{S as pt,i as mt,e as g,s as o,c as u,h as _t,a as l,d as n,b as i,f as L,g as h,j as c,k as y,l as a,m as r,n as d,t as f,o as p,p as m}from"../chunks/index.abc433bf.js";import{C as bt}from"../chunks/CopyLLMTxtMenu.efc6b005.js";import{D as le}from"../chunks/Docstring.e4170f41.js";import{H as Q,E as $t}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.86d448e2.js";function kt(Re){let v,ue,se,he,E,de,H,fe,I,We="The <code>huggingface_hub</code> library allows users to programmatically manage authentication to the Hub. This includes logging in, logging out, switching between tokens, and listing available tokens.",pe,M,Je='For more details about authentication, check out <a href="../quick-start#authentication">this section</a>.',me,P,_e,s,D,De,G,Xe="Login the machine to access the Hub.",Ve,R,Ye=`The <code>token</code> is persisted in cache and set as a git credential. Once done, the machine
is logged in and the access token will be available across all <code>huggingface_hub</code>
components. If <code>token</code> is not provided, it will be prompted to the user either with
a widget (in a notebook) or via the terminal.`,Fe,W,Ze=`To log in from outside of a script, one can also use <code>hf auth login</code> which is
a cli command that wraps <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login">login()</a>.`,qe,J,et=`<p>[!TIP][login()](/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login) is a drop-in replacement method for <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.notebook_login">notebook_login()</a> as it wraps and
extends its capabilities.</p>`,Oe,V,tt=`<p>When the token is not passed, <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login">login()</a> will automatically detect if the script runs
in a notebook or not. However, this detection might not be accurate due to the
variety of notebooks that exists nowadays. If that is the case, you can always force
the UI by using <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.notebook_login">notebook_login()</a> or <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.interpreter_login">interpreter_login()</a>.</p>`,be,F,$e,_,q,ze,X,nt="Displays a prompt to log in to the HF website and store the token.",Ne,Y,ot=`This is equivalent to <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login">login()</a> without passing a token when not run in a notebook.
<a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.interpreter_login">interpreter_login()</a> is useful if you want to force the use of the terminal prompt
instead of a notebook widget.`,je,Z,it='For more details, see <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login">login()</a>.',ke,O,ve,b,z,Se,ee,at="Displays a widget to log in to the HF website and store the token.",Ue,te,rt=`This is equivalent to <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login">login()</a> without passing a token when run in a notebook.
<a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.notebook_login">notebook_login()</a> is useful if you want to force the use of the notebook widget
instead of a prompt in the terminal.`,Ae,ne,gt='For more details, see <a href="/docs/huggingface_hub/main/en/package_reference/authentication#huggingface_hub.login">login()</a>.',xe,N,we,k,j,Be,oe,lt="Logout the machine from the Hub.",Ke,ie,st="Token is deleted from the machine and removed from git credential.",ye,S,Te,x,U,Qe,ae,ct="Switch to a different access token.",Ce,A,Le,w,B,Ge,re,ut="List all stored access tokens.",Ee,K,He,ce,Ie;return E=new bt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),H=new Q({props:{title:"Authentication",local:"authentication",headingTag:"h1"}}),P=new Q({props:{title:"login",local:"huggingface_hub.login",headingTag:"h2"}}),D=new le({props:{name:"huggingface_hub.login",anchor:"huggingface_hub.login",parameters:[{name:"token",val:": typing.Optional[str] = None"},{name:"add_to_git_credential",val:": bool = False"},{name:"skip_if_logged_in",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.login.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
User access token to generate from <a href="https://huggingface.co/settings/token" rel="nofollow">https://huggingface.co/settings/token</a>.`,name:"token"},{anchor:"huggingface_hub.login.add_to_git_credential",description:`<strong>add_to_git_credential</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, token will be set as git credential. If no git credential helper
is configured, a warning will be displayed to the user. If <code>token</code> is <code>None</code>,
the value of <code>add_to_git_credential</code> is ignored and will be prompted again
to the end user.`,name:"add_to_git_credential"},{anchor:"huggingface_hub.login.skip_if_logged_in",description:`<strong>skip_if_logged_in</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, do not prompt for token if user is already logged in.`,name:"skip_if_logged_in"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L59",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ValueError"
  rel="nofollow"
><code>ValueError</code></a> —
If an organization token is passed. Only personal account tokens are valid
to log in.</li>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ValueError"
  rel="nofollow"
><code>ValueError</code></a> —
If token is invalid.</li>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ImportError"
  rel="nofollow"
><code>ImportError</code></a> —
If running in a notebook but <code>ipywidgets</code> is not installed.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code> or <code>ImportError</code></p>
`}}),F=new Q({props:{title:"interpreter_login",local:"huggingface_hub.interpreter_login",headingTag:"h2"}}),q=new le({props:{name:"huggingface_hub.interpreter_login",anchor:"huggingface_hub.interpreter_login",parameters:[{name:"skip_if_logged_in",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.interpreter_login.skip_if_logged_in",description:`<strong>skip_if_logged_in</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, do not prompt for token if user is already logged in.`,name:"skip_if_logged_in"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L231"}}),O=new Q({props:{title:"notebook_login",local:"huggingface_hub.notebook_login",headingTag:"h2"}}),z=new le({props:{name:"huggingface_hub.notebook_login",anchor:"huggingface_hub.notebook_login",parameters:[{name:"skip_if_logged_in",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.notebook_login.skip_if_logged_in",description:`<strong>skip_if_logged_in</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, do not prompt for token if user is already logged in.`,name:"skip_if_logged_in"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L293"}}),N=new Q({props:{title:"logout",local:"huggingface_hub.logout",headingTag:"h2"}}),j=new le({props:{name:"huggingface_hub.logout",anchor:"huggingface_hub.logout",parameters:[{name:"token_name",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"huggingface_hub.logout.token_name",description:`<strong>token_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of the access token to logout from. If <code>None</code>, will log out from all saved access tokens.`,name:"token_name"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L119",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ValueError"
  rel="nofollow"
><code>ValueError</code></a> —
If the access token name is not found.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code></p>
`}}),S=new Q({props:{title:"auth_switch",local:"huggingface_hub.auth_switch",headingTag:"h2"}}),U=new le({props:{name:"huggingface_hub.auth_switch",anchor:"huggingface_hub.auth_switch",parameters:[{name:"token_name",val:": str"},{name:"add_to_git_credential",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.auth_switch.token_name",description:`<strong>token_name</strong> (<code>str</code>) &#x2014;
Name of the access token to switch to.`,name:"token_name"},{anchor:"huggingface_hub.auth_switch.add_to_git_credential",description:`<strong>add_to_git_credential</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, token will be set as git credential. If no git credential helper
is configured, a warning will be displayed to the user. If <code>token</code> is <code>None</code>,
the value of <code>add_to_git_credential</code> is ignored and will be prompted again
to the end user.`,name:"add_to_git_credential"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L161",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ValueError"
  rel="nofollow"
><code>ValueError</code></a> —
If the access token name is not found.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code></p>
`}}),A=new Q({props:{title:"auth_list",local:"huggingface_hub.auth_list",headingTag:"h2"}}),B=new le({props:{name:"huggingface_hub.auth_list",anchor:"huggingface_hub.auth_list",parameters:[],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L190"}}),K=new $t({props:{source:"https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/authentication.md"}}),{c(){v=g("meta"),ue=o(),se=g("p"),he=o(),u(E.$$.fragment),de=o(),u(H.$$.fragment),fe=o(),I=g("p"),I.innerHTML=We,pe=o(),M=g("p"),M.innerHTML=Je,me=o(),u(P.$$.fragment),_e=o(),s=g("div"),u(D.$$.fragment),De=o(),G=g("p"),G.textContent=Xe,Ve=o(),R=g("p"),R.innerHTML=Ye,Fe=o(),W=g("p"),W.innerHTML=Ze,qe=o(),J=g("blockquote"),J.innerHTML=et,Oe=o(),V=g("blockquote"),V.innerHTML=tt,be=o(),u(F.$$.fragment),$e=o(),_=g("div"),u(q.$$.fragment),ze=o(),X=g("p"),X.textContent=nt,Ne=o(),Y=g("p"),Y.innerHTML=ot,je=o(),Z=g("p"),Z.innerHTML=it,ke=o(),u(O.$$.fragment),ve=o(),b=g("div"),u(z.$$.fragment),Se=o(),ee=g("p"),ee.textContent=at,Ue=o(),te=g("p"),te.innerHTML=rt,Ae=o(),ne=g("p"),ne.innerHTML=gt,xe=o(),u(N.$$.fragment),we=o(),k=g("div"),u(j.$$.fragment),Be=o(),oe=g("p"),oe.textContent=lt,Ke=o(),ie=g("p"),ie.textContent=st,ye=o(),u(S.$$.fragment),Te=o(),x=g("div"),u(U.$$.fragment),Qe=o(),ae=g("p"),ae.textContent=ct,Ce=o(),u(A.$$.fragment),Le=o(),w=g("div"),u(B.$$.fragment),Ge=o(),re=g("p"),re.textContent=ut,Ee=o(),u(K.$$.fragment),He=o(),ce=g("p"),this.h()},l(e){const t=_t("svelte-u9bgzb",document.head);v=l(t,"META",{name:!0,content:!0}),t.forEach(n),ue=i(e),se=l(e,"P",{}),L(se).forEach(n),he=i(e),h(E.$$.fragment,e),de=i(e),h(H.$$.fragment,e),fe=i(e),I=l(e,"P",{"data-svelte-h":!0}),c(I)!=="svelte-hevnjg"&&(I.innerHTML=We),pe=i(e),M=l(e,"P",{"data-svelte-h":!0}),c(M)!=="svelte-pa4dpn"&&(M.innerHTML=Je),me=i(e),h(P.$$.fragment,e),_e=i(e),s=l(e,"DIV",{class:!0});var $=L(s);h(D.$$.fragment,$),De=i($),G=l($,"P",{"data-svelte-h":!0}),c(G)!=="svelte-h0rxjs"&&(G.textContent=Xe),Ve=i($),R=l($,"P",{"data-svelte-h":!0}),c(R)!=="svelte-1m8kult"&&(R.innerHTML=Ye),Fe=i($),W=l($,"P",{"data-svelte-h":!0}),c(W)!=="svelte-1jhpmnb"&&(W.innerHTML=Ze),qe=i($),J=l($,"BLOCKQUOTE",{"data-svelte-h":!0}),c(J)!=="svelte-s90ddx"&&(J.innerHTML=et),Oe=i($),V=l($,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),c(V)!=="svelte-1pv9ry1"&&(V.innerHTML=tt),$.forEach(n),be=i(e),h(F.$$.fragment,e),$e=i(e),_=l(e,"DIV",{class:!0});var T=L(_);h(q.$$.fragment,T),ze=i(T),X=l(T,"P",{"data-svelte-h":!0}),c(X)!=="svelte-1rvjqhd"&&(X.textContent=nt),Ne=i(T),Y=l(T,"P",{"data-svelte-h":!0}),c(Y)!=="svelte-1m7vrxs"&&(Y.innerHTML=ot),je=i(T),Z=l(T,"P",{"data-svelte-h":!0}),c(Z)!=="svelte-1kd85oz"&&(Z.innerHTML=it),T.forEach(n),ke=i(e),h(O.$$.fragment,e),ve=i(e),b=l(e,"DIV",{class:!0});var C=L(b);h(z.$$.fragment,C),Se=i(C),ee=l(C,"P",{"data-svelte-h":!0}),c(ee)!=="svelte-bqvn6n"&&(ee.textContent=at),Ue=i(C),te=l(C,"P",{"data-svelte-h":!0}),c(te)!=="svelte-1klz12r"&&(te.innerHTML=rt),Ae=i(C),ne=l(C,"P",{"data-svelte-h":!0}),c(ne)!=="svelte-1kd85oz"&&(ne.innerHTML=gt),C.forEach(n),xe=i(e),h(N.$$.fragment,e),we=i(e),k=l(e,"DIV",{class:!0});var ge=L(k);h(j.$$.fragment,ge),Be=i(ge),oe=l(ge,"P",{"data-svelte-h":!0}),c(oe)!=="svelte-1462z46"&&(oe.textContent=lt),Ke=i(ge),ie=l(ge,"P",{"data-svelte-h":!0}),c(ie)!=="svelte-1x6nsdy"&&(ie.textContent=st),ge.forEach(n),ye=i(e),h(S.$$.fragment,e),Te=i(e),x=l(e,"DIV",{class:!0});var Me=L(x);h(U.$$.fragment,Me),Qe=i(Me),ae=l(Me,"P",{"data-svelte-h":!0}),c(ae)!=="svelte-1f0oekc"&&(ae.textContent=ct),Me.forEach(n),Ce=i(e),h(A.$$.fragment,e),Le=i(e),w=l(e,"DIV",{class:!0});var Pe=L(w);h(B.$$.fragment,Pe),Ge=i(Pe),re=l(Pe,"P",{"data-svelte-h":!0}),c(re)!=="svelte-7p9zq8"&&(re.textContent=ut),Pe.forEach(n),Ee=i(e),h(K.$$.fragment,e),He=i(e),ce=l(e,"P",{}),L(ce).forEach(n),this.h()},h(){y(v,"name","hf:doc:metadata"),y(v,"content",vt),y(V,"class","tip"),y(s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(w,"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,t){a(document.head,v),r(e,ue,t),r(e,se,t),r(e,he,t),d(E,e,t),r(e,de,t),d(H,e,t),r(e,fe,t),r(e,I,t),r(e,pe,t),r(e,M,t),r(e,me,t),d(P,e,t),r(e,_e,t),r(e,s,t),d(D,s,null),a(s,De),a(s,G),a(s,Ve),a(s,R),a(s,Fe),a(s,W),a(s,qe),a(s,J),a(s,Oe),a(s,V),r(e,be,t),d(F,e,t),r(e,$e,t),r(e,_,t),d(q,_,null),a(_,ze),a(_,X),a(_,Ne),a(_,Y),a(_,je),a(_,Z),r(e,ke,t),d(O,e,t),r(e,ve,t),r(e,b,t),d(z,b,null),a(b,Se),a(b,ee),a(b,Ue),a(b,te),a(b,Ae),a(b,ne),r(e,xe,t),d(N,e,t),r(e,we,t),r(e,k,t),d(j,k,null),a(k,Be),a(k,oe),a(k,Ke),a(k,ie),r(e,ye,t),d(S,e,t),r(e,Te,t),r(e,x,t),d(U,x,null),a(x,Qe),a(x,ae),r(e,Ce,t),d(A,e,t),r(e,Le,t),r(e,w,t),d(B,w,null),a(w,Ge),a(w,re),r(e,Ee,t),d(K,e,t),r(e,He,t),r(e,ce,t),Ie=!0},p:dt,i(e){Ie||(f(E.$$.fragment,e),f(H.$$.fragment,e),f(P.$$.fragment,e),f(D.$$.fragment,e),f(F.$$.fragment,e),f(q.$$.fragment,e),f(O.$$.fragment,e),f(z.$$.fragment,e),f(N.$$.fragment,e),f(j.$$.fragment,e),f(S.$$.fragment,e),f(U.$$.fragment,e),f(A.$$.fragment,e),f(B.$$.fragment,e),f(K.$$.fragment,e),Ie=!0)},o(e){p(E.$$.fragment,e),p(H.$$.fragment,e),p(P.$$.fragment,e),p(D.$$.fragment,e),p(F.$$.fragment,e),p(q.$$.fragment,e),p(O.$$.fragment,e),p(z.$$.fragment,e),p(N.$$.fragment,e),p(j.$$.fragment,e),p(S.$$.fragment,e),p(U.$$.fragment,e),p(A.$$.fragment,e),p(B.$$.fragment,e),p(K.$$.fragment,e),Ie=!1},d(e){e&&(n(ue),n(se),n(he),n(de),n(fe),n(I),n(pe),n(M),n(me),n(_e),n(s),n(be),n($e),n(_),n(ke),n(ve),n(b),n(xe),n(we),n(k),n(ye),n(Te),n(x),n(Ce),n(Le),n(w),n(Ee),n(He),n(ce)),n(v),m(E,e),m(H,e),m(P,e),m(D),m(F,e),m(q),m(O,e),m(z),m(N,e),m(j),m(S,e),m(U),m(A,e),m(B),m(K,e)}}}const vt='{"title":"Authentication","local":"authentication","sections":[{"title":"login","local":"huggingface_hub.login","sections":[],"depth":2},{"title":"interpreter_login","local":"huggingface_hub.interpreter_login","sections":[],"depth":2},{"title":"notebook_login","local":"huggingface_hub.notebook_login","sections":[],"depth":2},{"title":"logout","local":"huggingface_hub.logout","sections":[],"depth":2},{"title":"auth_switch","local":"huggingface_hub.auth_switch","sections":[],"depth":2},{"title":"auth_list","local":"huggingface_hub.auth_list","sections":[],"depth":2}],"depth":1}';function xt(Re){return ft(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Et extends pt{constructor(v){super(),mt(this,v,xt,kt,ht,{})}}export{Et as component};
