import{s as Ce,n as He,o as Le}from"../chunks/scheduler.d6170356.js";import{S as Pe,i as Me,g as n,s as a,r as z,A as qe,h as r,f as o,c as s,j as Te,u as F,x as l,k as ke,y as ze,a as i,v as W,d as B,t as I,w as E}from"../chunks/index.fcd4cc08.js";import{H as re,E as Fe}from"../chunks/EditOnGithub.da2b595c.js";function We(le){let d,G,M,R,u,j,h,de=`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.`,A,m,S,f,ue='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.',U,p,he="<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;20GB</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>",D,c,me="<em>* Not relevant when using <code>git</code> CLI directly</em>",N,g,fe="Please read the next section to understand better those limits and how to deal with them.",O,w,Y,y,pe=`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).`,J,b,ce=`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:`,K,v,ge=`<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 20GB 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>`,Q,x,V,$,we="One key way Hugging Face supports the machine learning ecosystem is by hosting datasets on the Hub, including very large ones. However, if your dataset is bigger than 300GB, you will need to ask us to grant more storage.",X,_,ye='In this case, to ensure we can effectively support the open-source ecosystem, we require you to let us know via <a href="mailto:datasets@huggingface.co">datasets@huggingface.co</a>.',Z,T,be="When you get in touch with us, please let us know:",ee,k,ve="<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>",te,C,xe="For hosting large datasets on the Hub, we require the following for your dataset:",oe,H,$e='<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="./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>',ie,L,_e="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.",ae,P,se,q,ne;return u=new re({props:{title:"Repository limitations and recommendations",local:"repository-limitations-and-recommendations",headingTag:"h1"}}),m=new re({props:{title:"Recommendations",local:"recommendations",headingTag:"h2"}}),w=new re({props:{title:"Explanations",local:"explanations",headingTag:"h2"}}),x=new re({props:{title:"Sharing large datasets on the Hub",local:"sharing-large-datasets-on-the-hub",headingTag:"h2"}}),P=new Fe({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/repositories-recommendations.md"}}),{c(){d=n("meta"),G=a(),M=n("p"),R=a(),z(u.$$.fragment),j=a(),h=n("p"),h.textContent=de,A=a(),z(m.$$.fragment),S=a(),f=n("p"),f.innerHTML=ue,U=a(),p=n("table"),p.innerHTML=he,D=a(),c=n("p"),c.innerHTML=me,N=a(),g=n("p"),g.textContent=fe,O=a(),z(w.$$.fragment),Y=a(),y=n("p"),y.textContent=pe,J=a(),b=n("p"),b.innerHTML=ce,K=a(),v=n("ul"),v.innerHTML=ge,Q=a(),z(x.$$.fragment),V=a(),$=n("p"),$.textContent=we,X=a(),_=n("p"),_.innerHTML=ye,Z=a(),T=n("p"),T.textContent=be,ee=a(),k=n("ul"),k.innerHTML=ve,te=a(),C=n("p"),C.textContent=xe,oe=a(),H=n("ul"),H.innerHTML=$e,ie=a(),L=n("p"),L.textContent=_e,ae=a(),z(P.$$.fragment),se=a(),q=n("p"),this.h()},l(e){const t=qe("svelte-u9bgzb",document.head);d=r(t,"META",{name:!0,content:!0}),t.forEach(o),G=s(e),M=r(e,"P",{}),Te(M).forEach(o),R=s(e),F(u.$$.fragment,e),j=s(e),h=r(e,"P",{"data-svelte-h":!0}),l(h)!=="svelte-xzslhr"&&(h.textContent=de),A=s(e),F(m.$$.fragment,e),S=s(e),f=r(e,"P",{"data-svelte-h":!0}),l(f)!=="svelte-1lth8r8"&&(f.innerHTML=ue),U=s(e),p=r(e,"TABLE",{"data-svelte-h":!0}),l(p)!=="svelte-1tj7sge"&&(p.innerHTML=he),D=s(e),c=r(e,"P",{"data-svelte-h":!0}),l(c)!=="svelte-1kqloz8"&&(c.innerHTML=me),N=s(e),g=r(e,"P",{"data-svelte-h":!0}),l(g)!=="svelte-4yld6t"&&(g.textContent=fe),O=s(e),F(w.$$.fragment,e),Y=s(e),y=r(e,"P",{"data-svelte-h":!0}),l(y)!=="svelte-ojgmzx"&&(y.textContent=pe),J=s(e),b=r(e,"P",{"data-svelte-h":!0}),l(b)!=="svelte-1sfy0e"&&(b.innerHTML=ce),K=s(e),v=r(e,"UL",{"data-svelte-h":!0}),l(v)!=="svelte-ec8k8c"&&(v.innerHTML=ge),Q=s(e),F(x.$$.fragment,e),V=s(e),$=r(e,"P",{"data-svelte-h":!0}),l($)!=="svelte-1sotakv"&&($.textContent=we),X=s(e),_=r(e,"P",{"data-svelte-h":!0}),l(_)!=="svelte-1mp2cp6"&&(_.innerHTML=ye),Z=s(e),T=r(e,"P",{"data-svelte-h":!0}),l(T)!=="svelte-19o549b"&&(T.textContent=be),ee=s(e),k=r(e,"UL",{"data-svelte-h":!0}),l(k)!=="svelte-198ryst"&&(k.innerHTML=ve),te=s(e),C=r(e,"P",{"data-svelte-h":!0}),l(C)!=="svelte-7ilaqr"&&(C.textContent=xe),oe=s(e),H=r(e,"UL",{"data-svelte-h":!0}),l(H)!=="svelte-1o54rjz"&&(H.innerHTML=$e),ie=s(e),L=r(e,"P",{"data-svelte-h":!0}),l(L)!=="svelte-124ey02"&&(L.textContent=_e),ae=s(e),F(P.$$.fragment,e),se=s(e),q=r(e,"P",{}),Te(q).forEach(o),this.h()},h(){ke(d,"name","hf:doc:metadata"),ke(d,"content",Be)},m(e,t){ze(document.head,d),i(e,G,t),i(e,M,t),i(e,R,t),W(u,e,t),i(e,j,t),i(e,h,t),i(e,A,t),W(m,e,t),i(e,S,t),i(e,f,t),i(e,U,t),i(e,p,t),i(e,D,t),i(e,c,t),i(e,N,t),i(e,g,t),i(e,O,t),W(w,e,t),i(e,Y,t),i(e,y,t),i(e,J,t),i(e,b,t),i(e,K,t),i(e,v,t),i(e,Q,t),W(x,e,t),i(e,V,t),i(e,$,t),i(e,X,t),i(e,_,t),i(e,Z,t),i(e,T,t),i(e,ee,t),i(e,k,t),i(e,te,t),i(e,C,t),i(e,oe,t),i(e,H,t),i(e,ie,t),i(e,L,t),i(e,ae,t),W(P,e,t),i(e,se,t),i(e,q,t),ne=!0},p:He,i(e){ne||(B(u.$$.fragment,e),B(m.$$.fragment,e),B(w.$$.fragment,e),B(x.$$.fragment,e),B(P.$$.fragment,e),ne=!0)},o(e){I(u.$$.fragment,e),I(m.$$.fragment,e),I(w.$$.fragment,e),I(x.$$.fragment,e),I(P.$$.fragment,e),ne=!1},d(e){e&&(o(G),o(M),o(R),o(j),o(h),o(A),o(S),o(f),o(U),o(p),o(D),o(c),o(N),o(g),o(O),o(Y),o(y),o(J),o(b),o(K),o(v),o(Q),o(V),o($),o(X),o(_),o(Z),o(T),o(ee),o(k),o(te),o(C),o(oe),o(H),o(ie),o(L),o(ae),o(se),o(q)),o(d),E(u,e),E(m,e),E(w,e),E(x,e),E(P,e)}}}const Be='{"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 Ie(le){return Le(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class je extends Pe{constructor(d){super(),Me(this,d,Ie,We,Ce,{})}}export{je as component};
