Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
@@ -10,4 +10,158 @@ pinned: false
|
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
+
<p align="center">
|
14 |
+
<br/>
|
15 |
+
<img alt="huggingface_hub library logo" src="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/huggingface_hub.svg" width="376" height="59" style="max-width: 100%;">
|
16 |
+
<br/>
|
17 |
+
</p>
|
18 |
+
|
19 |
+
<p align="center">
|
20 |
+
<i>The official Python client for the Huggingface Hub.</i>
|
21 |
+
</p>
|
22 |
+
|
23 |
+
<p align="center">
|
24 |
+
<a href="https://huggingface.co/docs/huggingface_hub/en/index"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/huggingface_hub/index.svg?down_color=red&down_message=offline&up_message=online&label=doc"></a>
|
25 |
+
<a href="https://github.com/huggingface/huggingface_hub/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/huggingface_hub.svg"></a>
|
26 |
+
<a href="https://github.com/huggingface/huggingface_hub"><img alt="PyPi version" src="https://img.shields.io/pypi/pyversions/huggingface_hub.svg"></a>
|
27 |
+
<a href="https://pypi.org/project/huggingface-hub"><img alt="downloads" src="https://static.pepy.tech/badge/huggingface_hub/month"></a>
|
28 |
+
<a href="https://codecov.io/gh/huggingface/huggingface_hub"><img alt="Code coverage" src="https://codecov.io/gh/huggingface/huggingface_hub/branch/main/graph/badge.svg?token=RXP95LE2XL"></a>
|
29 |
+
</p>
|
30 |
+
|
31 |
+
<h4 align="center">
|
32 |
+
<p>
|
33 |
+
<b>English</b> |
|
34 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/README_de.md">Deutsch</a> |
|
35 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/README_ko.md">νκ΅μ΄</a>
|
36 |
+
<p>
|
37 |
+
</h4>
|
38 |
+
---
|
39 |
+
|
40 |
+
**Documentation**: <a href="https://hf.co/docs/huggingface_hub" target="_blank">https://hf.co/docs/huggingface_hub</a>
|
41 |
+
|
42 |
+
**Source Code**: <a href="https://github.com/huggingface/huggingface_hub" target="_blank">https://github.com/huggingface/huggingface_hub</a>
|
43 |
+
|
44 |
+
---
|
45 |
+
|
46 |
+
## Welcome to the huggingface_hub library
|
47 |
+
|
48 |
+
The `huggingface_hub` library allows you to interact with the [Hugging Face Hub](https://huggingface.co/), a platform democratizing open-source Machine Learning for creators and collaborators. Discover pre-trained models and datasets for your projects or play with the thousands of machine learning apps hosted on the Hub. You can also create and share your own models, datasets and demos with the community. The `huggingface_hub` library provides a simple way to do all these things with Python.
|
49 |
+
|
50 |
+
## Key features
|
51 |
+
|
52 |
+
- [Download files](https://huggingface.co/docs/huggingface_hub/en/guides/download) from the Hub.
|
53 |
+
- [Upload files](https://huggingface.co/docs/huggingface_hub/en/guides/upload) to the Hub.
|
54 |
+
- [Manage your repositories](https://huggingface.co/docs/huggingface_hub/en/guides/repository).
|
55 |
+
- [Run Inference](https://huggingface.co/docs/huggingface_hub/en/guides/inference) on deployed models.
|
56 |
+
- [Search](https://huggingface.co/docs/huggingface_hub/en/guides/search) for models, datasets and Spaces.
|
57 |
+
- [Share Model Cards](https://huggingface.co/docs/huggingface_hub/en/guides/model-cards) to document your models.
|
58 |
+
- [Engage with the community](https://huggingface.co/docs/huggingface_hub/en/guides/community) through PRs and comments.
|
59 |
+
|
60 |
+
## Installation
|
61 |
+
|
62 |
+
Install the `huggingface_hub` package with [pip](https://pypi.org/project/huggingface-hub/):
|
63 |
+
|
64 |
+
```bash
|
65 |
+
pip install huggingface_hub
|
66 |
+
```
|
67 |
+
|
68 |
+
If you prefer, you can also install it with [conda](https://huggingface.co/docs/huggingface_hub/en/installation#install-with-conda).
|
69 |
+
|
70 |
+
In order to keep the package minimal by default, `huggingface_hub` comes with optional dependencies useful for some use cases. For example, if you want have a complete experience for Inference, run:
|
71 |
+
|
72 |
+
```bash
|
73 |
+
pip install huggingface_hub[inference]
|
74 |
+
```
|
75 |
+
|
76 |
+
To learn more installation and optional dependencies, check out the [installation guide](https://huggingface.co/docs/huggingface_hub/en/installation).
|
77 |
+
|
78 |
+
## Quick start
|
79 |
+
|
80 |
+
### Download files
|
81 |
+
|
82 |
+
Download a single file
|
83 |
+
|
84 |
+
```py
|
85 |
+
from huggingface_hub import hf_hub_download
|
86 |
+
|
87 |
+
hf_hub_download(repo_id="tiiuae/falcon-7b-instruct", filename="config.json")
|
88 |
+
```
|
89 |
+
|
90 |
+
Or an entire repository
|
91 |
+
|
92 |
+
```py
|
93 |
+
from huggingface_hub import snapshot_download
|
94 |
+
|
95 |
+
snapshot_download("stabilityai/stable-diffusion-2-1")
|
96 |
+
```
|
97 |
+
|
98 |
+
Files will be downloaded in a local cache folder. More details in [this guide](https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache).
|
99 |
+
|
100 |
+
### Login
|
101 |
+
|
102 |
+
The Hugging Face Hub uses tokens to authenticate applications (see [docs](https://huggingface.co/docs/hub/security-tokens)). To login your machine, run the following CLI:
|
103 |
+
|
104 |
+
```bash
|
105 |
+
huggingface-cli login
|
106 |
+
# or using an environment variable
|
107 |
+
huggingface-cli login --token $HUGGINGFACE_TOKEN
|
108 |
+
```
|
109 |
+
|
110 |
+
### Create a repository
|
111 |
+
|
112 |
+
```py
|
113 |
+
from huggingface_hub import create_repo
|
114 |
+
|
115 |
+
create_repo(repo_id="super-cool-model")
|
116 |
+
```
|
117 |
+
|
118 |
+
### Upload files
|
119 |
+
|
120 |
+
Upload a single file
|
121 |
+
|
122 |
+
```py
|
123 |
+
from huggingface_hub import upload_file
|
124 |
+
|
125 |
+
upload_file(
|
126 |
+
path_or_fileobj="/home/lysandre/dummy-test/README.md",
|
127 |
+
path_in_repo="README.md",
|
128 |
+
repo_id="lysandre/test-model",
|
129 |
+
)
|
130 |
+
```
|
131 |
+
|
132 |
+
Or an entire folder
|
133 |
+
|
134 |
+
```py
|
135 |
+
from huggingface_hub import upload_folder
|
136 |
+
|
137 |
+
upload_folder(
|
138 |
+
folder_path="/path/to/local/space",
|
139 |
+
repo_id="username/my-cool-space",
|
140 |
+
repo_type="space",
|
141 |
+
)
|
142 |
+
```
|
143 |
+
|
144 |
+
For details in the [upload guide](https://huggingface.co/docs/huggingface_hub/en/guides/upload).
|
145 |
+
|
146 |
+
## Integrating to the Hub.
|
147 |
+
|
148 |
+
We're partnering with cool open source ML libraries to provide free model hosting and versioning. You can find the existing integrations [here](https://huggingface.co/docs/hub/libraries).
|
149 |
+
|
150 |
+
The advantages are:
|
151 |
+
|
152 |
+
- Free model or dataset hosting for libraries and their users.
|
153 |
+
- Built-in file versioning, even with very large files, thanks to a git-based approach.
|
154 |
+
- Hosted inference API for all models publicly available.
|
155 |
+
- In-browser widgets to play with the uploaded models.
|
156 |
+
- Anyone can upload a new model for your library, they just need to add the corresponding tag for the model to be discoverable.
|
157 |
+
- Fast downloads! We use Cloudfront (a CDN) to geo-replicate downloads so they're blazing fast from anywhere on the globe.
|
158 |
+
- Usage stats and more features to come.
|
159 |
+
|
160 |
+
If you would like to integrate your library, feel free to open an issue to begin the discussion. We wrote a [step-by-step guide](https://huggingface.co/docs/hub/adding-a-library) with β€οΈ showing how to do this integration.
|
161 |
+
|
162 |
+
## Contributions (feature requests, bugs, etc.) are super welcome πππππ§‘β€οΈ
|
163 |
+
|
164 |
+
Everyone is welcome to contribute, and we value everybody's contribution. Code is not the only way to help the community.
|
165 |
+
Answering questions, helping others, reaching out and improving the documentations are immensely valuable to the community.
|
166 |
+
We wrote a [contribution guide](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md) to summarize
|
167 |
+
how to get started to contribute to this repository.
|