import{s as He,o as xe,n as Ce}from"../chunks/scheduler.d6170356.js";import{S as Le,i as Pe,g as s,s as o,r as u,A as Ue,h as r,f as l,c as i,j as ke,u as p,x as d,k as Me,y as je,a,v as f,d as h,t as c,w as g}from"../chunks/index.fcd4cc08.js";import{T as Fe}from"../chunks/Tip.b09c67cf.js";import{C as ue}from"../chunks/CodeBlock.7b16bdef.js";import{H as z,E as Je}from"../chunks/EditOnGithub.da2b595c.js";function Ke(I){let n,b="You might be already familiar with <code>.keras</code> files. In fact, a <code>.keras</code> file is simply a zip file containing the <code>.json</code> and <code>model.weights.h5</code> files. When pushed to the Hub, the model is saved as an unzipped folder in order to let you navigate through the files. Note that if you manually upload a <code>.keras</code> file to a model repository on the Hub, the repository will automatically be tagged as <code>keras</code> but you won’t be able to load it using <code>keras.saving.load_model</code>.";return{c(){n=s("p"),n.innerHTML=b},l(m){n=r(m,"P",{"data-svelte-h":!0}),d(n)!=="svelte-10jvzrc"&&(n.innerHTML=b)},m(m,A){a(m,n,A)},p:Ce,d(m){m&&l(n)}}}function We(I){let n,b,m,A,y,Z,w,pe='Keras is an open-source multi-backend deep learning framework, with support for JAX, TensorFlow, and PyTorch. You can find more details about it on <a href="https://keras.io/" rel="nofollow">keras.io</a>.',S,_,V,v,fe='You can list <code>keras</code> models on the Hub by filtering by library name on the <a href="https://huggingface.co/models?library=keras&amp;sort=downloads" rel="nofollow">models page</a>.',X,T,he="Keras models on the Hub come up with useful features when uploaded directly from the Keras library:",Y,k,ce="<li>A generated model card with a description, a plot of the model, and more.</li> <li>A download count to monitor the popularity of a model.</li> <li>A code snippet to quickly get started with the model.</li>",R,M,B,H,ge="Keras is deeply integrated with the Hugging Face Hub. This means you can load and save models on the Hub directly from the library. To do that, you need to install a recent version of Keras and <code>huggingface_hub</code>. The <code>huggingface_hub</code> library is a lightweight Python client used by Keras to interact with the Hub.",N,x,O,C,$e='Once you have the library installed, you just need to use the regular <code>keras.saving.load_model</code> method by passing as argument a Hugging Face path. An HF path is a <code>repo_id</code> prefixed by <code>hf://</code> e.g. <code>&quot;hf://keras-io/weather-prediction&quot;</code>. Read more about <code>load_model</code> in <a href="https://keras.io/api/models/model_saving_apis/model_saving_and_loading/#load_model-function" rel="nofollow">Keras documentation</a>.',D,L,Q,P,be="If you want to see how to load a specific model, you can click <strong>Use this model</strong> on the model page to get a working code snippet!",ee,U,te,j,ye="Similarly to <code>load_model</code>, you can save and share a <code>keras</code> model on the Hub using <code>model.save()</code> with an HF path:",le,F,ae,J,we="If the repository does not exist on the Hub, it will be created for you. The uploaded model contains a model card, a plot of the model, the <code>metadata.json</code> and <code>config.json</code> files, and a <code>model.weights.h5</code> file containing the model weights.",oe,K,_e='By default, the repository will contain a minimal model card. Check out the <a href="https://huggingface.co/docs/hub/model-cards" rel="nofollow">Model Card guide</a> to learn more about model cards and how to complete them. You can also programmatically update model cards using <code>huggingface_hub.ModelCard</code> (see <a href="https://huggingface.co/docs/huggingface_hub/guides/model-cards" rel="nofollow">guide</a>).',ie,$,ne,W,se,E,ve='<li>Keras Developer <a href="https://keras.io/guides/" rel="nofollow">Guides</a>.</li> <li>Keras <a href="https://keras.io/examples/" rel="nofollow">examples</a>.</li>',re,G,de,q,me;return y=new z({props:{title:"Using Keras at Hugging Face",local:"using-keras-at-hugging-face",headingTag:"h1"}}),_=new z({props:{title:"Exploring Keras in the Hub",local:"exploring-keras-in-the-hub",headingTag:"h2"}}),M=new z({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),x=new ue({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwa2VyYXMlMjBodWdnaW5nZmFjZV9odWI=",highlighted:'pip <span class="hljs-keyword">install</span> -U keras huggingface_hub',wrap:!1}}),L=new ue({props:{code:"aW1wb3J0JTIwa2VyYXMlMEElMEFtb2RlbCUyMCUzRCUyMGtlcmFzLnNhdmluZy5sb2FkX21vZGVsKCUyMmhmJTNBJTJGJTJGV2F1cGxpbiUyRm1uaXN0X2V4YW1wbGUlMjIp",highlighted:`<span class="hljs-keyword">import</span> keras

model = keras.saving.load_model(<span class="hljs-string">&quot;hf://Wauplin/mnist_example&quot;</span>)`,wrap:!1}}),U=new z({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),F=new ue({props:{code:"bW9kZWwlMjAlM0QlMjAuLi4lMEFtb2RlbC5zYXZlKCUyMmhmJTNBJTJGJTJGeW91ci11c2VybmFtZSUyRnlvdXItbW9kZWwtbmFtZSUyMik=",highlighted:`model = ...
model.save(<span class="hljs-string">&quot;hf://your-username/your-model-name&quot;</span>)`,wrap:!1}}),$=new Fe({props:{$$slots:{default:[Ke]},$$scope:{ctx:I}}}),W=new z({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),G=new Je({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/keras.md"}}),{c(){n=s("meta"),b=o(),m=s("p"),A=o(),u(y.$$.fragment),Z=o(),w=s("p"),w.innerHTML=pe,S=o(),u(_.$$.fragment),V=o(),v=s("p"),v.innerHTML=fe,X=o(),T=s("p"),T.textContent=he,Y=o(),k=s("ol"),k.innerHTML=ce,R=o(),u(M.$$.fragment),B=o(),H=s("p"),H.innerHTML=ge,N=o(),u(x.$$.fragment),O=o(),C=s("p"),C.innerHTML=$e,D=o(),u(L.$$.fragment),Q=o(),P=s("p"),P.innerHTML=be,ee=o(),u(U.$$.fragment),te=o(),j=s("p"),j.innerHTML=ye,le=o(),u(F.$$.fragment),ae=o(),J=s("p"),J.innerHTML=we,oe=o(),K=s("p"),K.innerHTML=_e,ie=o(),u($.$$.fragment),ne=o(),u(W.$$.fragment),se=o(),E=s("ul"),E.innerHTML=ve,re=o(),u(G.$$.fragment),de=o(),q=s("p"),this.h()},l(e){const t=Ue("svelte-u9bgzb",document.head);n=r(t,"META",{name:!0,content:!0}),t.forEach(l),b=i(e),m=r(e,"P",{}),ke(m).forEach(l),A=i(e),p(y.$$.fragment,e),Z=i(e),w=r(e,"P",{"data-svelte-h":!0}),d(w)!=="svelte-lh2if0"&&(w.innerHTML=pe),S=i(e),p(_.$$.fragment,e),V=i(e),v=r(e,"P",{"data-svelte-h":!0}),d(v)!=="svelte-v38oq2"&&(v.innerHTML=fe),X=i(e),T=r(e,"P",{"data-svelte-h":!0}),d(T)!=="svelte-1izvrkx"&&(T.textContent=he),Y=i(e),k=r(e,"OL",{"data-svelte-h":!0}),d(k)!=="svelte-6nxkfr"&&(k.innerHTML=ce),R=i(e),p(M.$$.fragment,e),B=i(e),H=r(e,"P",{"data-svelte-h":!0}),d(H)!=="svelte-1stutjb"&&(H.innerHTML=ge),N=i(e),p(x.$$.fragment,e),O=i(e),C=r(e,"P",{"data-svelte-h":!0}),d(C)!=="svelte-1xteu3z"&&(C.innerHTML=$e),D=i(e),p(L.$$.fragment,e),Q=i(e),P=r(e,"P",{"data-svelte-h":!0}),d(P)!=="svelte-it9nkr"&&(P.innerHTML=be),ee=i(e),p(U.$$.fragment,e),te=i(e),j=r(e,"P",{"data-svelte-h":!0}),d(j)!=="svelte-1rb8hx6"&&(j.innerHTML=ye),le=i(e),p(F.$$.fragment,e),ae=i(e),J=r(e,"P",{"data-svelte-h":!0}),d(J)!=="svelte-5mekfp"&&(J.innerHTML=we),oe=i(e),K=r(e,"P",{"data-svelte-h":!0}),d(K)!=="svelte-quc9ua"&&(K.innerHTML=_e),ie=i(e),p($.$$.fragment,e),ne=i(e),p(W.$$.fragment,e),se=i(e),E=r(e,"UL",{"data-svelte-h":!0}),d(E)!=="svelte-12xt5og"&&(E.innerHTML=ve),re=i(e),p(G.$$.fragment,e),de=i(e),q=r(e,"P",{}),ke(q).forEach(l),this.h()},h(){Me(n,"name","hf:doc:metadata"),Me(n,"content",Ee)},m(e,t){je(document.head,n),a(e,b,t),a(e,m,t),a(e,A,t),f(y,e,t),a(e,Z,t),a(e,w,t),a(e,S,t),f(_,e,t),a(e,V,t),a(e,v,t),a(e,X,t),a(e,T,t),a(e,Y,t),a(e,k,t),a(e,R,t),f(M,e,t),a(e,B,t),a(e,H,t),a(e,N,t),f(x,e,t),a(e,O,t),a(e,C,t),a(e,D,t),f(L,e,t),a(e,Q,t),a(e,P,t),a(e,ee,t),f(U,e,t),a(e,te,t),a(e,j,t),a(e,le,t),f(F,e,t),a(e,ae,t),a(e,J,t),a(e,oe,t),a(e,K,t),a(e,ie,t),f($,e,t),a(e,ne,t),f(W,e,t),a(e,se,t),a(e,E,t),a(e,re,t),f(G,e,t),a(e,de,t),a(e,q,t),me=!0},p(e,[t]){const Te={};t&2&&(Te.$$scope={dirty:t,ctx:e}),$.$set(Te)},i(e){me||(h(y.$$.fragment,e),h(_.$$.fragment,e),h(M.$$.fragment,e),h(x.$$.fragment,e),h(L.$$.fragment,e),h(U.$$.fragment,e),h(F.$$.fragment,e),h($.$$.fragment,e),h(W.$$.fragment,e),h(G.$$.fragment,e),me=!0)},o(e){c(y.$$.fragment,e),c(_.$$.fragment,e),c(M.$$.fragment,e),c(x.$$.fragment,e),c(L.$$.fragment,e),c(U.$$.fragment,e),c(F.$$.fragment,e),c($.$$.fragment,e),c(W.$$.fragment,e),c(G.$$.fragment,e),me=!1},d(e){e&&(l(b),l(m),l(A),l(Z),l(w),l(S),l(V),l(v),l(X),l(T),l(Y),l(k),l(R),l(B),l(H),l(N),l(O),l(C),l(D),l(Q),l(P),l(ee),l(te),l(j),l(le),l(ae),l(J),l(oe),l(K),l(ie),l(ne),l(se),l(E),l(re),l(de),l(q)),l(n),g(y,e),g(_,e),g(M,e),g(x,e),g(L,e),g(U,e),g(F,e),g($,e),g(W,e),g(G,e)}}}const Ee='{"title":"Using Keras at Hugging Face","local":"using-keras-at-hugging-face","sections":[{"title":"Exploring Keras in the Hub","local":"exploring-keras-in-the-hub","sections":[],"depth":2},{"title":"Using existing models","local":"using-existing-models","sections":[],"depth":2},{"title":"Sharing your models","local":"sharing-your-models","sections":[],"depth":2},{"title":"Additional resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function Ge(I){return xe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends Le{constructor(n){super(),Pe(this,n,Ge,We,He,{})}}export{Se as component};
