import{s as te,n as oe,o as ie}from"../chunks/scheduler.d6170356.js";import{S as ae,i as se,g as n,s as a,r as G,A as ne,h as r,f as o,c as s,j as Z,u as I,x as d,k as ee,y as re,a as i,v as W,d as j,t as A,w as S}from"../chunks/index.fcd4cc08.js";import{H as N}from"../chunks/Heading.8660bd0e.js";function le(U){let l,T,x,k,h,$,u,D=`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.`,H,m,C,c,O='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.',L,p,Y="<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>",P,f,J="<em>* Not relevant when using <code>git</code> CLI directly</em>",z,g,K="Please read the next section to understand better those limits and how to deal with them.",M,w,F,y,Q=`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).`,q,b,V=`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:`,B,v,X=`<li><strong>Repository size</strong>: The total size of the data you’re planning to upload. There is no hard limit on a Hub repository size. However, if you plan to upload hundreds of GBs or even TBs of data, we would appreciate it if you could let us know in advance so we can better help you if you have any questions during the process. 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>`,R,_,E;return h=new N({props:{title:"Repository limitations and recommendations",local:"repository-limitations-and-recommendations",headingTag:"h1"}}),m=new N({props:{title:"Recommendations",local:"recommendations",headingTag:"h2"}}),w=new N({props:{title:"Explanations",local:"explanations",headingTag:"h2"}}),{c(){l=n("meta"),T=a(),x=n("p"),k=a(),G(h.$$.fragment),$=a(),u=n("p"),u.textContent=D,H=a(),G(m.$$.fragment),C=a(),c=n("p"),c.innerHTML=O,L=a(),p=n("table"),p.innerHTML=Y,P=a(),f=n("p"),f.innerHTML=J,z=a(),g=n("p"),g.textContent=K,M=a(),G(w.$$.fragment),F=a(),y=n("p"),y.textContent=Q,q=a(),b=n("p"),b.innerHTML=V,B=a(),v=n("ul"),v.innerHTML=X,R=a(),_=n("p"),this.h()},l(e){const t=ne("svelte-u9bgzb",document.head);l=r(t,"META",{name:!0,content:!0}),t.forEach(o),T=s(e),x=r(e,"P",{}),Z(x).forEach(o),k=s(e),I(h.$$.fragment,e),$=s(e),u=r(e,"P",{"data-svelte-h":!0}),d(u)!=="svelte-xzslhr"&&(u.textContent=D),H=s(e),I(m.$$.fragment,e),C=s(e),c=r(e,"P",{"data-svelte-h":!0}),d(c)!=="svelte-1lth8r8"&&(c.innerHTML=O),L=s(e),p=r(e,"TABLE",{"data-svelte-h":!0}),d(p)!=="svelte-r54kgd"&&(p.innerHTML=Y),P=s(e),f=r(e,"P",{"data-svelte-h":!0}),d(f)!=="svelte-1kqloz8"&&(f.innerHTML=J),z=s(e),g=r(e,"P",{"data-svelte-h":!0}),d(g)!=="svelte-4yld6t"&&(g.textContent=K),M=s(e),I(w.$$.fragment,e),F=s(e),y=r(e,"P",{"data-svelte-h":!0}),d(y)!=="svelte-ojgmzx"&&(y.textContent=Q),q=s(e),b=r(e,"P",{"data-svelte-h":!0}),d(b)!=="svelte-1sfy0e"&&(b.innerHTML=V),B=s(e),v=r(e,"UL",{"data-svelte-h":!0}),d(v)!=="svelte-1upeqfr"&&(v.innerHTML=X),R=s(e),_=r(e,"P",{}),Z(_).forEach(o),this.h()},h(){ee(l,"name","hf:doc:metadata"),ee(l,"content",de)},m(e,t){re(document.head,l),i(e,T,t),i(e,x,t),i(e,k,t),W(h,e,t),i(e,$,t),i(e,u,t),i(e,H,t),W(m,e,t),i(e,C,t),i(e,c,t),i(e,L,t),i(e,p,t),i(e,P,t),i(e,f,t),i(e,z,t),i(e,g,t),i(e,M,t),W(w,e,t),i(e,F,t),i(e,y,t),i(e,q,t),i(e,b,t),i(e,B,t),i(e,v,t),i(e,R,t),i(e,_,t),E=!0},p:oe,i(e){E||(j(h.$$.fragment,e),j(m.$$.fragment,e),j(w.$$.fragment,e),E=!0)},o(e){A(h.$$.fragment,e),A(m.$$.fragment,e),A(w.$$.fragment,e),E=!1},d(e){e&&(o(T),o(x),o(k),o($),o(u),o(H),o(C),o(c),o(L),o(p),o(P),o(f),o(z),o(g),o(M),o(F),o(y),o(q),o(b),o(B),o(v),o(R),o(_)),o(l),S(h,e),S(m,e),S(w,e)}}}const de='{"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}],"depth":1}';function he(U){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pe extends ae{constructor(l){super(),se(this,l,he,le,te,{})}}export{pe as component};
