Buckets:

HuggingFaceDocBuilder's picture
download
raw
15.5 kB
import{s as he,n as Me,o as fe}from"../chunks/scheduler.d75c11ed.js";import{S as ue,i as ce,e as i,s as n,c as o,h as ye,a as p,d as l,b as s,f as st,g as r,j as f,k as Dt,l as u,m as a,n as m,t as d,o as h,p as M}from"../chunks/index.4ec9dfe9.js";import{C as we,H as tt,E as $e}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.9a52dede.js";import{C as c}from"../chunks/CodeBlock.37bede1d.js";function ge(Pt){let w,ot,it,rt,g,mt,J,dt,j,qt="Before you start, you’ll need to setup your environment and install the appropriate packages. 🤗 Datasets is tested on <strong>Python 3.10+</strong>.",ht,$,Ot='<p>If you want to use 🤗 Datasets with TensorFlow or PyTorch, you’ll need to install them separately. Refer to the <a href="https://www.tensorflow.org/install/pip#tensorflow-2-packages-are-available" rel="nofollow">TensorFlow installation page</a> or the <a href="https://pytorch.org/get-started/locally/#start-locally" rel="nofollow">PyTorch installation page</a> for the specific install command for your framework.</p>',Mt,T,ft,b,Kt='You should install 🤗 Datasets in a <a href="https://docs.python.org/3/library/venv.html" rel="nofollow">virtual environment</a> to keep things tidy and avoid dependency conflicts.',ut,y,U,et,te="Create and navigate to your project directory:",Vt,v,St,x,lt,ee="Start a virtual environment inside your directory:",Et,G,Lt,I,at,le="Activate and deactivate the virtual environment with the following commands:",At,B,ct,C,ae="Once you’ve created your virtual environment, you can install 🤗 Datasets in it.",yt,Z,wt,W,ne="The most straightforward way to install 🤗 Datasets is with pip:",$t,R,gt,k,se="Run the following command to check if 🤗 Datasets has been properly installed:",Jt,X,jt,_,ie='This command downloads version 1 of the <a href="https://rajpurkar.github.io/SQuAD-explorer/" rel="nofollow">Stanford Question Answering Dataset (SQuAD)</a>, loads the training split, and prints the first training example. You should see:',Tt,Y,bt,F,Ut,N,pe='To work with audio datasets, you need to install the <a href="/docs/datasets/pr_8213/en/package_reference/main_classes#datasets.Audio">Audio</a> feature as an extra dependency:',vt,H,xt,z,Gt,Q,oe='To work with image datasets, you need to install the <a href="/docs/datasets/pr_8213/en/package_reference/main_classes#datasets.Image">Image</a> feature as an extra dependency:',It,V,Bt,S,Ct,E,re="Building 🤗 Datasets from source lets you make changes to the code base. To install from the source, clone the repository and install with the following commands:",Zt,L,Wt,A,me="Again, you can check if 🤗 Datasets was properly installed with the following command:",Rt,D,kt,P,Xt,q,de="🤗 Datasets can also be installed from conda, a package management system:",_t,O,Yt,K,Ft,pt,Nt;return g=new we({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),J=new tt({props:{title:"Installation",local:"installation",headingTag:"h1"}}),T=new tt({props:{title:"Virtual environment",local:"virtual-environment",headingTag:"h2"}}),v=new c({props:{code:"bWtkaXIlMjB+JTJGbXktcHJvamVjdCUwQWNkJTIwfiUyRm15LXByb2plY3Q=",highlighted:`<span class="hljs-built_in">mkdir</span> ~/my-project
<span class="hljs-built_in">cd</span> ~/my-project`,lang:"bash",wrap:!1}}),G=new c({props:{code:"cHl0aG9uJTIwLW0lMjB2ZW52JTIwLmVudg==",highlighted:'python -m venv .<span class="hljs-built_in">env</span>',lang:"bash",wrap:!1}}),B=new c({props:{code:"JTIzJTIwQWN0aXZhdGUlMjB0aGUlMjB2aXJ0dWFsJTIwZW52aXJvbm1lbnQlMEFzb3VyY2UlMjAuZW52JTJGYmluJTJGYWN0aXZhdGUlMEElMEElMjMlMjBEZWFjdGl2YXRlJTIwdGhlJTIwdmlydHVhbCUyMGVudmlyb25tZW50JTBBc291cmNlJTIwLmVudiUyRmJpbiUyRmRlYWN0aXZhdGU=",highlighted:`<span class="hljs-comment"># Activate the virtual environment</span>
<span class="hljs-built_in">source</span> .<span class="hljs-built_in">env</span>/bin/activate
<span class="hljs-comment"># Deactivate the virtual environment</span>
<span class="hljs-built_in">source</span> .<span class="hljs-built_in">env</span>/bin/deactivate`,lang:"bash",wrap:!1}}),Z=new tt({props:{title:"pip",local:"pip",headingTag:"h2"}}),R=new c({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRhdGFzZXRz",highlighted:"pip install datasets",lang:"bash",wrap:!1}}),X=new c({props:{code:"cHl0aG9uJTIwLWMlMjAlMjJmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlM0IlMjBwcmludChsb2FkX2RhdGFzZXQoJ3JhanB1cmthciUyRnNxdWFkJyUyQyUyMHNwbGl0JTNEJ3RyYWluJyklNUIwJTVEKSUyMg==",highlighted:'python -c <span class="hljs-string">&quot;from datasets import load_dataset; print(load_dataset(&#x27;rajpurkar/squad&#x27;, split=&#x27;train&#x27;)[0])&quot;</span>',lang:"bash",wrap:!1}}),Y=new c({props:{code:"JTdCJ2Fuc3dlcnMnJTNBJTIwJTdCJ2Fuc3dlcl9zdGFydCclM0ElMjAlNUI1MTUlNUQlMkMlMjAndGV4dCclM0ElMjAlNUInU2FpbnQlMjBCZXJuYWRldHRlJTIwU291Ymlyb3VzJyU1RCU3RCUyQyUyMCdjb250ZXh0JyUzQSUyMCdBcmNoaXRlY3R1cmFsbHklMkMlMjB0aGUlMjBzY2hvb2wlMjBoYXMlMjBhJTIwQ2F0aG9saWMlMjBjaGFyYWN0ZXIuJTIwQXRvcCUyMHRoZSUyME1haW4lMjBCdWlsZGluZyU1QydzJTIwZ29sZCUyMGRvbWUlMjBpcyUyMGElMjBnb2xkZW4lMjBzdGF0dWUlMjBvZiUyMHRoZSUyMFZpcmdpbiUyME1hcnkuJTIwSW1tZWRpYXRlbHklMjBpbiUyMGZyb250JTIwb2YlMjB0aGUlMjBNYWluJTIwQnVpbGRpbmclMjBhbmQlMjBmYWNpbmclMjBpdCUyQyUyMGlzJTIwYSUyMGNvcHBlciUyMHN0YXR1ZSUyMG9mJTIwQ2hyaXN0JTIwd2l0aCUyMGFybXMlMjB1cHJhaXNlZCUyMHdpdGglMjB0aGUlMjBsZWdlbmQlMjAlMjJWZW5pdGUlMjBBZCUyME1lJTIwT21uZXMlMjIuJTIwTmV4dCUyM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Ob3RyZV9EYW1lJyU3RA==",highlighted:'{<span class="hljs-string">&#x27;answers&#x27;</span>: {<span class="hljs-string">&#x27;answer_start&#x27;</span>: [<span class="hljs-number">515</span>], <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&#x27;Saint Bernadette Soubirous&#x27;</span>]}, <span class="hljs-string">&#x27;context&#x27;</span>: <span class="hljs-string">&#x27;Architecturally, the school has a Catholic character. Atop the Main Building\\&#x27;s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend &quot;Venite Ad Me Omnes&quot;. Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.&#x27;</span>, <span class="hljs-string">&#x27;id&#x27;</span>: <span class="hljs-string">&#x27;5733be284776f41900661182&#x27;</span>, <span class="hljs-string">&#x27;question&#x27;</span>: <span class="hljs-string">&#x27;To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?&#x27;</span>, <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;University_of_Notre_Dame&#x27;</span>}',lang:"python",wrap:!1}}),F=new tt({props:{title:"Audio",local:"audio",headingTag:"h2"}}),H=new c({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRhdGFzZXRzJTVCYXVkaW8lNUQ=",highlighted:"pip install datasets[audio]",lang:"bash",wrap:!1}}),z=new tt({props:{title:"Vision",local:"vision",headingTag:"h2"}}),V=new c({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRhdGFzZXRzJTVCdmlzaW9uJTVE",highlighted:"pip install datasets[vision]",lang:"bash",wrap:!1}}),S=new tt({props:{title:"source",local:"source",headingTag:"h2"}}),L=new c({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRhdGFzZXRzLmdpdCUwQWNkJTIwZGF0YXNldHMlMEFwaXAlMjBpbnN0YWxsJTIwLWUlMjAu",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/datasets.git
<span class="hljs-built_in">cd</span> datasets
pip install -e .`,lang:"bash",wrap:!1}}),D=new c({props:{code:"cHl0aG9uJTIwLWMlMjAlMjJmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlM0IlMjBwcmludChsb2FkX2RhdGFzZXQoJ3JhanB1cmthciUyRnNxdWFkJyUyQyUyMHNwbGl0JTNEJ3RyYWluJyklNUIwJTVEKSUyMg==",highlighted:'python -c <span class="hljs-string">&quot;from datasets import load_dataset; print(load_dataset(&#x27;rajpurkar/squad&#x27;, split=&#x27;train&#x27;)[0])&quot;</span>',lang:"bash",wrap:!1}}),P=new tt({props:{title:"conda",local:"conda",headingTag:"h2"}}),O=new c({props:{code:"Y29uZGElMjBpbnN0YWxsJTIwLWMlMjBodWdnaW5nZmFjZSUyMC1jJTIwY29uZGEtZm9yZ2UlMjBkYXRhc2V0cw==",highlighted:"conda install -c huggingface -c conda-forge datasets",lang:"bash",wrap:!1}}),K=new $e({props:{source:"https://github.com/huggingface/datasets/blob/main/docs/source/installation.md"}}),{c(){w=i("meta"),ot=n(),it=i("p"),rt=n(),o(g.$$.fragment),mt=n(),o(J.$$.fragment),dt=n(),j=i("p"),j.innerHTML=qt,ht=n(),$=i("blockquote"),$.innerHTML=Ot,Mt=n(),o(T.$$.fragment),ft=n(),b=i("p"),b.innerHTML=Kt,ut=n(),y=i("ol"),U=i("li"),et=i("p"),et.textContent=te,Vt=n(),o(v.$$.fragment),St=n(),x=i("li"),lt=i("p"),lt.textContent=ee,Et=n(),o(G.$$.fragment),Lt=n(),I=i("li"),at=i("p"),at.textContent=le,At=n(),o(B.$$.fragment),ct=n(),C=i("p"),C.textContent=ae,yt=n(),o(Z.$$.fragment),wt=n(),W=i("p"),W.textContent=ne,$t=n(),o(R.$$.fragment),gt=n(),k=i("p"),k.textContent=se,Jt=n(),o(X.$$.fragment),jt=n(),_=i("p"),_.innerHTML=ie,Tt=n(),o(Y.$$.fragment),bt=n(),o(F.$$.fragment),Ut=n(),N=i("p"),N.innerHTML=pe,vt=n(),o(H.$$.fragment),xt=n(),o(z.$$.fragment),Gt=n(),Q=i("p"),Q.innerHTML=oe,It=n(),o(V.$$.fragment),Bt=n(),o(S.$$.fragment),Ct=n(),E=i("p"),E.textContent=re,Zt=n(),o(L.$$.fragment),Wt=n(),A=i("p"),A.textContent=me,Rt=n(),o(D.$$.fragment),kt=n(),o(P.$$.fragment),Xt=n(),q=i("p"),q.textContent=de,_t=n(),o(O.$$.fragment),Yt=n(),o(K.$$.fragment),Ft=n(),pt=i("p"),this.h()},l(t){const e=ye("svelte-u9bgzb",document.head);w=p(e,"META",{name:!0,content:!0}),e.forEach(l),ot=s(t),it=p(t,"P",{}),st(it).forEach(l),rt=s(t),r(g.$$.fragment,t),mt=s(t),r(J.$$.fragment,t),dt=s(t),j=p(t,"P",{"data-svelte-h":!0}),f(j)!=="svelte-b3q1sz"&&(j.innerHTML=qt),ht=s(t),$=p(t,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),f($)!=="svelte-14gmpzm"&&($.innerHTML=Ot),Mt=s(t),r(T.$$.fragment,t),ft=s(t),b=p(t,"P",{"data-svelte-h":!0}),f(b)!=="svelte-df2o38"&&(b.innerHTML=Kt),ut=s(t),y=p(t,"OL",{});var nt=st(y);U=p(nt,"LI",{});var Ht=st(U);et=p(Ht,"P",{"data-svelte-h":!0}),f(et)!=="svelte-1r7xizg"&&(et.textContent=te),Vt=s(Ht),r(v.$$.fragment,Ht),Ht.forEach(l),St=s(nt),x=p(nt,"LI",{});var zt=st(x);lt=p(zt,"P",{"data-svelte-h":!0}),f(lt)!=="svelte-f9gewz"&&(lt.textContent=ee),Et=s(zt),r(G.$$.fragment,zt),zt.forEach(l),Lt=s(nt),I=p(nt,"LI",{});var Qt=st(I);at=p(Qt,"P",{"data-svelte-h":!0}),f(at)!=="svelte-1emagpr"&&(at.textContent=le),At=s(Qt),r(B.$$.fragment,Qt),Qt.forEach(l),nt.forEach(l),ct=s(t),C=p(t,"P",{"data-svelte-h":!0}),f(C)!=="svelte-1b6lv7b"&&(C.textContent=ae),yt=s(t),r(Z.$$.fragment,t),wt=s(t),W=p(t,"P",{"data-svelte-h":!0}),f(W)!=="svelte-16zxowv"&&(W.textContent=ne),$t=s(t),r(R.$$.fragment,t),gt=s(t),k=p(t,"P",{"data-svelte-h":!0}),f(k)!=="svelte-i0upf"&&(k.textContent=se),Jt=s(t),r(X.$$.fragment,t),jt=s(t),_=p(t,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1c5jt3j"&&(_.innerHTML=ie),Tt=s(t),r(Y.$$.fragment,t),bt=s(t),r(F.$$.fragment,t),Ut=s(t),N=p(t,"P",{"data-svelte-h":!0}),f(N)!=="svelte-1p9wuta"&&(N.innerHTML=pe),vt=s(t),r(H.$$.fragment,t),xt=s(t),r(z.$$.fragment,t),Gt=s(t),Q=p(t,"P",{"data-svelte-h":!0}),f(Q)!=="svelte-1r1q8af"&&(Q.innerHTML=oe),It=s(t),r(V.$$.fragment,t),Bt=s(t),r(S.$$.fragment,t),Ct=s(t),E=p(t,"P",{"data-svelte-h":!0}),f(E)!=="svelte-1lrjvdf"&&(E.textContent=re),Zt=s(t),r(L.$$.fragment,t),Wt=s(t),A=p(t,"P",{"data-svelte-h":!0}),f(A)!=="svelte-1g7hc2f"&&(A.textContent=me),Rt=s(t),r(D.$$.fragment,t),kt=s(t),r(P.$$.fragment,t),Xt=s(t),q=p(t,"P",{"data-svelte-h":!0}),f(q)!=="svelte-f8adv0"&&(q.textContent=de),_t=s(t),r(O.$$.fragment,t),Yt=s(t),r(K.$$.fragment,t),Ft=s(t),pt=p(t,"P",{}),st(pt).forEach(l),this.h()},h(){Dt(w,"name","hf:doc:metadata"),Dt(w,"content",Je),Dt($,"class","tip")},m(t,e){u(document.head,w),a(t,ot,e),a(t,it,e),a(t,rt,e),m(g,t,e),a(t,mt,e),m(J,t,e),a(t,dt,e),a(t,j,e),a(t,ht,e),a(t,$,e),a(t,Mt,e),m(T,t,e),a(t,ft,e),a(t,b,e),a(t,ut,e),a(t,y,e),u(y,U),u(U,et),u(U,Vt),m(v,U,null),u(y,St),u(y,x),u(x,lt),u(x,Et),m(G,x,null),u(y,Lt),u(y,I),u(I,at),u(I,At),m(B,I,null),a(t,ct,e),a(t,C,e),a(t,yt,e),m(Z,t,e),a(t,wt,e),a(t,W,e),a(t,$t,e),m(R,t,e),a(t,gt,e),a(t,k,e),a(t,Jt,e),m(X,t,e),a(t,jt,e),a(t,_,e),a(t,Tt,e),m(Y,t,e),a(t,bt,e),m(F,t,e),a(t,Ut,e),a(t,N,e),a(t,vt,e),m(H,t,e),a(t,xt,e),m(z,t,e),a(t,Gt,e),a(t,Q,e),a(t,It,e),m(V,t,e),a(t,Bt,e),m(S,t,e),a(t,Ct,e),a(t,E,e),a(t,Zt,e),m(L,t,e),a(t,Wt,e),a(t,A,e),a(t,Rt,e),m(D,t,e),a(t,kt,e),m(P,t,e),a(t,Xt,e),a(t,q,e),a(t,_t,e),m(O,t,e),a(t,Yt,e),m(K,t,e),a(t,Ft,e),a(t,pt,e),Nt=!0},p:Me,i(t){Nt||(d(g.$$.fragment,t),d(J.$$.fragment,t),d(T.$$.fragment,t),d(v.$$.fragment,t),d(G.$$.fragment,t),d(B.$$.fragment,t),d(Z.$$.fragment,t),d(R.$$.fragment,t),d(X.$$.fragment,t),d(Y.$$.fragment,t),d(F.$$.fragment,t),d(H.$$.fragment,t),d(z.$$.fragment,t),d(V.$$.fragment,t),d(S.$$.fragment,t),d(L.$$.fragment,t),d(D.$$.fragment,t),d(P.$$.fragment,t),d(O.$$.fragment,t),d(K.$$.fragment,t),Nt=!0)},o(t){h(g.$$.fragment,t),h(J.$$.fragment,t),h(T.$$.fragment,t),h(v.$$.fragment,t),h(G.$$.fragment,t),h(B.$$.fragment,t),h(Z.$$.fragment,t),h(R.$$.fragment,t),h(X.$$.fragment,t),h(Y.$$.fragment,t),h(F.$$.fragment,t),h(H.$$.fragment,t),h(z.$$.fragment,t),h(V.$$.fragment,t),h(S.$$.fragment,t),h(L.$$.fragment,t),h(D.$$.fragment,t),h(P.$$.fragment,t),h(O.$$.fragment,t),h(K.$$.fragment,t),Nt=!1},d(t){t&&(l(ot),l(it),l(rt),l(mt),l(dt),l(j),l(ht),l($),l(Mt),l(ft),l(b),l(ut),l(y),l(ct),l(C),l(yt),l(wt),l(W),l($t),l(gt),l(k),l(Jt),l(jt),l(_),l(Tt),l(bt),l(Ut),l(N),l(vt),l(xt),l(Gt),l(Q),l(It),l(Bt),l(Ct),l(E),l(Zt),l(Wt),l(A),l(Rt),l(kt),l(Xt),l(q),l(_t),l(Yt),l(Ft),l(pt)),l(w),M(g,t),M(J,t),M(T,t),M(v),M(G),M(B),M(Z,t),M(R,t),M(X,t),M(Y,t),M(F,t),M(H,t),M(z,t),M(V,t),M(S,t),M(L,t),M(D,t),M(P,t),M(O,t),M(K,t)}}}const Je='{"title":"Installation","local":"installation","sections":[{"title":"Virtual environment","local":"virtual-environment","sections":[],"depth":2},{"title":"pip","local":"pip","sections":[],"depth":2},{"title":"Audio","local":"audio","sections":[],"depth":2},{"title":"Vision","local":"vision","sections":[],"depth":2},{"title":"source","local":"source","sections":[],"depth":2},{"title":"conda","local":"conda","sections":[],"depth":2}],"depth":1}';function je(Pt){return fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends ue{constructor(w){super(),ce(this,w,je,ge,he,{})}}export{xe as component};

Xet Storage Details

Size:
15.5 kB
·
Xet hash:
8c016bba6e1d89bad73b5f9a7c493fe2babbc87961fc08c5a946a23daaa6ab68

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.