| <p align="center"> | |
| <br/> | |
| <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%;"> | |
| <br/> | |
| </p> | |
| <p align="center"> | |
| <i>๊ณต์ Huggingface Hub ํ์ด์ฌ ํด๋ผ์ด์ธํธ</i> | |
| </p> | |
| <p align="center"> | |
| <a href="https://huggingface.co/docs/huggingface_hub/ko/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> | |
| <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> | |
| <a href="https://github.com/huggingface/huggingface_hub"><img alt="PyPi version" src="https://img.shields.io/pypi/pyversions/huggingface_hub.svg"></a> | |
| <a href="https://pypi.org/project/huggingface-hub"><img alt="downloads" src="https://static.pepy.tech/badge/huggingface_hub/month"></a> | |
| <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> | |
| </p> | |
| <h4 align="center"> | |
| <p> | |
| <a href="https://github.com/huggingface/huggingface_hub/blob/main/README.md">English</a> | | |
| <a href="https://github.com/huggingface/huggingface_hub/blob/main/README_de.md">Deutsch</a> | | |
| <a href="https://github.com/huggingface/huggingface_hub/blob/main/README_hi.md">เคนเคฟเคเคฆเฅ</a> | | |
| <b>ํ๊ตญ์ด</b> | |
| <p> | |
| </h4> | |
| --- | |
| **๊ธฐ์ ๋ฌธ์**: <a href="https://hf.co/docs/huggingface_hub" target="_blank">https://hf.co/docs/huggingface_hub</a> | |
| **์์ค ์ฝ๋**: <a href="https://github.com/huggingface/huggingface_hub" target="_blank">https://github.com/huggingface/huggingface_hub</a> | |
| --- | |
| ## huggingface_hub ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฐ์ | |
| `huggingface_hub` ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ [Hugging Face Hub](https://huggingface.co/)์ ์ํธ์์ฉํ ์ ์๊ฒ ํด์ค๋๋ค. Hugging Face Hub๋ ์ฐฝ์์์ ํ์ ์๋ฅผ ์ํ ์คํ์์ค ๋จธ์ ๋ฌ๋ ํ๋ซํผ์ ๋๋ค. ์ฌ๋ฌ๋ถ์ ํ๋ก์ ํธ์ ์ ํฉํ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ๊ณผ ๋ฐ์ดํฐ์ ์ ๋ฐ๊ฒฌํ๊ฑฐ๋, Hub์ ํธ์คํ ๋ ์์ฒ ๊ฐ์ ๋จธ์ ๋ฌ๋ ์ฑ๋ค์ ์ฌ์ฉํด๋ณด์ธ์. ๋ํ, ์ฌ๋ฌ๋ถ์ด ๋ง๋ ๋ชจ๋ธ, ๋ฐ์ดํฐ์ , ๋ฐ๋ชจ๋ฅผ ์ปค๋ฎค๋ํฐ์ ๊ณต์ ํ ์๋ ์์ต๋๋ค. `huggingface_hub` ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ํ์ด์ฌ์ผ๋ก ์ด ๋ชจ๋ ๊ฒ์ ๊ฐ๋จํ๊ฒ ํ ์ ์๋ ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค. | |
| ## ์ฃผ์ ๊ธฐ๋ฅ | |
| - Hub์์ [ํ์ผ์ ๋ค์ด๋ก๋](https://huggingface.co/docs/huggingface_hub/main/ko/guides/download) | |
| - Hub์ [ํ์ผ์ ์ ๋ก๋](https://huggingface.co/docs/huggingface_hub/main/en/guides/upload) (์์ด) | |
| - [๋ ํฌ์งํ ๋ฆฌ๋ฅผ ๊ด๋ฆฌ](https://huggingface.co/docs/huggingface_hub/main/en/guides/repository) (์์ด) | |
| - ๋ฐฐํฌ๋ ๋ชจ๋ธ์ [์ถ๋ก ์ ์คํ](https://huggingface.co/docs/huggingface_hub/main/en/guides/inference) (์์ด) | |
| - ๋ชจ๋ธ, ๋ฐ์ดํฐ์ , Space๋ฅผ [๊ฒ์](https://huggingface.co/docs/huggingface_hub/main/en/guides/search) (์์ด) | |
| - [๋ชจ๋ธ ์นด๋๋ฅผ ๊ณต์ ](https://huggingface.co/docs/huggingface_hub/main/en/guides/model-cards)ํ์ฌ ๋ชจ๋ธ์ ๋ฌธ์ํ (์์ด) | |
| - PR๊ณผ ๋๊ธ์ ํตํด [์ปค๋ฎค๋ํฐ์ ์ํต](https://huggingface.co/docs/huggingface_hub/main/en/guides/community) (์์ด) | |
| ## ์ค์น | |
| [pip](https://pypi.org/project/huggingface-hub/)๋ก `huggingface_hub` ํจํค์ง๋ฅผ ์ค์นํ์ธ์: | |
| ```bash | |
| pip install huggingface_hub | |
| ``` | |
| ์ํ๋ค๋ฉด [conda](https://huggingface.co/docs/huggingface_hub/ko/installation#install-with-conda)๋ฅผ ์ด์ฉํ์ฌ ์ค์นํ ์๋ ์์ต๋๋ค. | |
| ๊ธฐ๋ณธ ํจํค์ง๋ฅผ ์๊ฒ ์ ์งํ๊ธฐ ์ํด `huggingface_hub`๋ ์ ์ฉํ ์์กด์ฑ์ ์ถ๊ฐ์ ์ผ๋ก ์ ๊ณตํฉ๋๋ค. ์ถ๋ก ๊ณผ ๊ด๋ จ๋ ๊ธฐ๋ฅ์ ์ํ๋ค๋ฉด, ์๋๋ฅผ ์คํํ์ธ์: | |
| ```bash | |
| pip install huggingface_hub[inference] | |
| ``` | |
| ์ค์น์ ์ ํ์ ์์กด์ฑ์ ๋ํด ๋ ์์๋ณด๋ ค๋ฉด, [์ค์น ๊ฐ์ด๋](https://huggingface.co/docs/huggingface_hub/ko/installation)๋ฅผ ์ฐธ๊ณ ํ์ธ์. | |
| ## ๋ง๋ณด๊ธฐ | |
| ### ํ์ผ ๋ค์ด๋ก๋ | |
| ํ์ผ ํ๋์ ๊ฒฝ์ฐ: | |
| ```py | |
| from huggingface_hub import hf_hub_download | |
| hf_hub_download(repo_id="tiiuae/falcon-7b-instruct", filename="config.json") | |
| ``` | |
| ๋ ํฌ์งํ ๋ฆฌ ์ ์ฒด์ ๊ฒฝ์ฐ: | |
| ```py | |
| from huggingface_hub import snapshot_download | |
| snapshot_download("stabilityai/stable-diffusion-2-1") | |
| ``` | |
| ํ์ผ์ ๋ก์ปฌ ์บ์ ํด๋์ ๋ค์ด๋ก๋๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ [์ด ๊ฐ์ด๋](https://huggingface.co/docs/huggingface_hub/ko/guides/manage-cache)๋ฅผ ์ฐธ์กฐํ์ธ์. | |
| ### ๋ก๊ทธ์ธ | |
| Hugging Face Hub๋ ํ ํฐ์ ์ฌ์ฉํ์ฌ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ธ์ฆํฉ๋๋ค([๋ฌธ์](https://huggingface.co/docs/hub/security-tokens) ์ฐธ์กฐ). ์ปดํจํฐ์์ ๋ก๊ทธ์ธํ๋ ค๋ฉด CLI๋ฅผ ์ฌ์ฉํ์ธ์: | |
| ```bash | |
| huggingface-cli login | |
| # ๋๋ ํ๊ฒฝ ๋ณ์๋ก ์ง์ ํด์ฃผ์ธ์ | |
| huggingface-cli login --token $HUGGINGFACE_TOKEN | |
| ``` | |
| ### ๋ ํฌ์งํ ๋ฆฌ ์์ฑ | |
| ```py | |
| from huggingface_hub import create_repo | |
| create_repo(repo_id="super-cool-model") | |
| ``` | |
| ### ํ์ผ ์ ๋ก๋ | |
| ํ์ผ ํ๋์ ๊ฒฝ์ฐ: | |
| ```py | |
| from huggingface_hub import upload_file | |
| upload_file( | |
| path_or_fileobj="/home/lysandre/dummy-test/README.md", | |
| path_in_repo="README.md", | |
| repo_id="lysandre/test-model", | |
| ) | |
| ``` | |
| ๋ ํฌ์งํ ๋ฆฌ ์ ์ฒด์ ๊ฒฝ์ฐ: | |
| ```py | |
| from huggingface_hub import upload_folder | |
| upload_folder( | |
| folder_path="/path/to/local/space", | |
| repo_id="username/my-cool-space", | |
| repo_type="space", | |
| ) | |
| ``` | |
| ์์ธํ ๋ด์ฉ์ [์ ๋ก๋ ๊ฐ์ด๋](https://huggingface.co/docs/huggingface_hub/ko/guides/upload)๋ฅผ ์ฐธ์กฐํ์ธ์. | |
| ## Hugging Face Hub์ ํจ๊ป ์ฑ์ฅํ๊ธฐ | |
| ์ ํฌ๋ ๋ฉ์ง ์คํ์์ค ML ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค๊ณผ ํ๋ ฅํ์ฌ, ๋ชจ๋ธ ํธ์คํ ๊ณผ ๋ฒ์ ๊ด๋ฆฌ๋ฅผ ๋ฌด๋ฃ๋ก ์ ๊ณตํ๊ณ ์์ต๋๋ค. ์ด๋ฏธ ํตํฉ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ [์ฌ๊ธฐ](https://huggingface.co/docs/hub/libraries)์ ํ์ธํ ์ ์์ต๋๋ค. | |
| ์ด๋ ๊ฒ ํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์ฅ์ ์ด ์์ต๋๋ค: | |
| - ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์๋ค์ ๋ชจ๋ธ์ด๋ ๋ฐ์ดํฐ์ ์ ๋ฌด๋ฃ๋ก ํธ์คํ ํด์ค๋๋ค. | |
| - git์ ๊ธฐ๋ฐ์ผ๋ก ํ ๋ฐฉ์์ผ๋ก, ์์ฃผ ํฐ ํ์ผ๋ค๋ ๋ฒ์ ์ ๊ด๋ฆฌํ ์ ์์ต๋๋ค. | |
| - ๊ณต๊ฐ๋ ๋ชจ๋ ๋ชจ๋ธ์ ๋ํด ์ถ๋ก API๋ฅผ ํธ์คํ ํด์ค๋๋ค. | |
| - ์ ๋ก๋๋ ๋ชจ๋ธ๋ค์ ๋ธ๋ผ์ฐ์ ์์ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋ ์์ ฏ์ ์ ๊ณตํฉ๋๋ค. | |
| - ๋๊ตฌ๋ ์ฌ๋ฌ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์๋ก์ด ๋ชจ๋ธ์ ์ ๋ก๋ํ ์ ์์ต๋๋ค. ๋ชจ๋ธ์ด ๊ฒ์๋ ์ ์๋๋ก ํด๋น ํ๊ทธ๋ง ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค. | |
| - ๋ค์ด๋ก๋ ์๋๊ฐ ๋งค์ฐ ๋น ๋ฆ ๋๋ค! ์๋ํ๋ฉด Cloudfront (CDN)๋ฅผ ์ด์ฉํ์ฌ ์ ์ธ๊ณ ์ด๋์์๋ ๋น ๋ฅด๊ฒ ๋ค์ด๋ก๋ํ ์ ์๋๋ก ์ง์ญ์ ์ผ๋ก ๋ณต์ ํด๋๊ธฐ ๋๋ฌธ์ ๋๋ค. | |
| - ์ฌ์ฉ ํต๊ณ์ ๋ ๋ง์ ๊ธฐ๋ฅ๋ค์ ์ ๊ณตํฉ๋๋ค. | |
| ์ฌ๋ฌ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํตํฉํ๊ณ ์ถ๋ค๋ฉด, ์ด์๋ฅผ ์ด์ด์ ์๊ฒฌ์ ๋๋ ์ฃผ์ธ์. ํตํฉ ๊ณผ์ ์ ์๋ดํ๊ธฐ ์ํด โค๏ธ์ ๋ด์ [๋จ๊ณ๋ณ ๊ฐ์ด๋](https://huggingface.co/docs/hub/adding-a-library)๋ฅผ ์์ฑํ์ต๋๋ค. | |
| ## (๊ธฐ๋ฅ ์์ฒญ, ๋ฒ๊ทธ ํจ์น ๋ฑ์) ๊ธฐ์ฌ๋ ๋ํ์์ ๋๋ค ๐๐๐๐๐งกโค๏ธ | |
| ๋ชจ๋ ๋ถ๋ค์ ๊ธฐ์ฌ๋ฅผ ํ์ํ๋ฉฐ, ์์คํ ์๊ฐํฉ๋๋ค. ์ฝ๋ ์์ฑ๋ง์ด ์ปค๋ฎค๋ํฐ์ ๋์์ ์ฃผ๋ ์ ์ผํ ๋ฐฉ๋ฒ์ด ์๋์์. | |
| ์ง๋ฌธ์ ๋ตํ๊ฑฐ๋, ๋ค๋ฅธ ๋ถ๋ค์ ๋๊ฑฐ๋, ์ปจํํ๊ฑฐ๋, ๋ฌธ์๋ฅผ ๊ฐ์ ํ๋ ๊ฒ๋ ์ปค๋ฎค๋ํฐ์ ํฐ ๋์์ด ๋ฉ๋๋ค. | |
| ์ง๊ธ ์์ํ๋ ค๋ฉด ๊ฐ๋จํ [๊ธฐ์ฌ ๊ฐ์ด๋](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md)๋ฅผ ์ฐธ์กฐํด์ฃผ์ธ์. | |