import{s as $e,n as _e,o as ke}from"../chunks/scheduler.d6170356.js";import{S as Ce,i as He,g as n,s as i,r as q,A as Le,h as r,f as o,c as s,j as xe,u as z,x as l,k as Te,y as Pe,a,v as F,d as B,t as W,w as j}from"../chunks/index.fcd4cc08.js";import{H as se,E as Me}from"../chunks/EditOnGithub.da2b595c.js";function qe(ne){let d,E,P,G,u,I,h,re=`There are some limitations to be aware of when dealing with a large amount of data in your repo. Given the time it takes to stream the data,
getting an upload/push to fail at the end of the process or encountering a degraded experience, be it on hf.co or when working locally, can be very annoying.`,R,f,A,m,le='We gathered a list of tips and recommendations for structuring your repo. If you are looking for more practical tips, check out <a href="https://huggingface.co/docs/huggingface_hub/main/en/guides/upload#tips-and-tricks-for-large-uploads" rel="nofollow">this guide</a> on how to upload large amount of data using the Python library.',S,c,de="<thead><tr><th>Characteristic</th> <th>Recommended</th> <th>Tips</th></tr></thead> <tbody><tr><td>Repo size</td> <td>-</td> <td>contact us for large repos (TBs of data)</td></tr> <tr><td>Files per repo</td> <td>&lt;100k</td> <td>merge data into fewer files</td></tr> <tr><td>Entries per folder</td> <td>&lt;10k</td> <td>use subdirectories in repo</td></tr> <tr><td>File size</td> <td>&lt;5GB</td> <td>split data into chunked files</td></tr> <tr><td>Commit size</td> <td>&lt;100 files*</td> <td>upload files in multiple commits</td></tr> <tr><td>Commits per repo</td> <td>-</td> <td>upload multiple files per commit and/or squash history</td></tr></tbody>",U,p,ue="<em>* Not relevant when using <code>git</code> CLI directly</em>",D,g,he="Please read the next section to understand better those limits and how to deal with them.",N,w,O,y,fe=`What are we talking about when we say “large uploads”, and what are their associated limitations? Large uploads can be
very diverse, from repositories with a few huge files (e.g. model weights) to repositories with thousands of small files
(e.g. an image dataset).`,Y,b,me=`Under the hood, the Hub uses Git to version the data, which has structural implications on what you can do in your repo.
If your repo is crossing some of the numbers mentioned in the previous section, <strong>we strongly encourage you to check out <a href="https://github.com/github/git-sizer" rel="nofollow"><code>git-sizer</code></a></strong>,
which has very detailed documentation about the different factors that will impact your experience. Here is a TL;DR of factors to consider:`,J,v,ce=`<li><strong>Repository size</strong>: The total size of the data you’re planning to upload. We generally support repositories up to 300GB. If you would like to upload more than 300 GBs (or even TBs) of data, you will need to ask us to grant more storage. Please provide details of your project. You can contact us at <a href="mailto:datasets@huggingface.co">datasets@huggingface.co</a> or on <a href="http://hf.co/join/discord" rel="nofollow">our Discord</a>.</li> <li><strong>Number of files</strong>:<ul><li>For optimal experience, we recommend keeping the total number of files under 100k. Try merging the data into fewer files if you have more.
For example, json files can be merged into a single jsonl file, or large datasets can be exported as Parquet files or in <a href="https://github.com/webdataset/webdataset" rel="nofollow">WebDataset</a> format.</li> <li>The maximum number of files per folder cannot exceed 10k files per folder. A simple solution is to
create a repository structure that uses subdirectories. For example, a repo with 1k folders from <code>000/</code> to <code>999/</code>, each containing at most 1000 files, is already enough.</li></ul></li> <li><strong>File size</strong>: In the case of uploading large files (e.g. model weights), we strongly recommend splitting them <strong>into chunks of around 5GB each</strong>.
There are a few reasons for this:<ul><li>Uploading and downloading smaller files is much easier both for you and the other users. Connection issues can always
happen when streaming data and smaller files avoid resuming from the beginning in case of errors.</li> <li>Files are served to the users using CloudFront. From our experience, huge files are not cached by this service
leading to a slower download speed.
In all cases no single LFS file will be able to be &gt;50GB. I.e. 50GB is the hard limit for single file size.</li></ul></li> <li><strong>Number of commits</strong>: There is no hard limit for the total number of commits on your repo history. However, from
our experience, the user experience on the Hub starts to degrade after a few thousand commits. We are constantly working to
improve the service, but one must always remember that a git repository is not meant to work as a database with a lot of
writes. If your repo’s history gets very large, it is always possible to squash all the commits to get a
fresh start using <code>huggingface_hub</code>’s <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.super_squash_history" rel="nofollow"><code>super_squash_history</code></a>. Be aware that this is a non-revertible operation.</li> <li><strong>Number of operations per commit</strong>: Once again, there is no hard limit here. When a commit is uploaded on the Hub, each
git operation (addition or delete) is checked by the server. When a hundred LFS files are committed at once,
each file is checked individually to ensure it’s been correctly uploaded. When pushing data through HTTP,
a timeout of 60s is set on the request, meaning that if the process takes more time, an error is raised. However, it can
happen (in rare cases) that even if the timeout is raised client-side, the process is still
completed server-side. This can be checked manually by browsing the repo on the Hub. To prevent this timeout, we recommend
adding around 50-100 files per commit.</li>`,K,x,Q,T,pe='One key way in which Hugging Face supports the machine learning ecosystem is by hosting datasets on the Hub, including very large datasets. To ensure we can effectively support the open-source ecosystem, we ask that you let us know in advance via datasets at huggingface.co or on <a href="http://hf.co/join/discord" rel="nofollow">our Discord</a> if you are uploading datasets above a couple of hundred GBs or TBs of data.',V,$,ge="When you get in touch with us, please let us know:",X,_,we="<li>What is the dataset, and who/what is it likely to be useful for?</li> <li>The size of the dataset.</li> <li>The format you plan to use for sharing your dataset.</li>",Z,k,ye="For hosting large datasets on the Hub, we require the following for your dataset:",ee,C,be='<li>A dataset card: we want to ensure that your dataset can be used effectively by the community and one of the key ways of enabling this is via a dataset card. This <a href="docs/hub/datasets-cards.md">guidance</a> provides an overview of how to write a dataset card.</li> <li>You are sharing the dataset to enable community reuse. If you plan to upload a dataset you anticipate won’t have any further reuse, other platforms are likely more suitable.</li> <li>You must follow the repository limitations outlined above.</li> <li>Using file formats that are well integrated with the Hugging Face ecosystem. We have good support for <a href="https://huggingface.co/docs/datasets/v2.19.0/en/loading#parquet" rel="nofollow">Parquet</a> and <a href="https://huggingface.co/docs/datasets/v2.19.0/en/loading#webdataset" rel="nofollow">WebDataset</a> formats, which are often good options for sharing large datasets efficiently. This will also ensure the dataset viewer works for your dataset.</li> <li>Avoid the use of custom loading scripts when using datasets. In our experience, datasets that require custom code to use often end up with limited reuse.</li>',te,H,ve="Please get in touch with us if any of these requirements are difficult for you to meet because of the type of data or domain you are working in.",oe,L,ae,M,ie;return u=new se({props:{title:"Repository limitations and recommendations",local:"repository-limitations-and-recommendations",headingTag:"h1"}}),f=new se({props:{title:"Recommendations",local:"recommendations",headingTag:"h2"}}),w=new se({props:{title:"Explanations",local:"explanations",headingTag:"h2"}}),x=new se({props:{title:"Sharing large datasets on the Hub",local:"sharing-large-datasets-on-the-hub",headingTag:"h2"}}),L=new Me({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/repositories-recommendations.md"}}),{c(){d=n("meta"),E=i(),P=n("p"),G=i(),q(u.$$.fragment),I=i(),h=n("p"),h.textContent=re,R=i(),q(f.$$.fragment),A=i(),m=n("p"),m.innerHTML=le,S=i(),c=n("table"),c.innerHTML=de,U=i(),p=n("p"),p.innerHTML=ue,D=i(),g=n("p"),g.textContent=he,N=i(),q(w.$$.fragment),O=i(),y=n("p"),y.textContent=fe,Y=i(),b=n("p"),b.innerHTML=me,J=i(),v=n("ul"),v.innerHTML=ce,K=i(),q(x.$$.fragment),Q=i(),T=n("p"),T.innerHTML=pe,V=i(),$=n("p"),$.textContent=ge,X=i(),_=n("ul"),_.innerHTML=we,Z=i(),k=n("p"),k.textContent=ye,ee=i(),C=n("ul"),C.innerHTML=be,te=i(),H=n("p"),H.textContent=ve,oe=i(),q(L.$$.fragment),ae=i(),M=n("p"),this.h()},l(e){const t=Le("svelte-u9bgzb",document.head);d=r(t,"META",{name:!0,content:!0}),t.forEach(o),E=s(e),P=r(e,"P",{}),xe(P).forEach(o),G=s(e),z(u.$$.fragment,e),I=s(e),h=r(e,"P",{"data-svelte-h":!0}),l(h)!=="svelte-xzslhr"&&(h.textContent=re),R=s(e),z(f.$$.fragment,e),A=s(e),m=r(e,"P",{"data-svelte-h":!0}),l(m)!=="svelte-1lth8r8"&&(m.innerHTML=le),S=s(e),c=r(e,"TABLE",{"data-svelte-h":!0}),l(c)!=="svelte-r54kgd"&&(c.innerHTML=de),U=s(e),p=r(e,"P",{"data-svelte-h":!0}),l(p)!=="svelte-1kqloz8"&&(p.innerHTML=ue),D=s(e),g=r(e,"P",{"data-svelte-h":!0}),l(g)!=="svelte-4yld6t"&&(g.textContent=he),N=s(e),z(w.$$.fragment,e),O=s(e),y=r(e,"P",{"data-svelte-h":!0}),l(y)!=="svelte-ojgmzx"&&(y.textContent=fe),Y=s(e),b=r(e,"P",{"data-svelte-h":!0}),l(b)!=="svelte-1sfy0e"&&(b.innerHTML=me),J=s(e),v=r(e,"UL",{"data-svelte-h":!0}),l(v)!=="svelte-1wj3bjd"&&(v.innerHTML=ce),K=s(e),z(x.$$.fragment,e),Q=s(e),T=r(e,"P",{"data-svelte-h":!0}),l(T)!=="svelte-vnk15e"&&(T.innerHTML=pe),V=s(e),$=r(e,"P",{"data-svelte-h":!0}),l($)!=="svelte-19o549b"&&($.textContent=ge),X=s(e),_=r(e,"UL",{"data-svelte-h":!0}),l(_)!=="svelte-198ryst"&&(_.innerHTML=we),Z=s(e),k=r(e,"P",{"data-svelte-h":!0}),l(k)!=="svelte-7ilaqr"&&(k.textContent=ye),ee=s(e),C=r(e,"UL",{"data-svelte-h":!0}),l(C)!=="svelte-1gjhq28"&&(C.innerHTML=be),te=s(e),H=r(e,"P",{"data-svelte-h":!0}),l(H)!=="svelte-124ey02"&&(H.textContent=ve),oe=s(e),z(L.$$.fragment,e),ae=s(e),M=r(e,"P",{}),xe(M).forEach(o),this.h()},h(){Te(d,"name","hf:doc:metadata"),Te(d,"content",ze)},m(e,t){Pe(document.head,d),a(e,E,t),a(e,P,t),a(e,G,t),F(u,e,t),a(e,I,t),a(e,h,t),a(e,R,t),F(f,e,t),a(e,A,t),a(e,m,t),a(e,S,t),a(e,c,t),a(e,U,t),a(e,p,t),a(e,D,t),a(e,g,t),a(e,N,t),F(w,e,t),a(e,O,t),a(e,y,t),a(e,Y,t),a(e,b,t),a(e,J,t),a(e,v,t),a(e,K,t),F(x,e,t),a(e,Q,t),a(e,T,t),a(e,V,t),a(e,$,t),a(e,X,t),a(e,_,t),a(e,Z,t),a(e,k,t),a(e,ee,t),a(e,C,t),a(e,te,t),a(e,H,t),a(e,oe,t),F(L,e,t),a(e,ae,t),a(e,M,t),ie=!0},p:_e,i(e){ie||(B(u.$$.fragment,e),B(f.$$.fragment,e),B(w.$$.fragment,e),B(x.$$.fragment,e),B(L.$$.fragment,e),ie=!0)},o(e){W(u.$$.fragment,e),W(f.$$.fragment,e),W(w.$$.fragment,e),W(x.$$.fragment,e),W(L.$$.fragment,e),ie=!1},d(e){e&&(o(E),o(P),o(G),o(I),o(h),o(R),o(A),o(m),o(S),o(c),o(U),o(p),o(D),o(g),o(N),o(O),o(y),o(Y),o(b),o(J),o(v),o(K),o(Q),o(T),o(V),o($),o(X),o(_),o(Z),o(k),o(ee),o(C),o(te),o(H),o(oe),o(ae),o(M)),o(d),j(u,e),j(f,e),j(w,e),j(x,e),j(L,e)}}}const ze='{"title":"Repository limitations and recommendations","local":"repository-limitations-and-recommendations","sections":[{"title":"Recommendations","local":"recommendations","sections":[],"depth":2},{"title":"Explanations","local":"explanations","sections":[],"depth":2},{"title":"Sharing large datasets on the Hub","local":"sharing-large-datasets-on-the-hub","sections":[],"depth":2}],"depth":1}';function Fe(ne){return ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ee extends Ce{constructor(d){super(),He(this,d,Fe,qe,$e,{})}}export{Ee as component};
