import{s as As,o as Rs,n as Qs}from"../chunks/scheduler.d6170356.js";import{S as Hs,i as qs,g as u,s as e,r,A as Ws,h as c,f as a,c as n,j as Ns,u as h,x as M,k as xs,y as Vs,a as l,v as o,d as m,t as T,w as J}from"../chunks/index.fcd4cc08.js";import{T as Ls}from"../chunks/Tip.b09c67cf.js";import{C as g}from"../chunks/CodeBlock.7b16bdef.js";import{H as gs,E as Xs}from"../chunks/EditOnGithub.da2b595c.js";function zs(P){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:Qs,d(f){f&&a(p)}}}function Ps(P){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 g({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(),r(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),h(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:Qs,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 Ds(P){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,bs='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.',O,_,Bs="It is also possible to define multiple subsets (also called “configurations”) for the same dataset (e.g. if the dataset has various independent files).",K,I,ss,v,Cs="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.",ts,S,_s="For example, given a repository like this one:",as,Y,ls,k,Is="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:",es,G,ns,E,vs="You can select multiple files per split using a list of paths:",ps,Z,is,F,us,N,Ss="Or you can use glob patterns to automatically list all the files you need:",cs,x,fs,b,rs,L,hs,Q,Ys=`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.`,os,A,ks="In that case you can define a list of subsets inside the <code>configs</code> field in YAML:",ms,R,Ts,H,Js,B,Ms,q,ds,W,Gs="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:",js,V,Us,X,Es='Refer to the <a href="/docs/datasets/package_reference/builder_classes">specific builders’ documentation</a> to see what parameters they have.',ws,z,$s,D,ys;return U=new gs({props:{title:"Manual Configuration",local:"manual-configuration",headingTag:"h1"}}),I=new gs({props:{title:"Splits",local:"splits",headingTag:"h2"}}),Y=new g({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 g({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 g({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 g({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}}),x=new g({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}}),b=new Ls({props:{warning:!0,$$slots:{default:[zs]},$$scope:{ctx:P}}}),L=new gs({props:{title:"Multiple Subsets",local:"multiple-subsets",headingTag:"h2"}}),R=new g({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 g({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 Ls({props:{$$slots:{default:[Ps]},$$scope:{ctx:P}}}),q=new gs({props:{title:"Builder parameters",local:"builder-parameters",headingTag:"h2"}}),V=new g({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}}),z=new Xs({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(),r(U.$$.fragment),w=e(),y=u("p"),y.innerHTML=C,i=e(),j=u("p"),j.innerHTML=bs,O=e(),_=u("p"),_.textContent=Bs,K=e(),r(I.$$.fragment),ss=e(),v=u("p"),v.textContent=Cs,ts=e(),S=u("p"),S.textContent=_s,as=e(),r(Y.$$.fragment),ls=e(),k=u("p"),k.innerHTML=Is,es=e(),r(G.$$.fragment),ns=e(),E=u("p"),E.textContent=vs,ps=e(),r(Z.$$.fragment),is=e(),r(F.$$.fragment),us=e(),N=u("p"),N.textContent=Ss,cs=e(),r(x.$$.fragment),fs=e(),r(b.$$.fragment),rs=e(),r(L.$$.fragment),hs=e(),Q=u("p"),Q.textContent=Ys,os=e(),A=u("p"),A.innerHTML=ks,ms=e(),r(R.$$.fragment),Ts=e(),r(H.$$.fragment),Js=e(),r(B.$$.fragment),Ms=e(),r(q.$$.fragment),ds=e(),W=u("p"),W.innerHTML=Gs,js=e(),r(V.$$.fragment),Us=e(),X=u("p"),X.innerHTML=Es,ws=e(),r(z.$$.fragment),$s=e(),D=u("p"),this.h()},l(s){const t=Ws("svelte-u9bgzb",document.head);p=c(t,"META",{name:!0,content:!0}),t.forEach(a),$=n(s),f=c(s,"P",{}),Ns(f).forEach(a),d=n(s),h(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=bs),O=n(s),_=c(s,"P",{"data-svelte-h":!0}),M(_)!=="svelte-6g0pn6"&&(_.textContent=Bs),K=n(s),h(I.$$.fragment,s),ss=n(s),v=c(s,"P",{"data-svelte-h":!0}),M(v)!=="svelte-icvatv"&&(v.textContent=Cs),ts=n(s),S=c(s,"P",{"data-svelte-h":!0}),M(S)!=="svelte-1rjh5y0"&&(S.textContent=_s),as=n(s),h(Y.$$.fragment,s),ls=n(s),k=c(s,"P",{"data-svelte-h":!0}),M(k)!=="svelte-3ppi17"&&(k.innerHTML=Is),es=n(s),h(G.$$.fragment,s),ns=n(s),E=c(s,"P",{"data-svelte-h":!0}),M(E)!=="svelte-140lv3h"&&(E.textContent=vs),ps=n(s),h(Z.$$.fragment,s),is=n(s),h(F.$$.fragment,s),us=n(s),N=c(s,"P",{"data-svelte-h":!0}),M(N)!=="svelte-1qp9grc"&&(N.textContent=Ss),cs=n(s),h(x.$$.fragment,s),fs=n(s),h(b.$$.fragment,s),rs=n(s),h(L.$$.fragment,s),hs=n(s),Q=c(s,"P",{"data-svelte-h":!0}),M(Q)!=="svelte-1rzn8an"&&(Q.textContent=Ys),os=n(s),A=c(s,"P",{"data-svelte-h":!0}),M(A)!=="svelte-34e7ze"&&(A.innerHTML=ks),ms=n(s),h(R.$$.fragment,s),Ts=n(s),h(H.$$.fragment,s),Js=n(s),h(B.$$.fragment,s),Ms=n(s),h(q.$$.fragment,s),ds=n(s),W=c(s,"P",{"data-svelte-h":!0}),M(W)!=="svelte-1eghtvy"&&(W.innerHTML=Gs),js=n(s),h(V.$$.fragment,s),Us=n(s),X=c(s,"P",{"data-svelte-h":!0}),M(X)!=="svelte-1ak1ty0"&&(X.innerHTML=Es),ws=n(s),h(z.$$.fragment,s),$s=n(s),D=c(s,"P",{}),Ns(D).forEach(a),this.h()},h(){xs(p,"name","hf:doc:metadata"),xs(p,"content",Os)},m(s,t){Vs(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,O,t),l(s,_,t),l(s,K,t),o(I,s,t),l(s,ss,t),l(s,v,t),l(s,ts,t),l(s,S,t),l(s,as,t),o(Y,s,t),l(s,ls,t),l(s,k,t),l(s,es,t),o(G,s,t),l(s,ns,t),l(s,E,t),l(s,ps,t),o(Z,s,t),l(s,is,t),o(F,s,t),l(s,us,t),l(s,N,t),l(s,cs,t),o(x,s,t),l(s,fs,t),o(b,s,t),l(s,rs,t),o(L,s,t),l(s,hs,t),l(s,Q,t),l(s,os,t),l(s,A,t),l(s,ms,t),o(R,s,t),l(s,Ts,t),o(H,s,t),l(s,Js,t),o(B,s,t),l(s,Ms,t),o(q,s,t),l(s,ds,t),l(s,W,t),l(s,js,t),o(V,s,t),l(s,Us,t),l(s,X,t),l(s,ws,t),o(z,s,t),l(s,$s,t),l(s,D,t),ys=!0},p(s,[t]){const Zs={};t&2&&(Zs.$$scope={dirty:t,ctx:s}),b.$set(Zs);const Fs={};t&2&&(Fs.$$scope={dirty:t,ctx:s}),B.$set(Fs)},i(s){ys||(m(U.$$.fragment,s),m(I.$$.fragment,s),m(Y.$$.fragment,s),m(G.$$.fragment,s),m(Z.$$.fragment,s),m(F.$$.fragment,s),m(x.$$.fragment,s),m(b.$$.fragment,s),m(L.$$.fragment,s),m(R.$$.fragment,s),m(H.$$.fragment,s),m(B.$$.fragment,s),m(q.$$.fragment,s),m(V.$$.fragment,s),m(z.$$.fragment,s),ys=!0)},o(s){T(U.$$.fragment,s),T(I.$$.fragment,s),T(Y.$$.fragment,s),T(G.$$.fragment,s),T(Z.$$.fragment,s),T(F.$$.fragment,s),T(x.$$.fragment,s),T(b.$$.fragment,s),T(L.$$.fragment,s),T(R.$$.fragment,s),T(H.$$.fragment,s),T(B.$$.fragment,s),T(q.$$.fragment,s),T(V.$$.fragment,s),T(z.$$.fragment,s),ys=!1},d(s){s&&(a($),a(f),a(d),a(w),a(y),a(i),a(j),a(O),a(_),a(K),a(ss),a(v),a(ts),a(S),a(as),a(ls),a(k),a(es),a(ns),a(E),a(ps),a(is),a(us),a(N),a(cs),a(fs),a(rs),a(hs),a(Q),a(os),a(A),a(ms),a(Ts),a(Js),a(Ms),a(ds),a(W),a(js),a(Us),a(X),a(ws),a($s),a(D)),a(p),J(U,s),J(I,s),J(Y,s),J(G,s),J(Z,s),J(F,s),J(x,s),J(b,s),J(L,s),J(R,s),J(H,s),J(B,s),J(q,s),J(V,s),J(z,s)}}}const Os='{"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 Ks(P){return Rs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nt extends Hs{constructor(p){super(),qs(this,p,Ks,Ds,As,{})}}export{nt as component};
