Buckets:

hf-doc-build/doc / huggingface_hub /v0.28.0 /fr /installation.html
rtrm's picture
download
raw
38.4 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Installation&quot;,&quot;local&quot;:&quot;installation&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Installation avec pip&quot;,&quot;local&quot;:&quot;installation-avec-pip&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Installation des dépendances optionnelles&quot;,&quot;local&quot;:&quot;installation-des-dépendances-optionnelles&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Installation depuis le code source&quot;,&quot;local&quot;:&quot;installation-depuis-le-code-source&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Installation éditable&quot;,&quot;local&quot;:&quot;installation-éditable&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Installation avec conda&quot;,&quot;local&quot;:&quot;installation-avec-conda&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Vérification de l’installation&quot;,&quot;local&quot;:&quot;vérification-de-linstallation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Les limitations Windows&quot;,&quot;local&quot;:&quot;les-limitations-windows&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Prochaines étapes&quot;,&quot;local&quot;:&quot;prochaines-étapes&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;: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/5.a6b2f13a.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="{&quot;title&quot;:&quot;Installation&quot;,&quot;local&quot;:&quot;installation&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Installation avec pip&quot;,&quot;local&quot;:&quot;installation-avec-pip&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Installation des dépendances optionnelles&quot;,&quot;local&quot;:&quot;installation-des-dépendances-optionnelles&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Installation depuis le code source&quot;,&quot;local&quot;:&quot;installation-depuis-le-code-source&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Installation éditable&quot;,&quot;local&quot;:&quot;installation-éditable&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Installation avec conda&quot;,&quot;local&quot;:&quot;installation-avec-conda&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Vérification de l’installation&quot;,&quot;local&quot;:&quot;vérification-de-linstallation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Les limitations Windows&quot;,&quot;local&quot;:&quot;les-limitations-windows&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Prochaines étapes&quot;,&quot;local&quot;:&quot;prochaines-étapes&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 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></h1> <p data-svelte-h="svelte-s13zjo">Avant de commmencer, vous allez avoir besoin de préparer votre environnement
en installant les packages appropriés.</p> <p data-svelte-h="svelte-5jihu6"><code>huggingface_hub</code> est testée sur <strong>Python 3.8+</strong>.</p> <h2 class="relative group"><a id="installation-avec-pip" 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-avec-pip"><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 avec pip</span></h2> <p data-svelte-h="svelte-tea6lb">Il est fortement recommandé d’installer <code>huggingface_hub</code> dans un <a href="https://docs.python.org/3/library/venv.html" rel="nofollow">environnement virtuel</a>.
Si vous n’êtes pas familier avec les environnements virtuels Python, suivez ce <a href="https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/" rel="nofollow">guide</a>. Un environnement virtuel sera utile lorsque vous devrez gérer des plusieurs projets en parallèle
afin d’éviter les problèmes de compatibilité entre les différentes dépendances.</p> <p data-svelte-h="svelte-1mnf4ps">Commencez par créer un environnement virtuel à l’emplacement de votre projet:</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 -->python -m venv .<span class="hljs-built_in">env</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-2q5rx4">Activez l’environnement virtuel sur Linux et macOS:</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-built_in">source</span> .<span class="hljs-built_in">env</span>/bin/activate<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1gwox1v">Activez l’environnement virtuel sur Windows:</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-built_in">env</span>/Scripts/activate<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1673zdn">Maintenant, vous êtes prêts à installer <code>hugginface_hub</code> <a href="https://pypi.org/project/huggingface-hub/" rel="nofollow">depuis PyPi</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 -->pip install --upgrade huggingface_hub<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1sbnxfh">Une fois l’installation terminée, rendez-vous à la section <a href="#verification-de-l-installation">vérification</a> pour s’assurer que tout fonctionne correctement.</p> <h3 class="relative group"><a id="installation-des-dépendances-optionnelles" 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-des-dépendances-optionnelles"><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 des dépendances optionnelles</span></h3> <p data-svelte-h="svelte-141bs8r">Certaines dépendances de <code>huggingface_hub</code> sont <a href="https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies" rel="nofollow">optionnelles</a> car elles ne sont pas nécessaire pour faire marcher les fonctionnalités principales de <code>huggingface_hub</code>.
Toutefois, certaines fonctionnalités de <code>huggingface_hub</code> ne seront pas disponibles si les dépendancces optionnelles ne sont pas installées</p> <p data-svelte-h="svelte-8um1r4">Vous pouvez installer des dépendances optionelles via <code>pip</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-comment">#Installation des dépendances pour les fonctionnalités spécifiques à Tensorflow.</span>
<span class="hljs-comment">#/!\ Attention : cette commande n&#x27;est pas équivalente à `pip install tensorflow`.</span>
pip install <span class="hljs-string">&#x27;huggingface_hub[tensorflow]&#x27;</span>
<span class="hljs-comment">#Installation des dépendances spécifiques à Pytorch et au CLI.</span>
pip install <span class="hljs-string">&#x27;huggingface_hub[cli,torch]&#x27;</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1h8k3qg">Voici une liste des dépendances optionnelles dans <code>huggingface_hub</code>:</p> <ul data-svelte-h="svelte-aqy5e4"><li><code>cli</code> fournit une interface d’invite de commande plus pratique pour <code>huggingface_hub</code>.</li> <li><code>fastai</code>, <code>torch</code> et <code>tensorflow</code> sont des dépendances pour utiliser des fonctionnalités spécifiques à un framework.</li> <li><code>dev</code> permet de contribuer à la librairie. Cette dépendance inclut <code>testing</code> (pour lancer des tests), <code>typing</code> (pour lancer le vérifieur de type) et <code>quality</code> (pour lancer des linters).</li></ul> <h3 class="relative group"><a id="installation-depuis-le-code-source" 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-depuis-le-code-source"><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 depuis le code source</span></h3> <p data-svelte-h="svelte-ye2njz">Dans certains cas, il est intéressant d’installer <code>huggingface_hub</code> directement depuis le code source.
Ceci vous permet d’utiliser la version <code>main</code>, contenant les dernières mises à jour, plutôt que
d’utiliser la dernière version stable. La version <code>main</code> est utile pour rester à jour sur les
derniers développements, par exemple si un bug est corrigé depuis la dernière version officielle
mais que la nouvelle version n’a pas encore été faite.</p> <p data-svelte-h="svelte-df8459">Toutefois, cela signifie que la version <code>main</code> peut ne pas être stable. Nous travaillons
afin de rendre la version <code>main</code> aussi stable que possible, et la plupart des problèmes sont résolus
en quelques heures ou jours. Si vous avez un problème, ouvrez une issue afin que
nous puissions la régler au plus vite !</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 git+https://github.com/huggingface/huggingface_hub<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ns7q6i">Lorsque vous installez depuis le code source, vous pouvez préciser la branche depuis laquelle installer. Cela permet de tester une nouvelle fonctionnalité ou un bug-fix qui n’a pas encore été merge:</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 git+https://github.com/huggingface/huggingface_hub@ma-branche<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1sbnxfh">Une fois l’installation terminée, rendez-vous à la section <a href="#verification-de-l-installation">vérification</a> pour s’assurer que tout fonctionne correctement.</p> <h3 class="relative group"><a id="installation-éditable" 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-éditable"><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 éditable</span></h3> <p data-svelte-h="svelte-1jsfexj">L’installation depuis le code source vous permet de mettre en place une <a href="https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs" rel="nofollow">installation éditable</a>. Cette installation sert surtout si vous comptez contribuer à <code>huggingface_hub</code>
et que vous avez besoin de tester rapidement des changements dans le code. Pour cela, vous devez cloner le projet <code>huggingface_hub</code> sur votre machine.</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-comment"># Commencez par cloner le dépôt en local</span>
git <span class="hljs-built_in">clone</span> https://github.com/huggingface/huggingface_hub.git
<span class="hljs-comment"># Ensuite, installez-le avec le flag -e</span>
<span class="hljs-built_in">cd</span> huggingface_hub
pip install -e .<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1o8zr7m">Python regardera maintenant à l’intérieur du dossier dans lequel vous avez cloné le dépôt en
plus des chemins de librairie classiques. Par exemple, si vos packages Python sont installés dans
<code>./.venv/lib/python3.13/site-packages/</code>, Python regardera aussi dans le dossier que vous avez
cloné <code>./huggingface_hub/</code>.</p> <h2 class="relative group"><a id="installation-avec-conda" 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-avec-conda"><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 avec conda</span></h2> <p data-svelte-h="svelte-ovlp2s">Si vous avez plutôt l’habitude d’utiliser conda, vous pouvez installer <code>huggingface_hub</code> en utilisant le <a href="https://anaconda.org/conda-forge/huggingface_hub" rel="nofollow">channel conda-forge</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 -->conda install -c conda-forge huggingface_hub<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1sbnxfh">Une fois l’installation terminée, rendez-vous à la section <a href="#verification-de-l-installation">vérification</a> pour s’assurer que tout fonctionne correctement.</p> <h2 class="relative group"><a id="vérification-de-linstallation" 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="#vérification-de-linstallation"><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>Vérification de l’installation</span></h2> <p data-svelte-h="svelte-15y3ctj">Une fois installée, vérifiez que <code>huggingface_hub</code> marche correctement en lançant la commande suivante:</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 -->python -c <span class="hljs-string">&quot;from huggingface_hub import model_info; print(model_info(&#x27;gpt2&#x27;))&quot;</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-b6nkmx">Cette commande va récupérer des informations sur le modèle <a href="https://huggingface.co/gpt2" rel="nofollow">gpt2</a> depuis le Hub.
La sortie devrait ressembler à ç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 -->Model Name: gpt2
Tags: [&#x27;pytorch&#x27;, &#x27;tf&#x27;, &#x27;jax&#x27;, &#x27;tflite&#x27;, &#x27;rust&#x27;, &#x27;safetensors&#x27;, &#x27;gpt2&#x27;, &#x27;text-generation&#x27;, &#x27;en&#x27;, &#x27;doi:10.57967/hf/0039&#x27;, &#x27;transformers&#x27;, &#x27;exbert&#x27;, &#x27;license:mit&#x27;, &#x27;has_space&#x27;]
Task: text-generation<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="les-limitations-windows" 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="#les-limitations-windows"><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>Les limitations Windows</span></h2> <p data-svelte-h="svelte-mg6v8y">Afin de démocratiser le machine learning au plus grand nombre, nous avons développé <code>huggingface_hub</code>
de manière cross-platform et en particulier, pour qu’elle fonctionne sur une maximum de systèmes d’exploitation différents. Toutefois
<code>huggingface_hub</code> connaît dans certains cas des limitations sur Windows.
Nous avons listés ci-dessous les problèmes connus. N’hésitez pas à nous signaler si vous rencontrez un problème
non documenté en ouvrant une <a href="https://github.com/huggingface/huggingface_hub/issues/new/choose" rel="nofollow">issue sur Github</a>.</p> <ul data-svelte-h="svelte-ki92u7"><li>Le cache de <code>huggingface_hub</code> a besoin des symlinks pour mettre en cache les fichiers installé depuis le Hub.
Sur windows, vous devez activer le mode développeur pour lancer ou lancer votre script en tant qu’administrateur
afin de faire fonctionner les symlinks. S’ils ne sont pas activés, le système de cache fonctionnera toujours mais
de manière sous-optimale. Consultez les <a href="./guides/manage-cache#limitations">limitations du cache</a> pour plus de détails.</li> <li>Les noms de fichiers sur le Hub peuvent avoir des caractères spéciaux (par exemple <code>&quot;path/to?/my/file&quot;</code>).
Windows est plus restrictif sur les <a href="https://learn.microsoft.com/en-us/windows/win32/intl/character-sets-used-in-file-names" rel="nofollow">caractères spéciaux</a>
ce qui rend ces fichiers ininstallables sur Windows. Heureusement c’est un cas assez rare.
Contactez le propriétaire du dépôt si vous pensez que c’est une erreur ou contactez nous
pour que nous cherchions une solution.</li></ul> <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-4k9267">Une fois que <code>huggingface_hub</code> est installé correctement sur votre machine, vous aurez peut-être besoin de
<a href="package_reference/environment_variables">configurer les variables d’environnement</a> ou de <a href="guides/overview">lire un de nos guides</a>
pour vous lancer.</p> <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/installation.md" target="_blank"><span data-svelte-h="svelte-1kd6by1">&lt;</span> <span data-svelte-h="svelte-x0xyl0">&gt;</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, 5],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
38.4 kB
·
Xet hash:
297ad525aca604005067db8982beefcc0d2a277745a7cf5c1763644a109932f3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.