import{s as Vl,o as Nl,n as Jt}from"../chunks/scheduler.6062bdaf.js";import{S as ql,i as Ql,g as o,s as l,r as c,A as zl,h as i,f as a,c as n,j as El,u as h,x as p,k as ks,y as Pl,a as s,v as u,d,t as f,w as m}from"../chunks/index.4bca734e.js";import{T as jt}from"../chunks/Tip.b9ac1f03.js";import{C as y}from"../chunks/CodeBlock.fa01571c.js";import{H as w,E as Dl}from"../chunks/EditOnGithub.74ab2baa.js";function Kl(_){let r,M=`Background jobs are queued when using <code>run_as_future=True</code>. This means that you are guaranteed that the jobs will be
executed in the correct order.`;return{c(){r=o("p"),r.innerHTML=M},l(g){r=i(g,"P",{"data-svelte-h":!0}),p(r)!=="svelte-wv2oxh"&&(r.innerHTML=M)},m(g,b){s(g,r,b)},p:Jt,d(g){g&&a(r)}}}function Ol(_){let r,M=`<code>multi_commits</code> is still an experimental feature. Its API and behavior is subject to change in the future without prior
notice.`;return{c(){r=o("p"),r.innerHTML=M},l(g){r=i(g,"P",{"data-svelte-h":!0}),p(r)!=="svelte-1hgg4xz"&&(r.innerHTML=M)},m(g,b){s(g,r,b)},p:Jt,d(g){g&&a(r)}}}function en(_){let r,M=`For more examples of custom schedulers, check out our <a href="https://huggingface.co/spaces/Wauplin/space_to_dataset_saver" rel="nofollow">demo Space</a>
containing different implementations depending on your use cases.`;return{c(){r=o("p"),r.innerHTML=M},l(g){r=i(g,"P",{"data-svelte-h":!0}),p(r)!=="svelte-ndh47j"&&(r.innerHTML=M)},m(g,b){s(g,r,b)},p:Jt,d(g){g&&a(r)}}}function tn(_){let r,M=`This is a power-user method. Directly using <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a>, <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a> or <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a> instead of handling
the low-level logic of pre-uploading files is the way to go in the vast majority of cases. The main caveat of
<a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.preupload_lfs_files">preupload_lfs_files()</a> is that until the commit is actually made, the upload files are not accessible on the repo on
the Hub. If you have a question, feel free to ping us on our Discord or in a GitHub issue.`;return{c(){r=o("p"),r.innerHTML=M},l(g){r=i(g,"P",{"data-svelte-h":!0}),p(r)!=="svelte-1i540bi"&&(r.innerHTML=M)},m(g,b){s(g,r,b)},p:Jt,d(g){g&&a(r)}}}function an(_){let r,M=`<code>hf_transfer</code> is a power user tool!
It is tested and production-ready,
but it lacks user-friendly features like advanced error handling or proxies.
For more details, please take a look at this <a href="https://huggingface.co/docs/huggingface_hub/hf_transfer" rel="nofollow">section</a>.`;return{c(){r=o("p"),r.innerHTML=M},l(g){r=i(g,"P",{"data-svelte-h":!0}),p(r)!=="svelte-ac3n7l"&&(r.innerHTML=M)},m(g,b){s(g,r,b)},p:Jt,d(g){g&&a(r)}}}function sn(_){let r,M=`Although <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository">Repository</a> is not formally deprecated, we recommend using the HTTP-based methods described above instead.
For more details about this recommendation, please have a look at <a href="../concepts/git_vs_http">this guide</a> explaining the
core differences between HTTP-based and Git-based approaches.`;return{c(){r=o("p"),r.innerHTML=M},l(g){r=i(g,"P",{"data-svelte-h":!0}),p(r)!=="svelte-150yfso"&&(r.innerHTML=M)},m(g,b){s(g,r,b)},p:Jt,d(g){g&&a(r)}}}function ln(_){let r,M,g,b,I,vt,C,Is="Sharing your files and work is an important aspect of the Hub. The <code>huggingface_hub</code> offers several options for uploading your files to the Hub. You can use these functions independently or integrate them into your library, making it more convenient for your users to interact with the Hub. This guide will show you how to push files:",$t,Z,Cs='<li>without using Git.</li> <li>that are very large with <a href="https://git-lfs.github.com/" rel="nofollow">Git LFS</a>.</li> <li>with the <code>commit</code> context manager.</li> <li>with the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.push_to_hub">push_to_hub()</a> function.</li>',kt,G,Zs='Whenever you want to upload files to the Hub, you need to log in to your Hugging Face account. For more details about authentication, check out <a href="../quick-start#authentication">this section</a>.',It,H,Ct,B,Gs='Once you’ve created a repository with <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_repo">create_repo()</a>, you can upload a file to your repository using <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a>.',Zt,X,Hs="Specify the path of the file to upload, where you want to upload the file to in the repository, and the name of the repository you want to add the file to. Depending on your repository type, you can optionally set the repository type as a <code>dataset</code>, <code>model</code>, or <code>space</code>.",Gt,A,Ht,W,Bt,R,Bs=`Use the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a> function to upload a local folder to an existing repository. Specify the path of the local folder
to upload, where you want to upload the folder to in the repository, and the name of the repository you want to add the
folder to. Depending on your repository type, you can optionally set the repository type as a <code>dataset</code>, <code>model</code>, or <code>space</code>.`,Xt,x,At,S,Xs="By default, the <code>.gitignore</code> file will be taken into account to know which files should be committed or not. By default we check if a <code>.gitignore</code> file is present in a commit, and if not, we check if it exists on the Hub. Please be aware that only a <code>.gitignore</code> file present at the root of the directory with be used. We do not check for <code>.gitignore</code> files in subdirectories.",Wt,L,As='If you don’t want to use an hardcoded <code>.gitignore</code> file, you can use the <code>allow_patterns</code> and <code>ignore_patterns</code> arguments to filter which files to upload. These parameters accept either a single pattern or a list of patterns. Patterns are Standard Wildcards (globbing patterns) as documented <a href="https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm" rel="nofollow">here</a>. If both <code>allow_patterns</code> and <code>ignore_patterns</code> are provided, both constraints apply.',Rt,Y,Ws="Beside the <code>.gitignore</code> file and allow/ignore patterns, any <code>.git/</code> folder present in any subdirectory will be ignored.",xt,F,St,E,Rs=`You can also use the <code>delete_patterns</code> argument to specify files you want to delete from the repo in the same commit.
This can prove useful if you want to clean a remote folder before pushing files in it and you don’t know which files
already exists.`,Lt,V,xs=`The example below uploads the local <code>./logs</code> folder to the remote <code>/experiment/logs/</code> folder. Only txt files are uploaded
but before that, all previous logs on the repo on deleted. All of this in a single commit.`,Yt,N,Ft,q,Et,Q,Ss='You can use the <code>huggingface-cli upload</code> command from the terminal to directly upload files to the Hub. Internally it uses the same <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a> and <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a> helpers described above.',Vt,z,Ls="You can either upload a single file or an entire folder:",Nt,P,qt,D,Ys=`<code>local_path</code> and <code>path_in_repo</code> are optional and can be implicitly inferred. If <code>local_path</code> is not set, the tool will
check if a local folder or file has the same name as the <code>repo_id</code>. If that’s the case, its content will be uploaded.
Otherwise, an exception is raised asking the user to explicitly set <code>local_path</code>. In any case, if <code>path_in_repo</code> is not
set, files are uploaded at the root of the repo.`,Qt,K,Fs='For more details about the CLI upload command, please refer to the <a href="./cli#huggingface-cli-upload">CLI guide</a>.',zt,O,Pt,ee,Es=`In most cases, you won’t need more than <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a> and <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a> to upload your files to the Hub.
However, <code>huggingface_hub</code> has more advanced features to make things easier. Let’s have a look at them!`,Dt,te,Kt,ae,Vs=`In some cases, you want to push data without blocking your main thread. This is particularly useful to upload logs and
artifacts while continuing a training. To do so, you can use the <code>run_as_future</code> argument in both <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a> and
<a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a>. This will return a <a href="https://docs.python.org/3/library/concurrent.futures.html#future-objects" rel="nofollow"><code>concurrent.futures.Future</code></a>
object that you can use to check the status of the upload.`,Ot,se,ea,T,ta,le,Ns=`Even though background jobs are mostly useful to upload data/create commits, you can queue any method you like using
<a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.run_as_future">run_as_future()</a>. For instance, you can use it to create a repo and then upload data to it in the background. The
built-in <code>run_as_future</code> argument in upload methods is just an alias around it.`,aa,ne,sa,oe,la,ie,qs=`<a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a> makes it easy to upload an entire folder to the Hub. However, for large folders (thousands of files or
hundreds of GB), it can still be challenging. If you have a folder with a lot of files, you might want to upload
it in several commits. If you experience an error or a connection issue during the upload, you would not have to resume
the process from the beginning.`,na,pe,Qs=`To upload a folder in multiple commits, just pass <code>multi_commits=True</code> as argument. Under the hood, <code>huggingface_hub</code>
will list the files to upload/delete and split them in several commits. The “strategy” (i.e. how to split the commits)
is based on the number and size of the files to upload. A PR is open on the Hub to push all the commits. Once the PR is
ready, the commits are squashed into a single commit. If the process is interrupted before completing, you can rerun
your script to resume the upload. The created PR will be automatically detected and the upload will resume from where
it stopped. It is recommended to pass <code>multi_commits_verbose=True</code> to get a better understanding of the upload and its
progress.`,oa,re,zs=`The example below will upload the checkpoints folder to a dataset in multiple commits. A PR will be created on the Hub
and merged automatically once the upload is complete. If you prefer the PR to stay open and review it manually, you can
pass <code>create_pr=True</code>.`,ia,ce,pa,he,Ps=`If you want a better control on the upload strategy (i.e. the commits that are created), you can have a look at the
low-level <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.plan_multi_commits">plan_multi_commits()</a> and <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commits_on_pr">create_commits_on_pr()</a> methods.`,ra,j,ca,ue,ha,de,Ds=`The Hugging Face Hub makes it easy to save and version data. However, there are some limitations when updating the same file thousands of times. For instance, you might want to save logs of a training process or user
feedback on a deployed Space. In these cases, uploading the data as a dataset on the Hub makes sense, but it can be hard to do properly. The main reason is that you don’t want to version every update of your data because it’ll make the git repository unusable. The <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a> class offers a solution to this problem.`,ua,fe,Ks=`The idea is to run a background job that regularly pushes a local folder to the Hub. Let’s assume you have a
Gradio Space that takes as input some text and generates two translations of it. Then, the user can select their preferred translation. For each run, you want to save the input, output, and user preference to analyze the results. This is a
perfect use case for <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a>; you want to save data to the Hub (potentially millions of user feedback), but
you don’t <em>need</em> to save in real-time each user’s input. Instead, you can save the data locally in a JSON file and
upload it every 10 minutes. For example:`,da,me,fa,ge,Os=`And that’s it! User input/outputs and feedback will be available as a dataset on the Hub. By using a unique JSON file name, you are guaranteed you won’t overwrite data from a previous run or data from another
Spaces/replicas pushing concurrently to the same repository.`,ma,ye,el='For more details about the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a>, here is what you need to know:',ga,Me,tl=`<li><strong>append-only:</strong>
It is assumed that you will only add content to the folder. You must only append data to existing files or create
new files. Deleting or overwriting a file might corrupt your repository.</li> <li><strong>git history</strong>:
The scheduler will commit the folder every <code>every</code> minutes. To avoid polluting the git repository too much, it is
recommended to set a minimal value of 5 minutes. Besides, the scheduler is designed to avoid empty commits. If no
new content is detected in the folder, the scheduled commit is dropped.</li> <li><strong>errors:</strong>
The scheduler run as background thread. It is started when you instantiate the class and never stops. In particular,
if an error occurs during the upload (example: connection issue), the scheduler will silently ignore it and retry
at the next scheduled commit.</li> <li><strong>thread-safety:</strong>
In most cases it is safe to assume that you can write to a file without having to worry about a lock file. The
scheduler will not crash or be corrupted if you write content to the folder while it’s uploading. In practice,
<em>it is possible</em> that concurrency issues happen for heavy-loaded apps. In this case, we advice to use the
<code>scheduler.lock</code> lock to ensure thread-safety. The lock is blocked only when the scheduler scans the folder for
changes, not when it uploads data. You can safely assume that it will not affect the user experience on your Space.</li>`,ya,be,Ma,we,al=`Persisting data from a Space to a Dataset on the Hub is the main use case for <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a>. Depending on the use
case, you might want to structure your data differently. The structure has to be robust to concurrent users and
restarts which often implies generating UUIDs. Besides robustness, you should upload data in a format readable by the 🤗 Datasets library for later reuse. We created a <a href="https://huggingface.co/spaces/Wauplin/space_to_dataset_saver" rel="nofollow">Space</a>
that demonstrates how to save several different data formats (you may need to adapt it for your own specific needs).`,ba,_e,wa,Te,sl=`<a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a> assumes your data is append-only and should be uploading “as is”. However, you
might want to customize the way data is uploaded. You can do that by creating a class inheriting from <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a>
and overwrite the <code>push_to_hub</code> method (feel free to overwrite it any way you want). You are guaranteed it will
be called every <code>every</code> minutes in a background thread. You don’t have to worry about concurrency and errors but you
must be careful about other aspects, such as pushing empty commits or duplicated data.`,_a,je,ll=`In the (simplified) example below, we overwrite <code>push_to_hub</code> to zip all PNG files in a single archive to avoid
overloading the repo on the Hub:`,Ta,Je,ja,Ue,nl='When you overwrite <code>push_to_hub</code>, you have access to the attributes of <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitScheduler">CommitScheduler</a> and especially:',Ja,ve,ol='<li><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> client: <code>api</code></li> <li>Folder parameters: <code>folder_path</code> and <code>path_in_repo</code></li> <li>Repo parameters: <code>repo_id</code>, <code>repo_type</code>, <code>revision</code></li> <li>The thread lock: <code>lock</code></li>',Ua,J,va,$e,$a,ke,il=`The <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a> and <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a> functions are high-level APIs that are generally convenient to use. We recommend
trying these functions first if you don’t need to work at a lower level. However, if you want to work at a commit-level,
you can use the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a> function directly.`,ka,Ie,pl='There are three types of operations supported by <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a>:',Ia,Ce,rl='<li><p><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitOperationAdd">CommitOperationAdd</a> uploads a file to the Hub. If the file already exists, the file contents are overwritten. This operation accepts two arguments:</p> <ul><li><code>path_in_repo</code>: the repository path to upload a file to.</li> <li><code>path_or_fileobj</code>: either a path to a file on your filesystem or a file-like object. This is the content of the file to upload to the Hub.</li></ul></li> <li><p><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitOperationDelete">CommitOperationDelete</a> removes a file or a folder from a repository. This operation accepts <code>path_in_repo</code> as an argument.</p></li> <li><p><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitOperationCopy">CommitOperationCopy</a> copies a file within a repository. This operation accepts three arguments:</p> <ul><li><code>src_path_in_repo</code>: the repository path of the file to copy.</li> <li><code>path_in_repo</code>: the repository path where the file should be copied.</li> <li><code>src_revision</code>: optional - the revision of the file to copy if your want to copy a file from a different branch/revision.</li></ul></li>',Ca,Ze,cl="For example, if you want to upload two files and delete a file in a Hub repository:",Za,Ge,hl="<li>Use the appropriate <code>CommitOperation</code> to add or delete a file and to delete a folder:</li>",Ga,He,Ha,U,ul='<li>Pass your operations to <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a>:</li>',Ba,Be,Xa,Xe,dl='In addition to <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_file">upload_file()</a> and <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.upload_folder">upload_folder()</a>, the following functions also use <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a> under the hood:',Aa,Ae,fl='<li><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.delete_file">delete_file()</a> deletes a single file from a repository on the Hub.</li> <li><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.delete_folder">delete_folder()</a> deletes an entire folder from a repository on the Hub.</li> <li><a href="/docs/huggingface_hub/v0.23.0/en/package_reference/cards#huggingface_hub.metadata_update">metadata_update()</a> updates a repository’s metadata.</li>',Wa,We,ml='For more detailed information, take a look at the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> reference.',Ra,Re,xa,xe,gl=`In some cases, you might want to upload huge files to S3 <strong>before</strong> making the commit call. For example, if you are
committing a dataset in several shards that are generated in-memory, you would need to upload the shards one by one
to avoid an out-of-memory issue. A solution is to upload each shard as a separate commit on the repo. While being
perfectly valid, this solution has the drawback of potentially messing the git history by generating tens of commits.
To overcome this issue, you can upload your files one by one to S3 and then create a single commit at the end. This
is possible using <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.preupload_lfs_files">preupload_lfs_files()</a> in combination with <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a>.`,Sa,v,La,Se,yl="Here is a simple example illustrating how to pre-upload files:",Ya,Le,Fa,Ye,Ml=`First, we create the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.CommitOperationAdd">CommitOperationAdd</a> objects one by one. In a real-world example, those would contain the
generated shards. Each file is uploaded before generating the next one. During the <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.preupload_lfs_files">preupload_lfs_files()</a> step, <strong>the
<code>CommitOperationAdd</code> object is mutated</strong>. You should only use it to pass it directly to <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a>. The main
update of the object is that <strong>the binary content is removed</strong> from it, meaning that it will be garbage-collected if
you don’t store another reference to it. This is expected as we don’t want to keep in memory the content that is
already uploaded. Finally we create the commit by passing all the operations to <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/hf_api#huggingface_hub.HfApi.create_commit">create_commit()</a>. You can pass
additional operations (add, delete or copy) that have not been processed yet and they will be handled correctly.`,Ea,Fe,Va,Ee,bl=`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.`,Na,Ve,wl='Check out our <a href="https://huggingface.co/docs/hub/repositories-recommendations" rel="nofollow">Repository limitations and recommendations</a> guide for best practices on how to structure your repositories on the Hub. Next, let’s move on with some practical tips to make your upload process as smooth as possible.',qa,Ne,_l=`<li><p><strong>Start small</strong>: We recommend starting with a small amount of data to test your upload script. It’s easier to iterate
on a script when failing takes only a little time.</p></li> <li><p><strong>Expect failures</strong>: Streaming large amounts of data is challenging. You don’t know what can happen, but it’s always
best to consider that something will fail at least once -no matter if it’s due to your machine, your connection, or our
servers. For example, if you plan to upload a large number of files, it’s best to keep track locally of which files you
already uploaded before uploading the next batch. You are ensured that an LFS file that is already committed will never
be re-uploaded twice but checking it client-side can still save some time.</p></li> <li><p><strong>Use <code>hf_transfer</code></strong>: this is a Rust-based <a href="https://github.com/huggingface/hf_transfer" rel="nofollow">library</a> meant to speed up
uploads on machines with very high bandwidth. To use <code>hf_transfer</code>:</p> <ol><li>Specify the <code>hf_transfer</code> extra when installing <code>huggingface_hub</code>
(e.g. <code>pip install huggingface_hub[hf_transfer]</code>).</li> <li>Set <code>HF_HUB_ENABLE_HF_TRANSFER=1</code> as an environment variable.</li></ol></li>`,Qa,$,za,qe,Pa,Qe,Tl=`All the methods described above use the Hub’s API to upload files. This is the recommended way to upload files to the Hub.
However, we also provide <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository">Repository</a>, a wrapper around the git tool to manage a local repository.`,Da,k,Ka,ze,jl="Git LFS automatically handles files larger than 10MB. But for very large files (>5GB), you need to install a custom transfer agent for Git LFS:",Oa,Pe,es,De,Jl="You should install this for each repository that has a very large file. Once installed, you’ll be able to push files larger than 5GB.",ts,Ke,as,Oe,Ul="The <code>commit</code> context manager handles four of the most common Git commands: pull, add, commit, and push. <code>git-lfs</code> automatically tracks any file larger than 10MB. In the following example, the <code>commit</code> context manager:",ss,et,vl="<li>Pulls from the <code>text-files</code> repository.</li> <li>Adds a change made to <code>file.txt</code>.</li> <li>Commits the change.</li> <li>Pushes the change to the <code>text-files</code> repository.</li>",ls,tt,ns,at,$l="Here is another example of how to use the <code>commit</code> context manager to save and upload a file to a repository:",os,st,is,lt,kl="Set <code>blocking=False</code> if you would like to push your commits asynchronously. Non-blocking behavior is helpful when you want to continue running your script while your commits are being pushed.",ps,nt,rs,ot,Il="You can check the status of your push with the <code>command_queue</code> method:",cs,it,hs,pt,Cl="Refer to the table below for the possible statuses:",us,rt,Zl="<thead><tr><th>Status</th> <th>Description</th></tr></thead> <tbody><tr><td>-1</td> <td>The push is ongoing.</td></tr> <tr><td>0</td> <td>The push has completed successfully.</td></tr> <tr><td>Non-zero</td> <td>An error has occurred.</td></tr></tbody>",ds,ct,Gl="When <code>blocking=False</code>, commands are tracked, and your script will only exit when all pushes are completed, even if other errors occur in your script. Some additional useful commands for checking the status of a push include:",fs,ht,ms,ut,gs,dt,Hl='The <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository">Repository</a> class has a <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.push_to_hub">push_to_hub()</a> function to add files, make a commit, and push them to a repository. Unlike the <code>commit</code> context manager, you’ll need to pull from a repository first before calling <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.push_to_hub">push_to_hub()</a>.',ys,ft,Bl="For example, if you’ve already cloned a repository from the Hub, then you can initialize the <code>repo</code> from the local directory:",Ms,mt,bs,gt,Xl='Update your local clone with <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.git_pull">git_pull()</a> and then push your file to the Hub:',ws,yt,_s,Mt,Al='However, if you aren’t ready to push a file yet, you can use <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.git_add">git_add()</a> and <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.git_commit">git_commit()</a> to only add and commit your file:',Ts,bt,js,wt,Wl='When you’re ready, push the file to your repository with <a href="/docs/huggingface_hub/v0.23.0/en/package_reference/repository#huggingface_hub.Repository.git_push">git_push()</a>:',Js,_t,Us,Tt,vs,Ut,$s;return I=new w({props:{title:"Upload files to the Hub",local:"upload-files-to-the-hub",headingTag:"h1"}}),H=new w({props:{title:"Upload a file",local:"upload-a-file",headingTag:"h2"}}),A=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBYXBpJTIwJTNEJTIwSGZBcGkoKSUwQWFwaS51cGxvYWRfZmlsZSglMEElMjAlMjAlMjAlMjBwYXRoX29yX2ZpbGVvYmolM0QlMjIlMkZwYXRoJTJGdG8lMkZsb2NhbCUyRmZvbGRlciUyRlJFQURNRS5tZCUyMiUyQyUwQSUyMCUyMCUyMCUyMHBhdGhfaW5fcmVwbyUzRCUyMlJFQURNRS5tZCUyMiUyQyUwQSUyMCUyMCUyMCUyMHJlcG9faWQlM0QlMjJ1c2VybmFtZSUyRnRlc3QtZGF0YXNldCUyMiUyQyUwQSUyMCUyMCUyMCUyMHJlcG9fdHlwZSUzRCUyMmRhdGFzZXQlMjIlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi
<span class="hljs-meta">&gt;&gt;&gt; </span>api = HfApi()
<span class="hljs-meta">&gt;&gt;&gt; </span>api.upload_file(
<span class="hljs-meta">... </span>    path_or_fileobj=<span class="hljs-string">&quot;/path/to/local/folder/README.md&quot;</span>,
<span class="hljs-meta">... </span>    path_in_repo=<span class="hljs-string">&quot;README.md&quot;</span>,
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/test-dataset&quot;</span>,
<span class="hljs-meta">... </span>    repo_type=<span class="hljs-string">&quot;dataset&quot;</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),W=new w({props:{title:"Upload a folder",local:"upload-a-folder",headingTag:"h2"}}),x=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBYXBpJTIwJTNEJTIwSGZBcGkoKSUwQSUwQWFwaS51cGxvYWRfZm9sZGVyKCUwQSUyMCUyMCUyMCUyMGZvbGRlcl9wYXRoJTNEJTIyJTJGcGF0aCUyRnRvJTJGbG9jYWwlMkZzcGFjZSUyMiUyQyUwQSUyMCUyMCUyMCUyMHJlcG9faWQlM0QlMjJ1c2VybmFtZSUyRm15LWNvb2wtc3BhY2UlMjIlMkMlMEElMjAlMjAlMjAlMjByZXBvX3R5cGUlM0QlMjJzcGFjZSUyMiUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi
<span class="hljs-meta">&gt;&gt;&gt; </span>api = HfApi()

<span class="hljs-comment"># Upload all the content from the local folder to your remote Space.</span>
<span class="hljs-comment"># By default, files are uploaded at the root of the repo</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>api.upload_folder(
<span class="hljs-meta">... </span>    folder_path=<span class="hljs-string">&quot;/path/to/local/space&quot;</span>,
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/my-cool-space&quot;</span>,
<span class="hljs-meta">... </span>    repo_type=<span class="hljs-string">&quot;space&quot;</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),F=new y({props:{code:"YXBpLnVwbG9hZF9mb2xkZXIoJTBBJTIwJTIwJTIwJTIwZm9sZGVyX3BhdGglM0QlMjIlMkZwYXRoJTJGdG8lMkZsb2NhbCUyRmZvbGRlciUyMiUyQyUwQSUyMCUyMCUyMCUyMHBhdGhfaW5fcmVwbyUzRCUyMm15LWRhdGFzZXQlMkZ0cmFpbiUyMiUyQyUyMCUyMyUyMFVwbG9hZCUyMHRvJTIwYSUyMHNwZWNpZmljJTIwZm9sZGVyJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMnVzZXJuYW1lJTJGdGVzdC1kYXRhc2V0JTIyJTJDJTBBJTIwJTIwJTIwJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUyQyUwQSUyMCUyMCUyMCUyMGlnbm9yZV9wYXR0ZXJucyUzRCUyMioqJTJGbG9ncyUyRioudHh0JTIyJTJDJTIwJTIzJTIwSWdub3JlJTIwYWxsJTIwdGV4dCUyMGxvZ3MlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>api.upload_folder(
<span class="hljs-meta">... </span>    folder_path=<span class="hljs-string">&quot;/path/to/local/folder&quot;</span>,
<span class="hljs-meta">... </span>    path_in_repo=<span class="hljs-string">&quot;my-dataset/train&quot;</span>, <span class="hljs-comment"># Upload to a specific folder</span>
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/test-dataset&quot;</span>,
<span class="hljs-meta">... </span>    repo_type=<span class="hljs-string">&quot;dataset&quot;</span>,
<span class="hljs-meta">... </span>    ignore_patterns=<span class="hljs-string">&quot;**/logs/*.txt&quot;</span>, <span class="hljs-comment"># Ignore all text logs</span>
<span class="hljs-meta">... </span>)`,wrap:!1}}),N=new y({props:{code:"YXBpLnVwbG9hZF9mb2xkZXIoJTBBJTIwJTIwJTIwJTIwZm9sZGVyX3BhdGglM0QlMjIlMkZwYXRoJTJGdG8lMkZsb2NhbCUyRmZvbGRlciUyRmxvZ3MlMjIlMkMlMEElMjAlMjAlMjAlMjByZXBvX2lkJTNEJTIydXNlcm5hbWUlMkZ0cmFpbmVkLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwcGF0aF9pbl9yZXBvJTNEJTIyZXhwZXJpbWVudCUyRmxvZ3MlMkYlMjIlMkMlMEElMjAlMjAlMjAlMjBhbGxvd19wYXR0ZXJucyUzRCUyMioudHh0JTIyJTJDJTIwJTIzJTIwVXBsb2FkJTIwYWxsJTIwbG9jYWwlMjB0ZXh0JTIwZmlsZXMlMEElMjAlMjAlMjAlMjBkZWxldGVfcGF0dGVybnMlM0QlMjIqLnR4dCUyMiUyQyUyMCUyMyUyMERlbGV0ZSUyMGFsbCUyMHJlbW90ZSUyMHRleHQlMjBmaWxlcyUyMGJlZm9yZSUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>api.upload_folder(
<span class="hljs-meta">... </span>    folder_path=<span class="hljs-string">&quot;/path/to/local/folder/logs&quot;</span>,
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/trained-model&quot;</span>,
<span class="hljs-meta">... </span>    path_in_repo=<span class="hljs-string">&quot;experiment/logs/&quot;</span>,
<span class="hljs-meta">... </span>    allow_patterns=<span class="hljs-string">&quot;*.txt&quot;</span>, <span class="hljs-comment"># Upload all local text files</span>
<span class="hljs-meta">... </span>    delete_patterns=<span class="hljs-string">&quot;*.txt&quot;</span>, <span class="hljs-comment"># Delete all remote text files before</span>
<span class="hljs-meta">... </span>)`,wrap:!1}}),q=new w({props:{title:"Upload from the CLI",local:"upload-from-the-cli",headingTag:"h2"}}),P=new y({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwdXBsb2FkJTIwV2F1cGxpbiUyRm15LWNvb2wtbW9kZWwlMjAuJTJGbW9kZWxzJTJGbW9kZWwuc2FmZXRlbnNvcnMlMjBtb2RlbC5zYWZldGVuc29ycyUwQSUwQWh1Z2dpbmdmYWNlLWNsaSUyMHVwbG9hZCUyMFdhdXBsaW4lMkZteS1jb29sLW1vZGVsJTIwLiUyRm1vZGVscyUyMC4=",highlighted:`<span class="hljs-comment"># Usage:  huggingface-cli upload [repo_id] [local_path] [path_in_repo]</span>
&gt;&gt;&gt; huggingface-cli upload Wauplin/my-cool-model ./models/model.safetensors model.safetensors
https://huggingface.co/Wauplin/my-cool-model/blob/main/model.safetensors

&gt;&gt;&gt; huggingface-cli upload Wauplin/my-cool-model ./models .
https://huggingface.co/Wauplin/my-cool-model/tree/main`,wrap:!1}}),O=new w({props:{title:"Advanced features",local:"advanced-features",headingTag:"h2"}}),te=new w({props:{title:"Non-blocking uploads",local:"non-blocking-uploads",headingTag:"h3"}}),se=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBYXBpJTIwJTNEJTIwSGZBcGkoKSUwQWZ1dHVyZSUyMCUzRCUyMGFwaS51cGxvYWRfZm9sZGVyKCUyMCUyMyUyMFVwbG9hZCUyMGluJTIwdGhlJTIwYmFja2dyb3VuZCUyMChub24tYmxvY2tpbmclMjBhY3Rpb24pJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMnVzZXJuYW1lJTJGbXktbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjBmb2xkZXJfcGF0aCUzRCUyMmNoZWNrcG9pbnRzLTAwMSUyMiUyQyUwQSUyMCUyMCUyMCUyMHJ1bl9hc19mdXR1cmUlM0RUcnVlJTJDJTBBKSUwQWZ1dHVyZSUwQWZ1dHVyZS5kb25lKCklMEFmdXR1cmUucmVzdWx0KCklMjAlMjMlMjBXYWl0JTIwZm9yJTIwdGhlJTIwdXBsb2FkJTIwdG8lMjBjb21wbGV0ZSUyMChibG9ja2luZyUyMGFjdGlvbik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi
<span class="hljs-meta">&gt;&gt;&gt; </span>api = HfApi()
<span class="hljs-meta">&gt;&gt;&gt; </span>future = api.upload_folder( <span class="hljs-comment"># Upload in the background (non-blocking action)</span>
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/my-model&quot;</span>,
<span class="hljs-meta">... </span>    folder_path=<span class="hljs-string">&quot;checkpoints-001&quot;</span>,
<span class="hljs-meta">... </span>    run_as_future=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>future
Future(...)
<span class="hljs-meta">&gt;&gt;&gt; </span>future.done()
<span class="hljs-literal">False</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>future.result() <span class="hljs-comment"># Wait for the upload to complete (blocking action)</span>
...`,wrap:!1}}),T=new jt({props:{$$slots:{default:[Kl]},$$scope:{ctx:_}}}),ne=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBYXBpJTIwJTNEJTIwSGZBcGkoKSUwQWFwaS5ydW5fYXNfZnV0dXJlKGFwaS5jcmVhdGVfcmVwbyUyQyUyMCUyMnVzZXJuYW1lJTJGbXktbW9kZWwlMjIlMkMlMjBleGlzdHNfb2slM0RUcnVlKSUwQWFwaS51cGxvYWRfZmlsZSglMEElMjAlMjAlMjAlMjByZXBvX2lkJTNEJTIydXNlcm5hbWUlMkZteS1tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMHBhdGhfaW5fcmVwbyUzRCUyMmZpbGUudHh0JTIyJTJDJTBBJTIwJTIwJTIwJTIwcGF0aF9vcl9maWxlb2JqJTNEYiUyMmZpbGUlMjBjb250ZW50JTIyJTJDJTBBJTIwJTIwJTIwJTIwcnVuX2FzX2Z1dHVyZSUzRFRydWUlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi
<span class="hljs-meta">&gt;&gt;&gt; </span>api = HfApi()
<span class="hljs-meta">&gt;&gt;&gt; </span>api.run_as_future(api.create_repo, <span class="hljs-string">&quot;username/my-model&quot;</span>, exists_ok=<span class="hljs-literal">True</span>)
Future(...)
<span class="hljs-meta">&gt;&gt;&gt; </span>api.upload_file(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/my-model&quot;</span>,
<span class="hljs-meta">... </span>    path_in_repo=<span class="hljs-string">&quot;file.txt&quot;</span>,
<span class="hljs-meta">... </span>    path_or_fileobj=<span class="hljs-string">b&quot;file content&quot;</span>,
<span class="hljs-meta">... </span>    run_as_future=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)
Future(...)`,wrap:!1}}),oe=new w({props:{title:"Upload a folder by chunks",local:"upload-a-folder-by-chunks",headingTag:"h3"}}),ce=new y({props:{code:"dXBsb2FkX2ZvbGRlciglMEElMjAlMjAlMjAlMjBmb2xkZXJfcGF0aCUzRCUyMmxvY2FsJTJGY2hlY2twb2ludHMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXBvX2lkJTNEJTIydXNlcm5hbWUlMkZteS1kYXRhc2V0JTIyJTJDJTBBJTIwJTIwJTIwJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUyQyUwQSUyMCUyMCUyMCUyMG11bHRpX2NvbW1pdHMlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwbXVsdGlfY29tbWl0c192ZXJib3NlJTNEVHJ1ZSUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>upload_folder(
<span class="hljs-meta">... </span>    folder_path=<span class="hljs-string">&quot;local/checkpoints&quot;</span>,
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;username/my-dataset&quot;</span>,
<span class="hljs-meta">... </span>    repo_type=<span class="hljs-string">&quot;dataset&quot;</span>,
<span class="hljs-meta">... </span>    multi_commits=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    multi_commits_verbose=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),j=new jt({props:{warning:!0,$$slots:{default:[Ol]},$$scope:{ctx:_}}}),ue=new w({props:{title:"Scheduled uploads",local:"scheduled-uploads",headingTag:"h3"}}),me=new y({props:{code:"aW1wb3J0JTIwanNvbiUwQWltcG9ydCUyMHV1aWQlMEFmcm9tJTIwcGF0aGxpYiUyMGltcG9ydCUyMFBhdGglMEFpbXBvcnQlMjBncmFkaW8lMjBhcyUyMGdyJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMENvbW1pdFNjaGVkdWxlciUwQSUwQWZlZWRiYWNrX2ZpbGUlMjAlM0QlMjBQYXRoKCUyMnVzZXJfZmVlZGJhY2slMkYlMjIpJTIwJTJGJTIwZiUyMmRhdGFfJTdCdXVpZC51dWlkNCgpJTdELmpzb24lMjIlMEFmZWVkYmFja19mb2xkZXIlMjAlM0QlMjBmZWVkYmFja19maWxlLnBhcmVudCUwQSUwQXNjaGVkdWxlciUyMCUzRCUyMENvbW1pdFNjaGVkdWxlciglMEElMjAlMjAlMjAlMjByZXBvX2lkJTNEJTIycmVwb3J0LXRyYW5zbGF0aW9uLWZlZWRiYWNrJTIyJTJDJTBBJTIwJTIwJTIwJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUyQyUwQSUyMCUyMCUyMCUyMGZvbGRlcl9wYXRoJTNEZmVlZGJhY2tfZm9sZGVyJTJDJTBBJTIwJTIwJTIwJTIwcGF0aF9pbl9yZXBvJTNEJTIyZGF0YSUyMiUyQyUwQSUyMCUyMCUyMCUyMGV2ZXJ5JTNEMTAlMkMlMEEpJTBBJTBBZGVmJTIwc2F2ZV9mZWVkYmFjayhpbnB1dF90ZXh0JTNBc3RyJTJDJTIwb3V0cHV0XzElM0ElMjBzdHIlMkMlMjBvdXRwdXRfMiUzQXN0ciUyQyUyMHVzZXJfY2hvaWNlJTNBJTIwaW50KSUyMC0lM0UlMjBOb25lJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwQXBwZW5kJTIwaW5wdXQlMkZvdXRwdXRzJTIwYW5kJTIwdXNlciUyMGZlZWRiYWNrJTIwdG8lMjBhJTIwSlNPTiUyMExpbmVzJTIwZmlsZSUyMHVzaW5nJTIwYSUyMHRocmVhZCUyMGxvY2slMjB0byUyMGF2b2lkJTIwY29uY3VycmVudCUyMHdyaXRlcyUyMGZyb20lMjBkaWZmZXJlbnQlMjB1c2Vycy4lMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMjAlMjAlMjAlMjB3aXRoJTIwc2NoZWR1bGVyLmxvY2slM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3aXRoJTIwZmVlZGJhY2tfZmlsZS5vcGVuKCUyMmElMjIpJTIwYXMlMjBmJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZi53cml0ZShqc29uLmR1bXBzKCU3QiUyMmlucHV0JTIyJTNBJTIwaW5wdXRfdGV4dCUyQyUyMCUyMm91dHB1dF8xJTIyJTNBJTIwb3V0cHV0XzElMkMlMjAlMjJvdXRwdXRfMiUyMiUzQSUyMG91dHB1dF8yJTJDJTIwJTIydXNlcl9jaG9pY2UlMjIlM0ElMjB1c2VyX2Nob2ljZSU3RCkpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZi53cml0ZSglMjIlNUNuJTIyKSUwQSUwQXdpdGglMjBnci5CbG9ja3MoKSUyMGFzJTIwZGVtbyUzQSUwQSUyMCUyMCUyMCUyMC4uLiUyMCUyMyUyMGRlZmluZSUyMEdyYWRpbyUyMGRlbW8lMjAlMkIlMjB1c2UlMjAlNjBzYXZlX2ZlZWRiYWNrJTYwJTBBZGVtby5sYXVuY2goKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> json
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> uuid
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> pathlib <span class="hljs-keyword">import</span> Path
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> CommitScheduler

<span class="hljs-comment"># Define the file where to save the data. Use UUID to make sure not to overwrite existing data from a previous run.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>feedback_file = Path(<span class="hljs-string">&quot;user_feedback/&quot;</span>) / <span class="hljs-string">f&quot;data_<span class="hljs-subst">{uuid.uuid4()}</span>.json&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>feedback_folder = feedback_file.parent

<span class="hljs-comment"># Schedule regular uploads. Remote repo and local folder are created if they don&#x27;t already exist.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>scheduler = CommitScheduler(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;report-translation-feedback&quot;</span>,
<span class="hljs-meta">... </span>    repo_type=<span class="hljs-string">&quot;dataset&quot;</span>,
<span class="hljs-meta">... </span>    folder_path=feedback_folder,
<span class="hljs-meta">... </span>    path_in_repo=<span class="hljs-string">&quot;data&quot;</span>,
<span class="hljs-meta">... </span>    every=<span class="hljs-number">10</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-comment"># Define the function that will be called when the user submits its feedback (to be called in Gradio)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">save_feedback</span>(<span class="hljs-params">input_text:<span class="hljs-built_in">str</span>, output_1: <span class="hljs-built_in">str</span>, output_2:<span class="hljs-built_in">str</span>, user_choice: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-literal">None</span>:
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;
<span class="hljs-meta">... </span>    Append input/outputs and user feedback to a JSON Lines file using a thread lock to avoid concurrent writes from different users.
<span class="hljs-meta">... </span>    &quot;&quot;&quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">with</span> scheduler.lock:
<span class="hljs-meta">... </span>        <span class="hljs-keyword">with</span> feedback_file.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;a&quot;</span>) <span class="hljs-keyword">as</span> f:
<span class="hljs-meta">... </span>            f.write(json.dumps({<span class="hljs-string">&quot;input&quot;</span>: input_text, <span class="hljs-string">&quot;output_1&quot;</span>: output_1, <span class="hljs-string">&quot;output_2&quot;</span>: output_2, <span class="hljs-string">&quot;user_choice&quot;</span>: user_choice}))
<span class="hljs-meta">... </span>            f.write(<span class="hljs-string">&quot;\\n&quot;</span>)

<span class="hljs-comment"># Start Gradio</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> gr.Blocks() <span class="hljs-keyword">as</span> demo:
<span class="hljs-meta">&gt;&gt;&gt; </span>    ... <span class="hljs-comment"># define Gradio demo + use \`save_feedback\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>demo.launch()`,wrap:!1}}),be=new w({props:{title:"Space persistence demo",local:"space-persistence-demo",headingTag:"h4"}}),_e=new w({props:{title:"Custom uploads",local:"custom-uploads",headingTag:"h4"}}),Je=new y({props:{code:"Y2xhc3MlMjBaaXBTY2hlZHVsZXIoQ29tbWl0U2NoZWR1bGVyKSUzQSUwQSUyMCUyMCUyMCUyMGRlZiUyMHB1c2hfdG9faHViKHNlbGYpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwMS4lMjBMaXN0JTIwUE5HJTIwZmlsZXMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwbmdfZmlsZXMlMjAlM0QlMjBsaXN0KHNlbGYuZm9sZGVyX3BhdGguZ2xvYiglMjIqLnBuZyUyMikpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWYlMjBsZW4ocG5nX2ZpbGVzKSUyMCUzRCUzRCUyMDAlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBOb25lJTIwJTIwJTIzJTIwcmV0dXJuJTIwZWFybHklMjBpZiUyMG5vdGhpbmclMjB0byUyMGNvbW1pdCUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMDIuJTIwWmlwJTIwcG5nJTIwZmlsZXMlMjBpbiUyMGElMjBzaW5nbGUlMjBhcmNoaXZlJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwd2l0aCUyMHRlbXBmaWxlLlRlbXBvcmFyeURpcmVjdG9yeSgpJTIwYXMlMjB0bXBkaXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhcmNoaXZlX3BhdGglMjAlM0QlMjBQYXRoKHRtcGRpciklMjAlMkYlMjAlMjJ0cmFpbi56aXAlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3aXRoJTIwemlwZmlsZS5aaXBGaWxlKGFyY2hpdmVfcGF0aCUyQyUyMCUyMnclMjIlMkMlMjB6aXBmaWxlLlpJUF9ERUZMQVRFRCklMjBhcyUyMHppcCUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZvciUyMHBuZ19maWxlJTIwaW4lMjBwbmdfZmlsZXMlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB6aXAud3JpdGUoZmlsZW5hbWUlM0RwbmdfZmlsZSUyQyUyMGFyY25hbWUlM0RwbmdfZmlsZS5uYW1lKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMDMuJTIwVXBsb2FkJTIwYXJjaGl2ZSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNlbGYuYXBpLnVwbG9hZF9maWxlKC4uLiUyQyUyMHBhdGhfb3JfZmlsZW9iaiUzRGFyY2hpdmVfcGF0aCklMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjA0LiUyMERlbGV0ZSUyMGxvY2FsJTIwcG5nJTIwZmlsZXMlMjB0byUyMGF2b2lkJTIwcmUtdXBsb2FkaW5nJTIwdGhlbSUyMGxhdGVyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwcG5nX2ZpbGUlMjBpbiUyMHBuZ19maWxlcyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHBuZ19maWxlLnVubGluaygp",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">ZipScheduler</span>(<span class="hljs-title class_ inherited__">CommitScheduler</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">push_to_hub</span>(<span class="hljs-params">self</span>):
        <span class="hljs-comment"># 1. List PNG files</span>
          png_files = <span class="hljs-built_in">list</span>(self.folder_path.glob(<span class="hljs-string">&quot;*.png&quot;</span>))
          <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(png_files) == <span class="hljs-number">0</span>:
              <span class="hljs-keyword">return</span> <span class="hljs-literal">None</span>  <span class="hljs-comment"># return early if nothing to commit</span>

        <span class="hljs-comment"># 2. Zip png files in a single archive</span>
        <span class="hljs-keyword">with</span> tempfile.TemporaryDirectory() <span class="hljs-keyword">as</span> tmpdir:
            archive_path = Path(tmpdir) / <span class="hljs-string">&quot;train.zip&quot;</span>
            <span class="hljs-keyword">with</span> zipfile.ZipFile(archive_path, <span class="hljs-string">&quot;w&quot;</span>, zipfile.ZIP_DEFLATED) <span class="hljs-keyword">as</span> <span class="hljs-built_in">zip</span>:
                <span class="hljs-keyword">for</span> png_file <span class="hljs-keyword">in</span> png_files:
                    <span class="hljs-built_in">zip</span>.write(filename=png_file, arcname=png_file.name)

            <span class="hljs-comment"># 3. Upload archive</span>
            self.api.upload_file(..., path_or_fileobj=archive_path)

        <span class="hljs-comment"># 4. Delete local png files to avoid re-uploading them later</span>
        <span class="hljs-keyword">for</span> png_file <span class="hljs-keyword">in</span> png_files:
            png_file.unlink()`,wrap:!1}}),J=new jt({props:{$$slots:{default:[en]},$$scope:{ctx:_}}}),$e=new w({props:{title:"create_commit",local:"createcommit",headingTag:"h3"}}),He=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTJDJTIwQ29tbWl0T3BlcmF0aW9uQWRkJTJDJTIwQ29tbWl0T3BlcmF0aW9uRGVsZXRlJTBBYXBpJTIwJTNEJTIwSGZBcGkoKSUwQW9wZXJhdGlvbnMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjBDb21taXRPcGVyYXRpb25BZGQocGF0aF9pbl9yZXBvJTNEJTIyTElDRU5TRS5tZCUyMiUyQyUyMHBhdGhfb3JfZmlsZW9iaiUzRCUyMn4lMkZyZXBvJTJGTElDRU5TRS5tZCUyMiklMkMlMEElMjAlMjAlMjAlMjBDb21taXRPcGVyYXRpb25BZGQocGF0aF9pbl9yZXBvJTNEJTIyd2VpZ2h0cy5oNSUyMiUyQyUyMHBhdGhfb3JfZmlsZW9iaiUzRCUyMn4lMkZyZXBvJTJGd2VpZ2h0cy1maW5hbC5oNSUyMiklMkMlMEElMjAlMjAlMjAlMjBDb21taXRPcGVyYXRpb25EZWxldGUocGF0aF9pbl9yZXBvJTNEJTIyb2xkLXdlaWdodHMuaDUlMjIpJTJDJTBBJTIwJTIwJTIwJTIwQ29tbWl0T3BlcmF0aW9uRGVsZXRlKHBhdGhfaW5fcmVwbyUzRCUyMmxvZ3MlMkYlMjIpJTJDJTBBJTIwJTIwJTIwJTIwQ29tbWl0T3BlcmF0aW9uQ29weShzcmNfcGF0aF9pbl9yZXBvJTNEJTIyaW1hZ2UucG5nJTIyJTJDJTIwcGF0aF9pbl9yZXBvJTNEJTIyZHVwbGljYXRlX2ltYWdlLnBuZyUyMiklMkMlMEElNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi, CommitOperationAdd, CommitOperationDelete
<span class="hljs-meta">&gt;&gt;&gt; </span>api = HfApi()
<span class="hljs-meta">&gt;&gt;&gt; </span>operations = [
<span class="hljs-meta">... </span>    CommitOperationAdd(path_in_repo=<span class="hljs-string">&quot;LICENSE.md&quot;</span>, path_or_fileobj=<span class="hljs-string">&quot;~/repo/LICENSE.md&quot;</span>),
<span class="hljs-meta">... </span>    CommitOperationAdd(path_in_repo=<span class="hljs-string">&quot;weights.h5&quot;</span>, path_or_fileobj=<span class="hljs-string">&quot;~/repo/weights-final.h5&quot;</span>),
<span class="hljs-meta">... </span>    CommitOperationDelete(path_in_repo=<span class="hljs-string">&quot;old-weights.h5&quot;</span>),
<span class="hljs-meta">... </span>    CommitOperationDelete(path_in_repo=<span class="hljs-string">&quot;logs/&quot;</span>),
<span class="hljs-meta">... </span>    CommitOperationCopy(src_path_in_repo=<span class="hljs-string">&quot;image.png&quot;</span>, path_in_repo=<span class="hljs-string">&quot;duplicate_image.png&quot;</span>),
<span class="hljs-meta">... </span>]`,wrap:!1}}),Be=new y({props:{code:"YXBpLmNyZWF0ZV9jb21taXQoJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMmx5c2FuZHJlJTJGdGVzdC1tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMG9wZXJhdGlvbnMlM0RvcGVyYXRpb25zJTJDJTBBJTIwJTIwJTIwJTIwY29tbWl0X21lc3NhZ2UlM0QlMjJVcGxvYWQlMjBteSUyMG1vZGVsJTIwd2VpZ2h0cyUyMGFuZCUyMGxpY2Vuc2UlMjIlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>api.create_commit(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;lysandre/test-model&quot;</span>,
<span class="hljs-meta">... </span>    operations=operations,
<span class="hljs-meta">... </span>    commit_message=<span class="hljs-string">&quot;Upload my model weights and license&quot;</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),Re=new w({props:{title:"Preupload LFS files before commit",local:"preupload-lfs-files-before-commit",headingTag:"h3"}}),v=new jt({props:{warning:!0,$$slots:{default:[tn]},$$scope:{ctx:_}}}),Le=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMENvbW1pdE9wZXJhdGlvbkFkZCUyQyUyMHByZXVwbG9hZF9sZnNfZmlsZXMlMkMlMjBjcmVhdGVfY29tbWl0JTJDJTIwY3JlYXRlX3JlcG8lMEElMEFyZXBvX2lkJTIwJTNEJTIwY3JlYXRlX3JlcG8oJTIydGVzdF9wcmV1cGxvYWQlMjIpLnJlcG9faWQlMEElMEFvcGVyYXRpb25zJTIwJTNEJTIwJTVCJTVEJTIwJTIzJTIwTGlzdCUyMG9mJTIwYWxsJTIwJTYwQ29tbWl0T3BlcmF0aW9uQWRkJTYwJTIwb2JqZWN0cyUyMHRoYXQlMjB3aWxsJTIwYmUlMjBnZW5lcmF0ZWQlMEFmb3IlMjBpJTIwaW4lMjByYW5nZSg1KSUzQSUwQSUyMCUyMCUyMCUyMGNvbnRlbnQlMjAlM0QlMjAuLi4lMjAlMjMlMjBnZW5lcmF0ZSUyMGJpbmFyeSUyMGNvbnRlbnQlMEElMjAlMjAlMjAlMjBhZGRpdGlvbiUyMCUzRCUyMENvbW1pdE9wZXJhdGlvbkFkZChwYXRoX2luX3JlcG8lM0RmJTIyc2hhcmRfJTdCaSU3RF9vZl81LmJpbiUyMiUyQyUyMHBhdGhfb3JfZmlsZW9iaiUzRGNvbnRlbnQpJTBBJTIwJTIwJTIwJTIwcHJldXBsb2FkX2xmc19maWxlcyhyZXBvX2lkJTJDJTIwYWRkaXRpb25zJTNEJTVCYWRkaXRpb24lNUQpJTBBJTIwJTIwJTIwJTIwb3BlcmF0aW9ucy5hcHBlbmQoYWRkaXRpb24pJTBBJTBBJTIzJTIwQ3JlYXRlJTIwY29tbWl0JTBBY3JlYXRlX2NvbW1pdChyZXBvX2lkJTJDJTIwb3BlcmF0aW9ucyUzRG9wZXJhdGlvbnMlMkMlMjBjb21taXRfbWVzc2FnZSUzRCUyMkNvbW1pdCUyMGFsbCUyMHNoYXJkcyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> CommitOperationAdd, preupload_lfs_files, create_commit, create_repo

<span class="hljs-meta">&gt;&gt;&gt; </span>repo_id = create_repo(<span class="hljs-string">&quot;test_preupload&quot;</span>).repo_id

<span class="hljs-meta">&gt;&gt;&gt; </span>operations = [] <span class="hljs-comment"># List of all \`CommitOperationAdd\` objects that will be generated</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">5</span>):
<span class="hljs-meta">... </span>    content = ... <span class="hljs-comment"># generate binary content</span>
<span class="hljs-meta">... </span>    addition = CommitOperationAdd(path_in_repo=<span class="hljs-string">f&quot;shard_<span class="hljs-subst">{i}</span>_of_5.bin&quot;</span>, path_or_fileobj=content)
<span class="hljs-meta">... </span>    preupload_lfs_files(repo_id, additions=[addition])
<span class="hljs-meta">... </span>    operations.append(addition)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Create commit</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>create_commit(repo_id, operations=operations, commit_message=<span class="hljs-string">&quot;Commit all shards&quot;</span>)`,wrap:!1}}),Fe=new w({props:{title:"Tips and tricks for large uploads",local:"tips-and-tricks-for-large-uploads",headingTag:"h2"}}),$=new jt({props:{warning:!0,$$slots:{default:[an]},$$scope:{ctx:_}}}),qe=new w({props:{title:"(legacy) Upload files with Git LFS",local:"legacy-upload-files-with-git-lfs",headingTag:"h2"}}),k=new jt({props:{warning:!0,$$slots:{default:[sn]},$$scope:{ctx:_}}}),Pe=new y({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbGZzLWVuYWJsZS1sYXJnZWZpbGVz",highlighted:"huggingface-cli lfs-enable-largefiles",wrap:!1}}),Ke=new w({props:{title:"commit context manager",local:"commit-context-manager",headingTag:"h3"}}),tt=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMFJlcG9zaXRvcnklMEF3aXRoJTIwUmVwb3NpdG9yeShsb2NhbF9kaXIlM0QlMjJ0ZXh0LWZpbGVzJTIyJTJDJTIwY2xvbmVfZnJvbSUzRCUyMiUzQ3VzZXIlM0UlMkZ0ZXh0LWZpbGVzJTIyKS5jb21taXQoY29tbWl0X21lc3NhZ2UlM0QlMjJNeSUyMGZpcnN0JTIwZmlsZSUyMCUzQSklMjIpJTNBJTBBJTIwJTIwJTIwJTIwd2l0aCUyMG9wZW4oJTIyZmlsZS50eHQlMjIlMkMlMjAlMjJ3JTJCJTIyKSUyMGFzJTIwZiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGYud3JpdGUoanNvbi5kdW1wcyglN0IlMjJoZXklMjIlM0ElMjA4JTdEKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> Repository
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> Repository(local_dir=<span class="hljs-string">&quot;text-files&quot;</span>, clone_from=<span class="hljs-string">&quot;&lt;user&gt;/text-files&quot;</span>).commit(commit_message=<span class="hljs-string">&quot;My first file :)&quot;</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;file.txt&quot;</span>, <span class="hljs-string">&quot;w+&quot;</span>) <span class="hljs-keyword">as</span> f:
<span class="hljs-meta">... </span>        f.write(json.dumps({<span class="hljs-string">&quot;hey&quot;</span>: <span class="hljs-number">8</span>}))`,wrap:!1}}),st=new y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFtb2RlbCUyMCUzRCUyMHRvcmNoLm5uLlRyYW5zZm9ybWVyKCklMEF3aXRoJTIwUmVwb3NpdG9yeSglMjJ0b3JjaC1tb2RlbCUyMiUyQyUyMGNsb25lX2Zyb20lM0QlMjIlM0N1c2VyJTNFJTJGdG9yY2gtbW9kZWwlMjIlMkMlMjB0b2tlbiUzRFRydWUpLmNvbW1pdChjb21taXRfbWVzc2FnZSUzRCUyMk15JTIwY29vbCUyMG1vZGVsJTIwJTNBKSUyMiklM0ElMEElMjAlMjAlMjAlMjB0b3JjaC5zYXZlKG1vZGVsLnN0YXRlX2RpY3QoKSUyQyUyMCUyMm1vZGVsLnB0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span>model = torch.nn.Transformer()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> Repository(<span class="hljs-string">&quot;torch-model&quot;</span>, clone_from=<span class="hljs-string">&quot;&lt;user&gt;/torch-model&quot;</span>, token=<span class="hljs-literal">True</span>).commit(commit_message=<span class="hljs-string">&quot;My cool model :)&quot;</span>):
<span class="hljs-meta">... </span>    torch.save(model.state_dict(), <span class="hljs-string">&quot;model.pt&quot;</span>)`,wrap:!1}}),nt=new y({props:{code:"d2l0aCUyMHJlcG8uY29tbWl0KGNvbW1pdF9tZXNzYWdlJTNEJTIyTXklMjBjb29sJTIwbW9kZWwlMjAlM0EpJTIyJTJDJTIwYmxvY2tpbmclM0RGYWxzZSk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> repo.commit(commit_message=<span class="hljs-string">&quot;My cool model :)&quot;</span>, blocking=<span class="hljs-literal">False</span>)',wrap:!1}}),it=new y({props:{code:"bGFzdF9jb21tYW5kJTIwJTNEJTIwcmVwby5jb21tYW5kX3F1ZXVlJTVCLTElNUQlMEFsYXN0X2NvbW1hbmQuc3RhdHVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>last_command = repo.command_queue[-<span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>last_command.status`,wrap:!1}}),ht=new y({props:{code:"bGFzdF9jb21tYW5kLnN0ZGVyciUwQSUwQWxhc3RfY29tbWFuZC5pc19kb25lJTBBJTBBbGFzdF9jb21tYW5kLmZhaWxlZA==",highlighted:`<span class="hljs-comment"># Inspect an error.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>last_command.stderr

<span class="hljs-comment"># Check whether a push is completed or ongoing.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>last_command.is_done

<span class="hljs-comment"># Check whether a push command has errored.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>last_command.failed`,wrap:!1}}),ut=new w({props:{title:"push_to_hub",local:"pushtohub",headingTag:"h3"}}),mt=new y({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMFJlcG9zaXRvcnklMEFyZXBvJTIwJTNEJTIwUmVwb3NpdG9yeShsb2NhbF9kaXIlM0QlMjJwYXRoJTJGdG8lMkZsb2NhbCUyRnJlcG8lMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> Repository
<span class="hljs-meta">&gt;&gt;&gt; </span>repo = Repository(local_dir=<span class="hljs-string">&quot;path/to/local/repo&quot;</span>)`,wrap:!1}}),yt=new y({props:{code:"cmVwby5naXRfcHVsbCgpJTBBcmVwby5wdXNoX3RvX2h1Yihjb21taXRfbWVzc2FnZSUzRCUyMkNvbW1pdCUyMG15LWF3ZXNvbWUtZmlsZSUyMHRvJTIwdGhlJTIwSHViJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>repo.git_pull()
<span class="hljs-meta">&gt;&gt;&gt; </span>repo.push_to_hub(commit_message=<span class="hljs-string">&quot;Commit my-awesome-file to the Hub&quot;</span>)`,wrap:!1}}),bt=new y({props:{code:"cmVwby5naXRfYWRkKCUyMnBhdGglMkZ0byUyRmZpbGUlMjIpJTBBcmVwby5naXRfY29tbWl0KGNvbW1pdF9tZXNzYWdlJTNEJTIyYWRkJTIwbXklMjBmaXJzdCUyMG1vZGVsJTIwY29uZmlnJTIwZmlsZSUyMCUzQSklMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>repo.git_add(<span class="hljs-string">&quot;path/to/file&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>repo.git_commit(commit_message=<span class="hljs-string">&quot;add my first model config file :)&quot;</span>)`,wrap:!1}}),_t=new y({props:{code:"cmVwby5naXRfcHVzaCgp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>repo.git_push()',wrap:!1}}),Tt=new Dl({props:{source:"https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/guides/upload.md"}}),{c(){r=o("meta"),M=l(),g=o("p"),b=l(),c(I.$$.fragment),vt=l(),C=o("p"),C.innerHTML=Is,$t=l(),Z=o("ul"),Z.innerHTML=Cs,kt=l(),G=o("p"),G.innerHTML=Zs,It=l(),c(H.$$.fragment),Ct=l(),B=o("p"),B.innerHTML=Gs,Zt=l(),X=o("p"),X.innerHTML=Hs,Gt=l(),c(A.$$.fragment),Ht=l(),c(W.$$.fragment),Bt=l(),R=o("p"),R.innerHTML=Bs,Xt=l(),c(x.$$.fragment),At=l(),S=o("p"),S.innerHTML=Xs,Wt=l(),L=o("p"),L.innerHTML=As,Rt=l(),Y=o("p"),Y.innerHTML=Ws,xt=l(),c(F.$$.fragment),St=l(),E=o("p"),E.innerHTML=Rs,Lt=l(),V=o("p"),V.innerHTML=xs,Yt=l(),c(N.$$.fragment),Ft=l(),c(q.$$.fragment),Et=l(),Q=o("p"),Q.innerHTML=Ss,Vt=l(),z=o("p"),z.textContent=Ls,Nt=l(),c(P.$$.fragment),qt=l(),D=o("p"),D.innerHTML=Ys,Qt=l(),K=o("p"),K.innerHTML=Fs,zt=l(),c(O.$$.fragment),Pt=l(),ee=o("p"),ee.innerHTML=Es,Dt=l(),c(te.$$.fragment),Kt=l(),ae=o("p"),ae.innerHTML=Vs,Ot=l(),c(se.$$.fragment),ea=l(),c(T.$$.fragment),ta=l(),le=o("p"),le.innerHTML=Ns,aa=l(),c(ne.$$.fragment),sa=l(),c(oe.$$.fragment),la=l(),ie=o("p"),ie.innerHTML=qs,na=l(),pe=o("p"),pe.innerHTML=Qs,oa=l(),re=o("p"),re.innerHTML=zs,ia=l(),c(ce.$$.fragment),pa=l(),he=o("p"),he.innerHTML=Ps,ra=l(),c(j.$$.fragment),ca=l(),c(ue.$$.fragment),ha=l(),de=o("p"),de.innerHTML=Ds,ua=l(),fe=o("p"),fe.innerHTML=Ks,da=l(),c(me.$$.fragment),fa=l(),ge=o("p"),ge.textContent=Os,ma=l(),ye=o("p"),ye.innerHTML=el,ga=l(),Me=o("ul"),Me.innerHTML=tl,ya=l(),c(be.$$.fragment),Ma=l(),we=o("p"),we.innerHTML=al,ba=l(),c(_e.$$.fragment),wa=l(),Te=o("p"),Te.innerHTML=sl,_a=l(),je=o("p"),je.innerHTML=ll,Ta=l(),c(Je.$$.fragment),ja=l(),Ue=o("p"),Ue.innerHTML=nl,Ja=l(),ve=o("ul"),ve.innerHTML=ol,Ua=l(),c(J.$$.fragment),va=l(),c($e.$$.fragment),$a=l(),ke=o("p"),ke.innerHTML=il,ka=l(),Ie=o("p"),Ie.innerHTML=pl,Ia=l(),Ce=o("ul"),Ce.innerHTML=rl,Ca=l(),Ze=o("p"),Ze.textContent=cl,Za=l(),Ge=o("ol"),Ge.innerHTML=hl,Ga=l(),c(He.$$.fragment),Ha=l(),U=o("ol"),U.innerHTML=ul,Ba=l(),c(Be.$$.fragment),Xa=l(),Xe=o("p"),Xe.innerHTML=dl,Aa=l(),Ae=o("ul"),Ae.innerHTML=fl,Wa=l(),We=o("p"),We.innerHTML=ml,Ra=l(),c(Re.$$.fragment),xa=l(),xe=o("p"),xe.innerHTML=gl,Sa=l(),c(v.$$.fragment),La=l(),Se=o("p"),Se.textContent=yl,Ya=l(),c(Le.$$.fragment),Fa=l(),Ye=o("p"),Ye.innerHTML=Ml,Ea=l(),c(Fe.$$.fragment),Va=l(),Ee=o("p"),Ee.textContent=bl,Na=l(),Ve=o("p"),Ve.innerHTML=wl,qa=l(),Ne=o("ul"),Ne.innerHTML=_l,Qa=l(),c($.$$.fragment),za=l(),c(qe.$$.fragment),Pa=l(),Qe=o("p"),Qe.innerHTML=Tl,Da=l(),c(k.$$.fragment),Ka=l(),ze=o("p"),ze.textContent=jl,Oa=l(),c(Pe.$$.fragment),es=l(),De=o("p"),De.textContent=Jl,ts=l(),c(Ke.$$.fragment),as=l(),Oe=o("p"),Oe.innerHTML=Ul,ss=l(),et=o("ol"),et.innerHTML=vl,ls=l(),c(tt.$$.fragment),ns=l(),at=o("p"),at.innerHTML=$l,os=l(),c(st.$$.fragment),is=l(),lt=o("p"),lt.innerHTML=kl,ps=l(),c(nt.$$.fragment),rs=l(),ot=o("p"),ot.innerHTML=Il,cs=l(),c(it.$$.fragment),hs=l(),pt=o("p"),pt.textContent=Cl,us=l(),rt=o("table"),rt.innerHTML=Zl,ds=l(),ct=o("p"),ct.innerHTML=Gl,fs=l(),c(ht.$$.fragment),ms=l(),c(ut.$$.fragment),gs=l(),dt=o("p"),dt.innerHTML=Hl,ys=l(),ft=o("p"),ft.innerHTML=Bl,Ms=l(),c(mt.$$.fragment),bs=l(),gt=o("p"),gt.innerHTML=Xl,ws=l(),c(yt.$$.fragment),_s=l(),Mt=o("p"),Mt.innerHTML=Al,Ts=l(),c(bt.$$.fragment),js=l(),wt=o("p"),wt.innerHTML=Wl,Js=l(),c(_t.$$.fragment),Us=l(),c(Tt.$$.fragment),vs=l(),Ut=o("p"),this.h()},l(e){const t=zl("svelte-u9bgzb",document.head);r=i(t,"META",{name:!0,content:!0}),t.forEach(a),M=n(e),g=i(e,"P",{}),El(g).forEach(a),b=n(e),h(I.$$.fragment,e),vt=n(e),C=i(e,"P",{"data-svelte-h":!0}),p(C)!=="svelte-uu6wb2"&&(C.innerHTML=Is),$t=n(e),Z=i(e,"UL",{"data-svelte-h":!0}),p(Z)!=="svelte-bbzyby"&&(Z.innerHTML=Cs),kt=n(e),G=i(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-6kh510"&&(G.innerHTML=Zs),It=n(e),h(H.$$.fragment,e),Ct=n(e),B=i(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-1skkk26"&&(B.innerHTML=Gs),Zt=n(e),X=i(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-weizha"&&(X.innerHTML=Hs),Gt=n(e),h(A.$$.fragment,e),Ht=n(e),h(W.$$.fragment,e),Bt=n(e),R=i(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-zino1n"&&(R.innerHTML=Bs),Xt=n(e),h(x.$$.fragment,e),At=n(e),S=i(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-1rk8lnp"&&(S.innerHTML=Xs),Wt=n(e),L=i(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-1v7onvy"&&(L.innerHTML=As),Rt=n(e),Y=i(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-1nus7g8"&&(Y.innerHTML=Ws),xt=n(e),h(F.$$.fragment,e),St=n(e),E=i(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1jdk3x1"&&(E.innerHTML=Rs),Lt=n(e),V=i(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-j2fnkr"&&(V.innerHTML=xs),Yt=n(e),h(N.$$.fragment,e),Ft=n(e),h(q.$$.fragment,e),Et=n(e),Q=i(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-mwsq3u"&&(Q.innerHTML=Ss),Vt=n(e),z=i(e,"P",{"data-svelte-h":!0}),p(z)!=="svelte-sxpkdv"&&(z.textContent=Ls),Nt=n(e),h(P.$$.fragment,e),qt=n(e),D=i(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-1whpdih"&&(D.innerHTML=Ys),Qt=n(e),K=i(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-22tszs"&&(K.innerHTML=Fs),zt=n(e),h(O.$$.fragment,e),Pt=n(e),ee=i(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-1qtgphk"&&(ee.innerHTML=Es),Dt=n(e),h(te.$$.fragment,e),Kt=n(e),ae=i(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-nn3g3g"&&(ae.innerHTML=Vs),Ot=n(e),h(se.$$.fragment,e),ea=n(e),h(T.$$.fragment,e),ta=n(e),le=i(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-8rr734"&&(le.innerHTML=Ns),aa=n(e),h(ne.$$.fragment,e),sa=n(e),h(oe.$$.fragment,e),la=n(e),ie=i(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-bjmbj0"&&(ie.innerHTML=qs),na=n(e),pe=i(e,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-pwsrx3"&&(pe.innerHTML=Qs),oa=n(e),re=i(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-p68hnq"&&(re.innerHTML=zs),ia=n(e),h(ce.$$.fragment,e),pa=n(e),he=i(e,"P",{"data-svelte-h":!0}),p(he)!=="svelte-1whdmnk"&&(he.innerHTML=Ps),ra=n(e),h(j.$$.fragment,e),ca=n(e),h(ue.$$.fragment,e),ha=n(e),de=i(e,"P",{"data-svelte-h":!0}),p(de)!=="svelte-ruw06i"&&(de.innerHTML=Ds),ua=n(e),fe=i(e,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-162626o"&&(fe.innerHTML=Ks),da=n(e),h(me.$$.fragment,e),fa=n(e),ge=i(e,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-bk7nho"&&(ge.textContent=Os),ma=n(e),ye=i(e,"P",{"data-svelte-h":!0}),p(ye)!=="svelte-f138kh"&&(ye.innerHTML=el),ga=n(e),Me=i(e,"UL",{"data-svelte-h":!0}),p(Me)!=="svelte-1md1dub"&&(Me.innerHTML=tl),ya=n(e),h(be.$$.fragment,e),Ma=n(e),we=i(e,"P",{"data-svelte-h":!0}),p(we)!=="svelte-1ta3tci"&&(we.innerHTML=al),ba=n(e),h(_e.$$.fragment,e),wa=n(e),Te=i(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-zwijsd"&&(Te.innerHTML=sl),_a=n(e),je=i(e,"P",{"data-svelte-h":!0}),p(je)!=="svelte-2fhb7l"&&(je.innerHTML=ll),Ta=n(e),h(Je.$$.fragment,e),ja=n(e),Ue=i(e,"P",{"data-svelte-h":!0}),p(Ue)!=="svelte-122h7kg"&&(Ue.innerHTML=nl),Ja=n(e),ve=i(e,"UL",{"data-svelte-h":!0}),p(ve)!=="svelte-aam6c4"&&(ve.innerHTML=ol),Ua=n(e),h(J.$$.fragment,e),va=n(e),h($e.$$.fragment,e),$a=n(e),ke=i(e,"P",{"data-svelte-h":!0}),p(ke)!=="svelte-65aut0"&&(ke.innerHTML=il),ka=n(e),Ie=i(e,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-d265uc"&&(Ie.innerHTML=pl),Ia=n(e),Ce=i(e,"UL",{"data-svelte-h":!0}),p(Ce)!=="svelte-1p6k8uo"&&(Ce.innerHTML=rl),Ca=n(e),Ze=i(e,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-12aa4hm"&&(Ze.textContent=cl),Za=n(e),Ge=i(e,"OL",{"data-svelte-h":!0}),p(Ge)!=="svelte-fvcpkg"&&(Ge.innerHTML=hl),Ga=n(e),h(He.$$.fragment,e),Ha=n(e),U=i(e,"OL",{start:!0,"data-svelte-h":!0}),p(U)!=="svelte-16vkol8"&&(U.innerHTML=ul),Ba=n(e),h(Be.$$.fragment,e),Xa=n(e),Xe=i(e,"P",{"data-svelte-h":!0}),p(Xe)!=="svelte-1m3t7c6"&&(Xe.innerHTML=dl),Aa=n(e),Ae=i(e,"UL",{"data-svelte-h":!0}),p(Ae)!=="svelte-1mojap"&&(Ae.innerHTML=fl),Wa=n(e),We=i(e,"P",{"data-svelte-h":!0}),p(We)!=="svelte-bf72jo"&&(We.innerHTML=ml),Ra=n(e),h(Re.$$.fragment,e),xa=n(e),xe=i(e,"P",{"data-svelte-h":!0}),p(xe)!=="svelte-14ajt9b"&&(xe.innerHTML=gl),Sa=n(e),h(v.$$.fragment,e),La=n(e),Se=i(e,"P",{"data-svelte-h":!0}),p(Se)!=="svelte-1mshy2g"&&(Se.textContent=yl),Ya=n(e),h(Le.$$.fragment,e),Fa=n(e),Ye=i(e,"P",{"data-svelte-h":!0}),p(Ye)!=="svelte-bb9v5s"&&(Ye.innerHTML=Ml),Ea=n(e),h(Fe.$$.fragment,e),Va=n(e),Ee=i(e,"P",{"data-svelte-h":!0}),p(Ee)!=="svelte-xzslhr"&&(Ee.textContent=bl),Na=n(e),Ve=i(e,"P",{"data-svelte-h":!0}),p(Ve)!=="svelte-r0dbxq"&&(Ve.innerHTML=wl),qa=n(e),Ne=i(e,"UL",{"data-svelte-h":!0}),p(Ne)!=="svelte-16tntjq"&&(Ne.innerHTML=_l),Qa=n(e),h($.$$.fragment,e),za=n(e),h(qe.$$.fragment,e),Pa=n(e),Qe=i(e,"P",{"data-svelte-h":!0}),p(Qe)!=="svelte-1qij3jq"&&(Qe.innerHTML=Tl),Da=n(e),h(k.$$.fragment,e),Ka=n(e),ze=i(e,"P",{"data-svelte-h":!0}),p(ze)!=="svelte-ckpv1u"&&(ze.textContent=jl),Oa=n(e),h(Pe.$$.fragment,e),es=n(e),De=i(e,"P",{"data-svelte-h":!0}),p(De)!=="svelte-1su1bae"&&(De.textContent=Jl),ts=n(e),h(Ke.$$.fragment,e),as=n(e),Oe=i(e,"P",{"data-svelte-h":!0}),p(Oe)!=="svelte-1euyrt0"&&(Oe.innerHTML=Ul),ss=n(e),et=i(e,"OL",{"data-svelte-h":!0}),p(et)!=="svelte-jfle7b"&&(et.innerHTML=vl),ls=n(e),h(tt.$$.fragment,e),ns=n(e),at=i(e,"P",{"data-svelte-h":!0}),p(at)!=="svelte-1pjnw9q"&&(at.innerHTML=$l),os=n(e),h(st.$$.fragment,e),is=n(e),lt=i(e,"P",{"data-svelte-h":!0}),p(lt)!=="svelte-1t3cobo"&&(lt.innerHTML=kl),ps=n(e),h(nt.$$.fragment,e),rs=n(e),ot=i(e,"P",{"data-svelte-h":!0}),p(ot)!=="svelte-147hmo"&&(ot.innerHTML=Il),cs=n(e),h(it.$$.fragment,e),hs=n(e),pt=i(e,"P",{"data-svelte-h":!0}),p(pt)!=="svelte-i7szos"&&(pt.textContent=Cl),us=n(e),rt=i(e,"TABLE",{"data-svelte-h":!0}),p(rt)!=="svelte-13yxo7x"&&(rt.innerHTML=Zl),ds=n(e),ct=i(e,"P",{"data-svelte-h":!0}),p(ct)!=="svelte-1j9orlr"&&(ct.innerHTML=Gl),fs=n(e),h(ht.$$.fragment,e),ms=n(e),h(ut.$$.fragment,e),gs=n(e),dt=i(e,"P",{"data-svelte-h":!0}),p(dt)!=="svelte-1v1fkxc"&&(dt.innerHTML=Hl),ys=n(e),ft=i(e,"P",{"data-svelte-h":!0}),p(ft)!=="svelte-ou5qb0"&&(ft.innerHTML=Bl),Ms=n(e),h(mt.$$.fragment,e),bs=n(e),gt=i(e,"P",{"data-svelte-h":!0}),p(gt)!=="svelte-1cex2oa"&&(gt.innerHTML=Xl),ws=n(e),h(yt.$$.fragment,e),_s=n(e),Mt=i(e,"P",{"data-svelte-h":!0}),p(Mt)!=="svelte-zvi4h4"&&(Mt.innerHTML=Al),Ts=n(e),h(bt.$$.fragment,e),js=n(e),wt=i(e,"P",{"data-svelte-h":!0}),p(wt)!=="svelte-rdm39v"&&(wt.innerHTML=Wl),Js=n(e),h(_t.$$.fragment,e),Us=n(e),h(Tt.$$.fragment,e),vs=n(e),Ut=i(e,"P",{}),El(Ut).forEach(a),this.h()},h(){ks(r,"name","hf:doc:metadata"),ks(r,"content",nn),ks(U,"start","2")},m(e,t){Pl(document.head,r),s(e,M,t),s(e,g,t),s(e,b,t),u(I,e,t),s(e,vt,t),s(e,C,t),s(e,$t,t),s(e,Z,t),s(e,kt,t),s(e,G,t),s(e,It,t),u(H,e,t),s(e,Ct,t),s(e,B,t),s(e,Zt,t),s(e,X,t),s(e,Gt,t),u(A,e,t),s(e,Ht,t),u(W,e,t),s(e,Bt,t),s(e,R,t),s(e,Xt,t),u(x,e,t),s(e,At,t),s(e,S,t),s(e,Wt,t),s(e,L,t),s(e,Rt,t),s(e,Y,t),s(e,xt,t),u(F,e,t),s(e,St,t),s(e,E,t),s(e,Lt,t),s(e,V,t),s(e,Yt,t),u(N,e,t),s(e,Ft,t),u(q,e,t),s(e,Et,t),s(e,Q,t),s(e,Vt,t),s(e,z,t),s(e,Nt,t),u(P,e,t),s(e,qt,t),s(e,D,t),s(e,Qt,t),s(e,K,t),s(e,zt,t),u(O,e,t),s(e,Pt,t),s(e,ee,t),s(e,Dt,t),u(te,e,t),s(e,Kt,t),s(e,ae,t),s(e,Ot,t),u(se,e,t),s(e,ea,t),u(T,e,t),s(e,ta,t),s(e,le,t),s(e,aa,t),u(ne,e,t),s(e,sa,t),u(oe,e,t),s(e,la,t),s(e,ie,t),s(e,na,t),s(e,pe,t),s(e,oa,t),s(e,re,t),s(e,ia,t),u(ce,e,t),s(e,pa,t),s(e,he,t),s(e,ra,t),u(j,e,t),s(e,ca,t),u(ue,e,t),s(e,ha,t),s(e,de,t),s(e,ua,t),s(e,fe,t),s(e,da,t),u(me,e,t),s(e,fa,t),s(e,ge,t),s(e,ma,t),s(e,ye,t),s(e,ga,t),s(e,Me,t),s(e,ya,t),u(be,e,t),s(e,Ma,t),s(e,we,t),s(e,ba,t),u(_e,e,t),s(e,wa,t),s(e,Te,t),s(e,_a,t),s(e,je,t),s(e,Ta,t),u(Je,e,t),s(e,ja,t),s(e,Ue,t),s(e,Ja,t),s(e,ve,t),s(e,Ua,t),u(J,e,t),s(e,va,t),u($e,e,t),s(e,$a,t),s(e,ke,t),s(e,ka,t),s(e,Ie,t),s(e,Ia,t),s(e,Ce,t),s(e,Ca,t),s(e,Ze,t),s(e,Za,t),s(e,Ge,t),s(e,Ga,t),u(He,e,t),s(e,Ha,t),s(e,U,t),s(e,Ba,t),u(Be,e,t),s(e,Xa,t),s(e,Xe,t),s(e,Aa,t),s(e,Ae,t),s(e,Wa,t),s(e,We,t),s(e,Ra,t),u(Re,e,t),s(e,xa,t),s(e,xe,t),s(e,Sa,t),u(v,e,t),s(e,La,t),s(e,Se,t),s(e,Ya,t),u(Le,e,t),s(e,Fa,t),s(e,Ye,t),s(e,Ea,t),u(Fe,e,t),s(e,Va,t),s(e,Ee,t),s(e,Na,t),s(e,Ve,t),s(e,qa,t),s(e,Ne,t),s(e,Qa,t),u($,e,t),s(e,za,t),u(qe,e,t),s(e,Pa,t),s(e,Qe,t),s(e,Da,t),u(k,e,t),s(e,Ka,t),s(e,ze,t),s(e,Oa,t),u(Pe,e,t),s(e,es,t),s(e,De,t),s(e,ts,t),u(Ke,e,t),s(e,as,t),s(e,Oe,t),s(e,ss,t),s(e,et,t),s(e,ls,t),u(tt,e,t),s(e,ns,t),s(e,at,t),s(e,os,t),u(st,e,t),s(e,is,t),s(e,lt,t),s(e,ps,t),u(nt,e,t),s(e,rs,t),s(e,ot,t),s(e,cs,t),u(it,e,t),s(e,hs,t),s(e,pt,t),s(e,us,t),s(e,rt,t),s(e,ds,t),s(e,ct,t),s(e,fs,t),u(ht,e,t),s(e,ms,t),u(ut,e,t),s(e,gs,t),s(e,dt,t),s(e,ys,t),s(e,ft,t),s(e,Ms,t),u(mt,e,t),s(e,bs,t),s(e,gt,t),s(e,ws,t),u(yt,e,t),s(e,_s,t),s(e,Mt,t),s(e,Ts,t),u(bt,e,t),s(e,js,t),s(e,wt,t),s(e,Js,t),u(_t,e,t),s(e,Us,t),u(Tt,e,t),s(e,vs,t),s(e,Ut,t),$s=!0},p(e,[t]){const Rl={};t&2&&(Rl.$$scope={dirty:t,ctx:e}),T.$set(Rl);const xl={};t&2&&(xl.$$scope={dirty:t,ctx:e}),j.$set(xl);const Sl={};t&2&&(Sl.$$scope={dirty:t,ctx:e}),J.$set(Sl);const Ll={};t&2&&(Ll.$$scope={dirty:t,ctx:e}),v.$set(Ll);const Yl={};t&2&&(Yl.$$scope={dirty:t,ctx:e}),$.$set(Yl);const Fl={};t&2&&(Fl.$$scope={dirty:t,ctx:e}),k.$set(Fl)},i(e){$s||(d(I.$$.fragment,e),d(H.$$.fragment,e),d(A.$$.fragment,e),d(W.$$.fragment,e),d(x.$$.fragment,e),d(F.$$.fragment,e),d(N.$$.fragment,e),d(q.$$.fragment,e),d(P.$$.fragment,e),d(O.$$.fragment,e),d(te.$$.fragment,e),d(se.$$.fragment,e),d(T.$$.fragment,e),d(ne.$$.fragment,e),d(oe.$$.fragment,e),d(ce.$$.fragment,e),d(j.$$.fragment,e),d(ue.$$.fragment,e),d(me.$$.fragment,e),d(be.$$.fragment,e),d(_e.$$.fragment,e),d(Je.$$.fragment,e),d(J.$$.fragment,e),d($e.$$.fragment,e),d(He.$$.fragment,e),d(Be.$$.fragment,e),d(Re.$$.fragment,e),d(v.$$.fragment,e),d(Le.$$.fragment,e),d(Fe.$$.fragment,e),d($.$$.fragment,e),d(qe.$$.fragment,e),d(k.$$.fragment,e),d(Pe.$$.fragment,e),d(Ke.$$.fragment,e),d(tt.$$.fragment,e),d(st.$$.fragment,e),d(nt.$$.fragment,e),d(it.$$.fragment,e),d(ht.$$.fragment,e),d(ut.$$.fragment,e),d(mt.$$.fragment,e),d(yt.$$.fragment,e),d(bt.$$.fragment,e),d(_t.$$.fragment,e),d(Tt.$$.fragment,e),$s=!0)},o(e){f(I.$$.fragment,e),f(H.$$.fragment,e),f(A.$$.fragment,e),f(W.$$.fragment,e),f(x.$$.fragment,e),f(F.$$.fragment,e),f(N.$$.fragment,e),f(q.$$.fragment,e),f(P.$$.fragment,e),f(O.$$.fragment,e),f(te.$$.fragment,e),f(se.$$.fragment,e),f(T.$$.fragment,e),f(ne.$$.fragment,e),f(oe.$$.fragment,e),f(ce.$$.fragment,e),f(j.$$.fragment,e),f(ue.$$.fragment,e),f(me.$$.fragment,e),f(be.$$.fragment,e),f(_e.$$.fragment,e),f(Je.$$.fragment,e),f(J.$$.fragment,e),f($e.$$.fragment,e),f(He.$$.fragment,e),f(Be.$$.fragment,e),f(Re.$$.fragment,e),f(v.$$.fragment,e),f(Le.$$.fragment,e),f(Fe.$$.fragment,e),f($.$$.fragment,e),f(qe.$$.fragment,e),f(k.$$.fragment,e),f(Pe.$$.fragment,e),f(Ke.$$.fragment,e),f(tt.$$.fragment,e),f(st.$$.fragment,e),f(nt.$$.fragment,e),f(it.$$.fragment,e),f(ht.$$.fragment,e),f(ut.$$.fragment,e),f(mt.$$.fragment,e),f(yt.$$.fragment,e),f(bt.$$.fragment,e),f(_t.$$.fragment,e),f(Tt.$$.fragment,e),$s=!1},d(e){e&&(a(M),a(g),a(b),a(vt),a(C),a($t),a(Z),a(kt),a(G),a(It),a(Ct),a(B),a(Zt),a(X),a(Gt),a(Ht),a(Bt),a(R),a(Xt),a(At),a(S),a(Wt),a(L),a(Rt),a(Y),a(xt),a(St),a(E),a(Lt),a(V),a(Yt),a(Ft),a(Et),a(Q),a(Vt),a(z),a(Nt),a(qt),a(D),a(Qt),a(K),a(zt),a(Pt),a(ee),a(Dt),a(Kt),a(ae),a(Ot),a(ea),a(ta),a(le),a(aa),a(sa),a(la),a(ie),a(na),a(pe),a(oa),a(re),a(ia),a(pa),a(he),a(ra),a(ca),a(ha),a(de),a(ua),a(fe),a(da),a(fa),a(ge),a(ma),a(ye),a(ga),a(Me),a(ya),a(Ma),a(we),a(ba),a(wa),a(Te),a(_a),a(je),a(Ta),a(ja),a(Ue),a(Ja),a(ve),a(Ua),a(va),a($a),a(ke),a(ka),a(Ie),a(Ia),a(Ce),a(Ca),a(Ze),a(Za),a(Ge),a(Ga),a(Ha),a(U),a(Ba),a(Xa),a(Xe),a(Aa),a(Ae),a(Wa),a(We),a(Ra),a(xa),a(xe),a(Sa),a(La),a(Se),a(Ya),a(Fa),a(Ye),a(Ea),a(Va),a(Ee),a(Na),a(Ve),a(qa),a(Ne),a(Qa),a(za),a(Pa),a(Qe),a(Da),a(Ka),a(ze),a(Oa),a(es),a(De),a(ts),a(as),a(Oe),a(ss),a(et),a(ls),a(ns),a(at),a(os),a(is),a(lt),a(ps),a(rs),a(ot),a(cs),a(hs),a(pt),a(us),a(rt),a(ds),a(ct),a(fs),a(ms),a(gs),a(dt),a(ys),a(ft),a(Ms),a(bs),a(gt),a(ws),a(_s),a(Mt),a(Ts),a(js),a(wt),a(Js),a(Us),a(vs),a(Ut)),a(r),m(I,e),m(H,e),m(A,e),m(W,e),m(x,e),m(F,e),m(N,e),m(q,e),m(P,e),m(O,e),m(te,e),m(se,e),m(T,e),m(ne,e),m(oe,e),m(ce,e),m(j,e),m(ue,e),m(me,e),m(be,e),m(_e,e),m(Je,e),m(J,e),m($e,e),m(He,e),m(Be,e),m(Re,e),m(v,e),m(Le,e),m(Fe,e),m($,e),m(qe,e),m(k,e),m(Pe,e),m(Ke,e),m(tt,e),m(st,e),m(nt,e),m(it,e),m(ht,e),m(ut,e),m(mt,e),m(yt,e),m(bt,e),m(_t,e),m(Tt,e)}}}const nn='{"title":"Upload files to the Hub","local":"upload-files-to-the-hub","sections":[{"title":"Upload a file","local":"upload-a-file","sections":[],"depth":2},{"title":"Upload a folder","local":"upload-a-folder","sections":[],"depth":2},{"title":"Upload from the CLI","local":"upload-from-the-cli","sections":[],"depth":2},{"title":"Advanced features","local":"advanced-features","sections":[{"title":"Non-blocking uploads","local":"non-blocking-uploads","sections":[],"depth":3},{"title":"Upload a folder by chunks","local":"upload-a-folder-by-chunks","sections":[],"depth":3},{"title":"Scheduled uploads","local":"scheduled-uploads","sections":[{"title":"Space persistence demo","local":"space-persistence-demo","sections":[],"depth":4},{"title":"Custom uploads","local":"custom-uploads","sections":[],"depth":4}],"depth":3},{"title":"create_commit","local":"createcommit","sections":[],"depth":3},{"title":"Preupload LFS files before commit","local":"preupload-lfs-files-before-commit","sections":[],"depth":3}],"depth":2},{"title":"Tips and tricks for large uploads","local":"tips-and-tricks-for-large-uploads","sections":[],"depth":2},{"title":"(legacy) Upload files with Git LFS","local":"legacy-upload-files-with-git-lfs","sections":[{"title":"commit context manager","local":"commit-context-manager","sections":[],"depth":3},{"title":"push_to_hub","local":"pushtohub","sections":[],"depth":3}],"depth":2}],"depth":1}';function on(_){return Nl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class dn extends ql{constructor(r){super(),Ql(this,r,on,ln,Vl,{})}}export{dn as component};
