Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Démarrage rapide","local":"démarrage-rapide","sections":[{"title":"Installation","local":"installation","sections":[],"depth":2},{"title":"Télécharger des fichiers","local":"télécharger-des-fichiers","sections":[],"depth":2},{"title":"Connexion","local":"connexion","sections":[],"depth":2},{"title":"Créer un dépôt","local":"créer-un-dépôt","sections":[],"depth":2},{"title":"Upload des fichiers","local":"upload-des-fichiers","sections":[],"depth":2},{"title":"Prochaines étapes","local":"prochaines-étapes","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/entry/start.b0bd549c.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/scheduler.b108d059.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/singletons.5a69d8ab.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/paths.b241aaa4.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/entry/app.4e4482a8.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/index.008de539.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/nodes/0.0ca93cc2.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/nodes/6.b8cf13dd.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/Tip.aeb15ab7.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/CodeBlock.3968c746.js"> | |
| <link rel="modulepreload" href="/docs/huggingface_hub/v0.28.0/fr/_app/immutable/chunks/EditOnGithub.d1c48e3d.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Démarrage rapide","local":"démarrage-rapide","sections":[{"title":"Installation","local":"installation","sections":[],"depth":2},{"title":"Télécharger des fichiers","local":"télécharger-des-fichiers","sections":[],"depth":2},{"title":"Connexion","local":"connexion","sections":[],"depth":2},{"title":"Créer un dépôt","local":"créer-un-dépôt","sections":[],"depth":2},{"title":"Upload des fichiers","local":"upload-des-fichiers","sections":[],"depth":2},{"title":"Prochaines étapes","local":"prochaines-étapes","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="démarrage-rapide" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#démarrage-rapide"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Démarrage rapide</span></h1> <p data-svelte-h="svelte-6b3hwu">Le <a href="https://huggingface.co/" rel="nofollow">Hugging Face Hub</a> est le meilleur endroit pour partager des | |
| modèles de machine learning, des démos, des datasets et des métriques. La librairie | |
| <code>huggingface_hub</code> vous aide à intéragir avec le Hub sans sortir de votre environnement de | |
| développement. Vous pouvez: créer et gérer des dépôts facilement, télécharger et upload des | |
| fichiers, et obtenir des modèles et des métadonnées depuis le Hub.</p> <h2 class="relative group"><a id="installation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#installation"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Installation</span></h2> <p data-svelte-h="svelte-1k070dg">Pour commencer, installez la librairie <code>huggingface_hub</code>:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->pip install --upgrade huggingface_hub<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-4xmb80">Pour plus de détails, vérifiez le guide d’<a href="installation">installation</a></p> <h2 class="relative group"><a id="télécharger-des-fichiers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#télécharger-des-fichiers"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Télécharger des fichiers</span></h2> <p data-svelte-h="svelte-n46jjv">Les dépôts sur le Hub utilisent le versioning Git, les utilisateurs peuvent | |
| télécharger un fichier, ou un dépôt entier. Vous pouvez utiliser la fonction <code>hf_hub_download()</code> | |
| pour télécharger des fichiers. Cette fonction téléchargera et mettra dans le cache un fichier | |
| sur votre disque local. La prochaine fois que vous aurez besoin de ce fichier, il sera chargé | |
| depuis votre cache de façon à ce que vous n’ayez pas besoin de le retélécharger.</p> <p data-svelte-h="svelte-1oy4jst">Vous aurez besoin de l’id du dépôt et du nom du fichier que vous voulez télécharger. | |
| Par exemple, pour télécharger le fichier de configuration du | |
| modèle <a href="https://huggingface.co/google/pegasus-xsum" rel="nofollow">Pegasus</a>:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download | |
| <span class="hljs-meta">>>> </span>hf_hub_download(repo_id=<span class="hljs-string">"google/pegasus-xsum"</span>, filename=<span class="hljs-string">"config.json"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ee72xi">Pour télécharger une version spécifique du fichier, utilisez le paramètre <code>revision</code> afin | |
| de spécifier le nom de la branche, le tag ou le hash de commit. Si vous décidez d’utiliser | |
| le hash de commit, vous devez renseigner le hash entier et pas le hash court de 7 caractères:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download | |
| <span class="hljs-meta">>>> </span>hf_hub_download( | |
| <span class="hljs-meta">... </span> repo_id=<span class="hljs-string">"google/pegasus-xsum"</span>, | |
| <span class="hljs-meta">... </span> filename=<span class="hljs-string">"config.json"</span>, | |
| <span class="hljs-meta">... </span> revision=<span class="hljs-string">"4d33b01d79672f27f001f6abade33f22d993b151"</span> | |
| <span class="hljs-meta">... </span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-11wlsdr">Pour plus de détails et d’options, consultez la réference de l’API pour <code>hf_hub_download()</code>.</p> <h2 class="relative group"><a id="connexion" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#connexion"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Connexion</span></h2> <p data-svelte-h="svelte-6x4jg6">Dans la plupart des cas, vous devez être connectés avec un compte Hugging Face pour interagir | |
| avec le Hub: pour télécharger des dépôts privés, upload des fichiers, créer des pull | |
| requests… | |
| <a href="https://huggingface.co/join" rel="nofollow">Créez un compte</a> si vous n’en avez pas déjà un et connectez | |
| vous pour obtenir votre <a href="https://huggingface.co/docs/hub/security-tokens" rel="nofollow">token d’authentification</a> | |
| depuis vos <a href="https://huggingface.co/settings/tokens" rel="nofollow">paramètres</a>. Le token | |
| est utilisé pour authentifier votre identité au Hub.</p> <p data-svelte-h="svelte-1xrtt5h">Une fois que vous avez votre token d’authentification, lancez la commande suivante | |
| dans votre terminal:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->huggingface-cli login | |
| <span class="hljs-comment"># ou en utilisant une varible d'environnement:</span> | |
| huggingface-cli login --token <span class="hljs-variable">$HUGGINGFACE_TOKEN</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-ubl5d0">Sinon, vous pouvez vous connecter en utilisant <code>login()</code> dans un notebook ou | |
| un script:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login | |
| <span class="hljs-meta">>>> </span>login()<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1u0rmnt">Il est aussi possible de se connecter automatiquement sans qu’on vous demande votre token en | |
| passant le token dans <code>login()</code> de cette manière: <code>login(token="hf_xxx")</code>. Si vous choisissez | |
| cette méthode, faites attention lorsque vous partagez votre code source. Une bonne pratique est | |
| de charger le token depuis un trousseau sécurisé au lieu de l’enregistrer en clair dans votre | |
| codebase/notebook.</p> <p data-svelte-h="svelte-1w7r1cm">Vous ne pouvez être connecté qu’à un seul compte à la fois. Si vous connectez votre machine à un autre compte, | |
| vous serez déconnecté du premier compte. Vérifiez toujours le compte que vous utilisez avec la commande | |
| <code>huggingface-cli whoami</code>. Si vous voulez gérer plusieurs compte dans le même script, vous pouvez passer votre | |
| token à chaque appel de méthode. C’est aussi utile si vous ne voulez pas sauvegarder de token sur votre machine.</p> <div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400"><p data-svelte-h="svelte-1sku1hd">Une fois que vous êtes connectés, toutes les requêtes vers le Hub (même les méthodes qui ne nécessite pas explicitement | |
| d’authentification) utiliseront votre token d’authentification par défaut. Si vous voulez supprimer l’utilisation implicite | |
| de votre token, vous devez définir la variable d’environnement <code>HF_HUB_DISABLE_IMPLICIT_TOKEN</code>.</p></div> <h2 class="relative group"><a id="créer-un-dépôt" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#créer-un-dépôt"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Créer un dépôt</span></h2> <p data-svelte-h="svelte-vgn2x0">Une fois que vous avez créé votre compte et que vous vous êtes connectés, | |
| vous pouvez créer un dépôt avec la fonction <code>create_repo()</code>:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi | |
| <span class="hljs-meta">>>> </span>api = HfApi() | |
| <span class="hljs-meta">>>> </span>api.create_repo(repo_id=<span class="hljs-string">"super-cool-model"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ta65i6">Si vous voulez que votre dépôt soit privé, alors:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi | |
| <span class="hljs-meta">>>> </span>api = HfApi() | |
| <span class="hljs-meta">>>> </span>api.create_repo(repo_id=<span class="hljs-string">"super-cool-model"</span>, private=<span class="hljs-literal">True</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-67hafi">Les dépôts privés ne seront visible que par vous.</p> <div class="course-tip bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400"><p data-svelte-h="svelte-1n7agz9">Pour créer un dépôt ou push du contenu sur le Hub, vous devez fournir un token | |
| d’authentification qui a les permissions <code>write</code>. Vous pouvez choisir la permission | |
| lorsque vous générez le token dans vos <a href="https://huggingface.co/settings/tokens" rel="nofollow">paramètres</a>.</p></div> <h2 class="relative group"><a id="upload-des-fichiers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#upload-des-fichiers"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Upload des fichiers</span></h2> <p data-svelte-h="svelte-fw41x7">Utilisez la fonction <code>upload_file()</code> pour ajouter un fichier à votre dépôt. | |
| Vous devez spécifier:</p> <ol data-svelte-h="svelte-1es6xpf"><li>Le chemin du fichier à upload.</li> <li>Le chemin du fichier dans le dépôt.</li> <li>L’id du dépôt dans lequel vous voulez ajouter le fichier.</li></ol> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi | |
| <span class="hljs-meta">>>> </span>api = HfApi() | |
| <span class="hljs-meta">>>> </span>api.upload_file( | |
| <span class="hljs-meta">... </span> path_or_fileobj=<span class="hljs-string">"/home/lysandre/dummy-test/README.md"</span>, | |
| <span class="hljs-meta">... </span> path_in_repo=<span class="hljs-string">"README.md"</span>, | |
| <span class="hljs-meta">... </span> repo_id=<span class="hljs-string">"lysandre/test-model"</span>, | |
| <span class="hljs-meta">... </span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-15uvkeu">Pour upload plus d’un fichier à la fois, consultez le guide <a href="./guides/upload">upload</a> | |
| qui détaille plusieurs méthodes pour upload des fichiers (avec ou sans Git).</p> <h2 class="relative group"><a id="prochaines-étapes" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#prochaines-étapes"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Prochaines étapes</span></h2> <p data-svelte-h="svelte-41bld2">La librairie <code>huggingface_hub</code> permet à ses utilisateurs d’intéragir facilementavec le Hub via | |
| Python. Pour en apprendre plus sur comment gérer vos fichiers | |
| et vos dépôts sur le Hub, nous vous recommandons de lire notre <a href="./guides/overview">guide conceptuel</a> | |
| pour :</p> <ul data-svelte-h="svelte-h4jsud"><li><a href="./guides/repository">Gérer votre dépôt</a>.</li> <li><a href="./guides/download">Télécharger</a> des fichiers depuis le Hub.</li> <li><a href="./guides/upload">Upload</a> des fichiers vers le Hub.</li> <li><a href="./guides/search">Faire des recherches dans le Hub</a> pour votre modèle ou dataset.</li> <li><a href="./guides/inference">Accédder à l’API d’inférence</a> pour faire des inférences rapides.</li></ul> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/huggingface_hub/blob/main/docs/source/fr/quick-start.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1gb6is7 = { | |
| assets: "/docs/huggingface_hub/v0.28.0/fr", | |
| base: "/docs/huggingface_hub/v0.28.0/fr", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/huggingface_hub/v0.28.0/fr/_app/immutable/entry/start.b0bd549c.js"), | |
| import("/docs/huggingface_hub/v0.28.0/fr/_app/immutable/entry/app.4e4482a8.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 6], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 31.5 kB
- Xet hash:
- a3f02686fef18535184a1aaf8ca1fc3cadde98a6e232d2006bb6c4da43aa02d2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.