import{s as ie,n as ae,o as se}from"../chunks/scheduler.d6170356.js";import{S as ne,i as re,g as n,s as a,r as W,A as le,h as r,f as o,c as s,j as te,u as j,x as d,k as oe,y as de,a as i,v as A,d as S,t as N,w as U}from"../chunks/index.fcd4cc08.js";import{H as D,E as he}from"../chunks/EditOnGithub.da2b595c.js";function me(O){let l,T,_,k,h,H,m,Y=`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.`,C,u,L,c,J='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.',P,f,K="<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>",z,p,Q="<em>* Not relevant when using <code>git</code> CLI directly</em>",M,g,V="Please read the next section to understand better those limits and how to deal with them.",F,w,q,b,X=`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).`,E,y,Z=`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,ee=`<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,x,G,$,I;return h=new D({props:{title:"Repository limitations and recommendations",local:"repository-limitations-and-recommendations",headingTag:"h1"}}),u=new D({props:{title:"Recommendations",local:"recommendations",headingTag:"h2"}}),w=new D({props:{title:"Explanations",local:"explanations",headingTag:"h2"}}),x=new he({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/repositories-recommendations.md"}}),{c(){l=n("meta"),T=a(),_=n("p"),k=a(),W(h.$$.fragment),H=a(),m=n("p"),m.textContent=Y,C=a(),W(u.$$.fragment),L=a(),c=n("p"),c.innerHTML=J,P=a(),f=n("table"),f.innerHTML=K,z=a(),p=n("p"),p.innerHTML=Q,M=a(),g=n("p"),g.textContent=V,F=a(),W(w.$$.fragment),q=a(),b=n("p"),b.textContent=X,E=a(),y=n("p"),y.innerHTML=Z,B=a(),v=n("ul"),v.innerHTML=ee,R=a(),W(x.$$.fragment),G=a(),$=n("p"),this.h()},l(e){const t=le("svelte-u9bgzb",document.head);l=r(t,"META",{name:!0,content:!0}),t.forEach(o),T=s(e),_=r(e,"P",{}),te(_).forEach(o),k=s(e),j(h.$$.fragment,e),H=s(e),m=r(e,"P",{"data-svelte-h":!0}),d(m)!=="svelte-xzslhr"&&(m.textContent=Y),C=s(e),j(u.$$.fragment,e),L=s(e),c=r(e,"P",{"data-svelte-h":!0}),d(c)!=="svelte-1lth8r8"&&(c.innerHTML=J),P=s(e),f=r(e,"TABLE",{"data-svelte-h":!0}),d(f)!=="svelte-r54kgd"&&(f.innerHTML=K),z=s(e),p=r(e,"P",{"data-svelte-h":!0}),d(p)!=="svelte-1kqloz8"&&(p.innerHTML=Q),M=s(e),g=r(e,"P",{"data-svelte-h":!0}),d(g)!=="svelte-4yld6t"&&(g.textContent=V),F=s(e),j(w.$$.fragment,e),q=s(e),b=r(e,"P",{"data-svelte-h":!0}),d(b)!=="svelte-ojgmzx"&&(b.textContent=X),E=s(e),y=r(e,"P",{"data-svelte-h":!0}),d(y)!=="svelte-1sfy0e"&&(y.innerHTML=Z),B=s(e),v=r(e,"UL",{"data-svelte-h":!0}),d(v)!=="svelte-1upeqfr"&&(v.innerHTML=ee),R=s(e),j(x.$$.fragment,e),G=s(e),$=r(e,"P",{}),te($).forEach(o),this.h()},h(){oe(l,"name","hf:doc:metadata"),oe(l,"content",ue)},m(e,t){de(document.head,l),i(e,T,t),i(e,_,t),i(e,k,t),A(h,e,t),i(e,H,t),i(e,m,t),i(e,C,t),A(u,e,t),i(e,L,t),i(e,c,t),i(e,P,t),i(e,f,t),i(e,z,t),i(e,p,t),i(e,M,t),i(e,g,t),i(e,F,t),A(w,e,t),i(e,q,t),i(e,b,t),i(e,E,t),i(e,y,t),i(e,B,t),i(e,v,t),i(e,R,t),A(x,e,t),i(e,G,t),i(e,$,t),I=!0},p:ae,i(e){I||(S(h.$$.fragment,e),S(u.$$.fragment,e),S(w.$$.fragment,e),S(x.$$.fragment,e),I=!0)},o(e){N(h.$$.fragment,e),N(u.$$.fragment,e),N(w.$$.fragment,e),N(x.$$.fragment,e),I=!1},d(e){e&&(o(T),o(_),o(k),o(H),o(m),o(C),o(L),o(c),o(P),o(f),o(z),o(p),o(M),o(g),o(F),o(q),o(b),o(E),o(y),o(B),o(v),o(R),o(G),o($)),o(l),U(h,e),U(u,e),U(w,e),U(x,e)}}}const ue='{"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 ce(O){return se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class we extends ne{constructor(l){super(),re(this,l,ce,me,ie,{})}}export{we as component};
