import{s as qs,o as Ws,n as Hs}from"../chunks/scheduler.d6170356.js";import{S as Vs,i as Xs,g as u,s as e,r as h,A as zs,h as c,f as a,c as n,j as Qs,u as r,x as M,k as As,y as Ps,a as l,v as o,d as m,t as T,w as J}from"../chunks/index.fcd4cc08.js";import{T as Rs}from"../chunks/Tip.b09c67cf.js";import{C as b}from"../chunks/CodeBlock.db16bf50.js";import{H as Bs,E as Ds}from"../chunks/getInferenceSnippets.0f6acb26.js";function Os(D){let p,$="Note that <code>config_name</code> field is required even if you have a single subset.";return{c(){p=u("p"),p.innerHTML=$},l(f){p=c(f,"P",{"data-svelte-h":!0}),M(p)!=="svelte-1h4lihq"&&(p.innerHTML=$)},m(f,d){l(f,p,d)},p:Hs,d(f){f&&a(p)}}}function Ks(D){let p,$="You can set a default subset using <code>default: true</code>",f,d,U,w,y="This is useful to set which subset the Dataset Viewer shows first, and which subset data libraries load by default.",C;return d=new b({props:{code:"LSUyMGNvbmZpZ19uYW1lJTNBJTIwbWFpbl9kYXRhJTBBJTIwJTIwZGF0YV9maWxlcyUzQSUyMCUyMm1haW5fZGF0YS5jc3YlMjIlMEElMjAlMjBkZWZhdWx0JTNBJTIwdHJ1ZQ==",highlighted:`<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">main_data</span>
  <span class="hljs-attr">data_files:</span> <span class="hljs-string">&quot;main_data.csv&quot;</span>
  <span class="hljs-attr">default:</span> <span class="hljs-literal">true</span>`,wrap:!1}}),{c(){p=u("p"),p.innerHTML=$,f=e(),h(d.$$.fragment),U=e(),w=u("p"),w.textContent=y},l(i){p=c(i,"P",{"data-svelte-h":!0}),M(p)!=="svelte-h6769n"&&(p.innerHTML=$),f=n(i),r(d.$$.fragment,i),U=n(i),w=c(i,"P",{"data-svelte-h":!0}),M(w)!=="svelte-1ihdwyq"&&(w.textContent=y)},m(i,j){l(i,p,j),l(i,f,j),o(d,i,j),l(i,U,j),l(i,w,j),C=!0},p:Hs,i(i){C||(m(d.$$.fragment,i),C=!0)},o(i){T(d.$$.fragment,i),C=!1},d(i){i&&(a(p),a(f),a(U),a(w)),J(d,i)}}}function st(D){let p,$,f,d,U,w,y,C='This guide will show you how to configure a custom structure for your dataset repository. The <a href="https://huggingface.co/collections/datasets-examples/manual-configuration-655e293cea26da0acab95b87" rel="nofollow">companion collection of example datasets</a> showcases each section of the documentation.',i,j,Cs='A dataset with a supported structure and <a href="./datasets-adding#file-formats">file formats</a> automatically has a Dataset Viewer on its dataset page on the Hub. You can use YAML to define the splits, subsets and builder parameters that are used by the Viewer.',K,v,vs="It is also possible to define multiple subsets (also called “configurations”) for the same dataset (e.g. if the dataset has various independent files).",ss,_,ts,I,_s="If you have multiple files and want to define which file goes into which split, you can use YAML at the top of your README.md.",as,S,Is="For example, given a repository like this one:",ls,Y,es,k,Ss="You can define a subset for your splits by adding the <code>configs</code> field in the YAML block at the top of your README.md:",ns,G,ps,E,Ys="You can select multiple files per split using a list of paths:",is,Z,us,F,cs,x,ks="Or you can use glob patterns to automatically list all the files you need:",fs,N,hs,g,rs,L,os,Q,Gs=`Your dataset might have several subsets of data that you want to be able to use separately.
For example each subset has its own dropdown in the Dataset Viewer the Hugging Face Hub.`,ms,A,Es="In that case you can define a list of subsets inside the <code>configs</code> field in YAML:",Ts,R,Js,H,Ms,q,Zs="Note that the order of subsets shown in the viewer is the default one first, then alphabetical.",ds,B,js,W,Us,V,Fs="Not only <code>data_files</code>, but other builder-specific parameters can be passed via YAML, allowing for more flexibility on how to load the data while not requiring any custom code. For example, define which separator to use in which subset to load your <code>csv</code> files:",ws,X,$s,z,xs='Refer to the <a href="/docs/datasets/package_reference/builder_classes">specific builders’ documentation</a> to see what parameters they have.',ys,P,bs,O,gs;return U=new Bs({props:{title:"Manual Configuration",local:"manual-configuration",headingTag:"h1"}}),_=new Bs({props:{title:"Splits",local:"splits",headingTag:"h2"}}),Y=new b({props:{code:"bXlfZGF0YXNldF9yZXBvc2l0b3J5JTJGJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwUkVBRE1FLm1kJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwZGF0YS5jc3YlMEElRTIlOTQlOTQlRTIlOTQlODAlRTIlOTQlODAlMjBob2xkb3V0LmNzdg==",highlighted:`<span class="hljs-title">my_dataset_repository</span>/
├── <span class="hljs-type">README</span>.md
├── <span class="hljs-class"><span class="hljs-keyword">data</span>.csv</span>
└── holdout.csv`,wrap:!1}}),G=new b({props:{code:"LS0tJTBBY29uZmlncyUzQSUwQS0lMjBjb25maWdfbmFtZSUzQSUyMGRlZmF1bHQlMEElMjAlMjBkYXRhX2ZpbGVzJTNBJTBBJTIwJTIwLSUyMHNwbGl0JTNBJTIwdHJhaW4lMEElMjAlMjAlMjAlMjBwYXRoJTNBJTIwJTIyZGF0YS5jc3YlMjIlMEElMjAlMjAtJTIwc3BsaXQlM0ElMjB0ZXN0JTBBJTIwJTIwJTIwJTIwcGF0aCUzQSUyMCUyMmhvbGRvdXQuY3N2JTIyJTBBLS0t",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">configs:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">default</span>
  <span class="hljs-attr">data_files:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">split:</span> <span class="hljs-string">train</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">&quot;data.csv&quot;</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">split:</span> <span class="hljs-string">test</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">&quot;holdout.csv&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),Z=new b({props:{code:"bXlfZGF0YXNldF9yZXBvc2l0b3J5JTJGJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwUkVBRE1FLm1kJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwZGF0YSUyRiUwQSVFMiU5NCU4MiUyMCUyMCUyMCVFMiU5NCU5QyVFMiU5NCU4MCVFMiU5NCU4MCUyMGFiYy5jc3YlMEElRTIlOTQlODIlMjAlMjAlMjAlRTIlOTQlOTQlRTIlOTQlODAlRTIlOTQlODAlMjBkZWYuY3N2JTBBJUUyJTk0JTk0JUUyJTk0JTgwJUUyJTk0JTgwJTIwaG9sZG91dCUyRiUwQSUyMCUyMCUyMCUyMCVFMiU5NCU5NCVFMiU5NCU4MCVFMiU5NCU4MCUyMGdoaS5jc3Y=",highlighted:`my_dataset_repository/
├── README.md
├── data/
│   ├── abc.<span class="hljs-built_in">csv</span>
│   └── def.<span class="hljs-built_in">csv</span>
└── holdout/
    └── ghi.<span class="hljs-built_in">csv</span>`,wrap:!1}}),F=new b({props:{code:"LS0tJTBBY29uZmlncyUzQSUwQS0lMjBjb25maWdfbmFtZSUzQSUyMGRlZmF1bHQlMEElMjAlMjBkYXRhX2ZpbGVzJTNBJTBBJTIwJTIwLSUyMHNwbGl0JTNBJTIwdHJhaW4lMEElMjAlMjAlMjAlMjBwYXRoJTNBJTBBJTIwJTIwJTIwJTIwLSUyMCUyMmRhdGElMkZhYmMuY3N2JTIyJTBBJTIwJTIwJTIwJTIwLSUyMCUyMmRhdGElMkZkZWYuY3N2JTIyJTBBJTIwJTIwLSUyMHNwbGl0JTNBJTIwdGVzdCUwQSUyMCUyMCUyMCUyMHBhdGglM0ElMjAlMjJob2xkb3V0JTJGZ2hpLmNzdiUyMiUwQS0tLQ==",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">configs:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">default</span>
  <span class="hljs-attr">data_files:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">split:</span> <span class="hljs-string">train</span>
    <span class="hljs-attr">path:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">&quot;data/abc.csv&quot;</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">&quot;data/def.csv&quot;</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">split:</span> <span class="hljs-string">test</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">&quot;holdout/ghi.csv&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),N=new b({props:{code:"LS0tJTBBY29uZmlncyUzQSUwQS0lMjBjb25maWdfbmFtZSUzQSUyMGRlZmF1bHQlMEElMjAlMjBkYXRhX2ZpbGVzJTNBJTBBJTIwJTIwLSUyMHNwbGl0JTNBJTIwdHJhaW4lMEElMjAlMjAlMjAlMjBwYXRoJTNBJTIwJTIyZGF0YSUyRiouY3N2JTIyJTBBJTIwJTIwLSUyMHNwbGl0JTNBJTIwdGVzdCUwQSUyMCUyMCUyMCUyMHBhdGglM0ElMjAlMjJob2xkb3V0JTJGKi5jc3YlMjIlMEEtLS0=",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">configs:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">default</span>
  <span class="hljs-attr">data_files:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">split:</span> <span class="hljs-string">train</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">&quot;data/*.csv&quot;</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">split:</span> <span class="hljs-string">test</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">&quot;holdout/*.csv&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),g=new Rs({props:{warning:!0,$$slots:{default:[Os]},$$scope:{ctx:D}}}),L=new Bs({props:{title:"Multiple Subsets",local:"multiple-subsets",headingTag:"h2"}}),R=new b({props:{code:"bXlfZGF0YXNldF9yZXBvc2l0b3J5JTJGJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwUkVBRE1FLm1kJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwbWFpbl9kYXRhLmNzdiUwQSVFMiU5NCU5NCVFMiU5NCU4MCVFMiU5NCU4MCUyMGFkZGl0aW9uYWxfZGF0YS5jc3Y=",highlighted:`my_dataset_repository/
├── README.md
├── main_data.<span class="hljs-built_in">csv</span>
└── additional_data.<span class="hljs-built_in">csv</span>`,wrap:!1}}),H=new b({props:{code:"LS0tJTBBY29uZmlncyUzQSUwQS0lMjBjb25maWdfbmFtZSUzQSUyMG1haW5fZGF0YSUwQSUyMCUyMGRhdGFfZmlsZXMlM0ElMjAlMjJtYWluX2RhdGEuY3N2JTIyJTBBLSUyMGNvbmZpZ19uYW1lJTNBJTIwYWRkaXRpb25hbF9kYXRhJTBBJTIwJTIwZGF0YV9maWxlcyUzQSUyMCUyMmFkZGl0aW9uYWxfZGF0YS5jc3YlMjIlMEEtLS0=",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">configs:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">main_data</span>
  <span class="hljs-attr">data_files:</span> <span class="hljs-string">&quot;main_data.csv&quot;</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">additional_data</span>
  <span class="hljs-attr">data_files:</span> <span class="hljs-string">&quot;additional_data.csv&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),B=new Rs({props:{$$slots:{default:[Ks]},$$scope:{ctx:D}}}),W=new Bs({props:{title:"Builder parameters",local:"builder-parameters",headingTag:"h2"}}),X=new b({props:{code:"LS0tJTBBY29uZmlncyUzQSUwQS0lMjBjb25maWdfbmFtZSUzQSUyMHRhYiUwQSUyMCUyMGRhdGFfZmlsZXMlM0ElMjAlMjJtYWluX2RhdGEuY3N2JTIyJTBBJTIwJTIwc2VwJTNBJTIwJTIyJTVDdCUyMiUwQS0lMjBjb25maWdfbmFtZSUzQSUyMGNvbW1hJTBBJTIwJTIwZGF0YV9maWxlcyUzQSUyMCUyMmFkZGl0aW9uYWxfZGF0YS5jc3YlMjIlMEElMjAlMjBzZXAlM0ElMjAlMjIlMkMlMjIlMEEtLS0=",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">configs:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">tab</span>
  <span class="hljs-attr">data_files:</span> <span class="hljs-string">&quot;main_data.csv&quot;</span>
  <span class="hljs-attr">sep:</span> <span class="hljs-string">&quot;\\t&quot;</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">config_name:</span> <span class="hljs-string">comma</span>
  <span class="hljs-attr">data_files:</span> <span class="hljs-string">&quot;additional_data.csv&quot;</span>
  <span class="hljs-attr">sep:</span> <span class="hljs-string">&quot;,&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),P=new Ds({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-manual-configuration.md"}}),{c(){p=u("meta"),$=e(),f=u("p"),d=e(),h(U.$$.fragment),w=e(),y=u("p"),y.innerHTML=C,i=e(),j=u("p"),j.innerHTML=Cs,K=e(),v=u("p"),v.textContent=vs,ss=e(),h(_.$$.fragment),ts=e(),I=u("p"),I.textContent=_s,as=e(),S=u("p"),S.textContent=Is,ls=e(),h(Y.$$.fragment),es=e(),k=u("p"),k.innerHTML=Ss,ns=e(),h(G.$$.fragment),ps=e(),E=u("p"),E.textContent=Ys,is=e(),h(Z.$$.fragment),us=e(),h(F.$$.fragment),cs=e(),x=u("p"),x.textContent=ks,fs=e(),h(N.$$.fragment),hs=e(),h(g.$$.fragment),rs=e(),h(L.$$.fragment),os=e(),Q=u("p"),Q.textContent=Gs,ms=e(),A=u("p"),A.innerHTML=Es,Ts=e(),h(R.$$.fragment),Js=e(),h(H.$$.fragment),Ms=e(),q=u("p"),q.textContent=Zs,ds=e(),h(B.$$.fragment),js=e(),h(W.$$.fragment),Us=e(),V=u("p"),V.innerHTML=Fs,ws=e(),h(X.$$.fragment),$s=e(),z=u("p"),z.innerHTML=xs,ys=e(),h(P.$$.fragment),bs=e(),O=u("p"),this.h()},l(s){const t=zs("svelte-u9bgzb",document.head);p=c(t,"META",{name:!0,content:!0}),t.forEach(a),$=n(s),f=c(s,"P",{}),Qs(f).forEach(a),d=n(s),r(U.$$.fragment,s),w=n(s),y=c(s,"P",{"data-svelte-h":!0}),M(y)!=="svelte-1q3c0th"&&(y.innerHTML=C),i=n(s),j=c(s,"P",{"data-svelte-h":!0}),M(j)!=="svelte-1xcb7x0"&&(j.innerHTML=Cs),K=n(s),v=c(s,"P",{"data-svelte-h":!0}),M(v)!=="svelte-6g0pn6"&&(v.textContent=vs),ss=n(s),r(_.$$.fragment,s),ts=n(s),I=c(s,"P",{"data-svelte-h":!0}),M(I)!=="svelte-icvatv"&&(I.textContent=_s),as=n(s),S=c(s,"P",{"data-svelte-h":!0}),M(S)!=="svelte-1rjh5y0"&&(S.textContent=Is),ls=n(s),r(Y.$$.fragment,s),es=n(s),k=c(s,"P",{"data-svelte-h":!0}),M(k)!=="svelte-3ppi17"&&(k.innerHTML=Ss),ns=n(s),r(G.$$.fragment,s),ps=n(s),E=c(s,"P",{"data-svelte-h":!0}),M(E)!=="svelte-140lv3h"&&(E.textContent=Ys),is=n(s),r(Z.$$.fragment,s),us=n(s),r(F.$$.fragment,s),cs=n(s),x=c(s,"P",{"data-svelte-h":!0}),M(x)!=="svelte-1qp9grc"&&(x.textContent=ks),fs=n(s),r(N.$$.fragment,s),hs=n(s),r(g.$$.fragment,s),rs=n(s),r(L.$$.fragment,s),os=n(s),Q=c(s,"P",{"data-svelte-h":!0}),M(Q)!=="svelte-1rzn8an"&&(Q.textContent=Gs),ms=n(s),A=c(s,"P",{"data-svelte-h":!0}),M(A)!=="svelte-34e7ze"&&(A.innerHTML=Es),Ts=n(s),r(R.$$.fragment,s),Js=n(s),r(H.$$.fragment,s),Ms=n(s),q=c(s,"P",{"data-svelte-h":!0}),M(q)!=="svelte-1kezca"&&(q.textContent=Zs),ds=n(s),r(B.$$.fragment,s),js=n(s),r(W.$$.fragment,s),Us=n(s),V=c(s,"P",{"data-svelte-h":!0}),M(V)!=="svelte-1eghtvy"&&(V.innerHTML=Fs),ws=n(s),r(X.$$.fragment,s),$s=n(s),z=c(s,"P",{"data-svelte-h":!0}),M(z)!=="svelte-1ak1ty0"&&(z.innerHTML=xs),ys=n(s),r(P.$$.fragment,s),bs=n(s),O=c(s,"P",{}),Qs(O).forEach(a),this.h()},h(){As(p,"name","hf:doc:metadata"),As(p,"content",tt)},m(s,t){Ps(document.head,p),l(s,$,t),l(s,f,t),l(s,d,t),o(U,s,t),l(s,w,t),l(s,y,t),l(s,i,t),l(s,j,t),l(s,K,t),l(s,v,t),l(s,ss,t),o(_,s,t),l(s,ts,t),l(s,I,t),l(s,as,t),l(s,S,t),l(s,ls,t),o(Y,s,t),l(s,es,t),l(s,k,t),l(s,ns,t),o(G,s,t),l(s,ps,t),l(s,E,t),l(s,is,t),o(Z,s,t),l(s,us,t),o(F,s,t),l(s,cs,t),l(s,x,t),l(s,fs,t),o(N,s,t),l(s,hs,t),o(g,s,t),l(s,rs,t),o(L,s,t),l(s,os,t),l(s,Q,t),l(s,ms,t),l(s,A,t),l(s,Ts,t),o(R,s,t),l(s,Js,t),o(H,s,t),l(s,Ms,t),l(s,q,t),l(s,ds,t),o(B,s,t),l(s,js,t),o(W,s,t),l(s,Us,t),l(s,V,t),l(s,ws,t),o(X,s,t),l(s,$s,t),l(s,z,t),l(s,ys,t),o(P,s,t),l(s,bs,t),l(s,O,t),gs=!0},p(s,[t]){const Ns={};t&2&&(Ns.$$scope={dirty:t,ctx:s}),g.$set(Ns);const Ls={};t&2&&(Ls.$$scope={dirty:t,ctx:s}),B.$set(Ls)},i(s){gs||(m(U.$$.fragment,s),m(_.$$.fragment,s),m(Y.$$.fragment,s),m(G.$$.fragment,s),m(Z.$$.fragment,s),m(F.$$.fragment,s),m(N.$$.fragment,s),m(g.$$.fragment,s),m(L.$$.fragment,s),m(R.$$.fragment,s),m(H.$$.fragment,s),m(B.$$.fragment,s),m(W.$$.fragment,s),m(X.$$.fragment,s),m(P.$$.fragment,s),gs=!0)},o(s){T(U.$$.fragment,s),T(_.$$.fragment,s),T(Y.$$.fragment,s),T(G.$$.fragment,s),T(Z.$$.fragment,s),T(F.$$.fragment,s),T(N.$$.fragment,s),T(g.$$.fragment,s),T(L.$$.fragment,s),T(R.$$.fragment,s),T(H.$$.fragment,s),T(B.$$.fragment,s),T(W.$$.fragment,s),T(X.$$.fragment,s),T(P.$$.fragment,s),gs=!1},d(s){s&&(a($),a(f),a(d),a(w),a(y),a(i),a(j),a(K),a(v),a(ss),a(ts),a(I),a(as),a(S),a(ls),a(es),a(k),a(ns),a(ps),a(E),a(is),a(us),a(cs),a(x),a(fs),a(hs),a(rs),a(os),a(Q),a(ms),a(A),a(Ts),a(Js),a(Ms),a(q),a(ds),a(js),a(Us),a(V),a(ws),a($s),a(z),a(ys),a(bs),a(O)),a(p),J(U,s),J(_,s),J(Y,s),J(G,s),J(Z,s),J(F,s),J(N,s),J(g,s),J(L,s),J(R,s),J(H,s),J(B,s),J(W,s),J(X,s),J(P,s)}}}const tt='{"title":"Manual Configuration","local":"manual-configuration","sections":[{"title":"Splits","local":"splits","sections":[],"depth":2},{"title":"Multiple Subsets","local":"multiple-subsets","sections":[],"depth":2},{"title":"Builder parameters","local":"builder-parameters","sections":[],"depth":2}],"depth":1}';function at(D){return Ws(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ut extends Vs{constructor(p){super(),Xs(this,p,at,st,qs,{})}}export{ut as component};
