huggingface-inference-toolkit
Hugging Face Inference Toolkit used to serve transformers, sentence-transformers, and diffusers models.
파일 탐색기
최종 버전 다운로드 (.zip)- build-container.yaml
- docker-build-action.yaml
- integration-test-action.yaml
- integration-test.yaml
- quality.yaml
- unit-test.yaml
- Dockerfile
- Dockerfile.inf2
- entrypoint.sh
- inf2_entrypoint.sh
- inf2_env.py
- __init__.py
- audio_utils.py
- base.py
- image_utils.py
- json_utils.py
- __init__.py
- async_utils.py
- const.py
- diffusers_utils.py
- env_utils.py
- handler.py
- heavy_utils.py
- idle.py
- latency_guard.py
- logging.py
- optimum_utils.py
- sentence_transformers_utils.py
- utils.py
- vertex_ai_utils.py
- webservice_starlette.py
- __init__.py
- config.py
- conftest.py
- helpers.py
- test_pytorch_local_cpu.py
- test_pytorch_local_gpu.py
- test_pytorch_local_inf2.py
- test_pytorch_remote_cpu.py
- test_pytorch_remote_gpu.py
- utils.py
- long_sample.mp3
- sample.amr
- sample.m4a
- sample1.flac
- sample1.mp3
- sample1.ogg
- sample1.wav
- sample1.webm
- custom_utils.py
- pipeline.py
- tiger.bmp
- tiger.gif
- tiger.jpeg
- tiger.png
- tiger.tiff
- tiger.webp
- __init__.py
- conftest.py
- test_api_inference_compat.py
- test_async_utils.py
- test_const.py
- test_diffusers.py
- test_env_knobs.py
- test_handler.py
- test_latency_guard.py
- test_multi_task.py
- test_optimum_utils.py
- test_sentence_transformers.py
- test_serialization.py
- test_serializer.py
- test_utils.py
- test_vertex_ai_utils.py
- __init__.py
- .dockerignore
- .gitignore
- LICENSE
- Makefile
- MANIFEST.in
- pyproject.toml
- README.md
- requirements-torch-cpu.txt
- requirements-torch.txt
- requirements.txt
- setup.cfg
- setup.py
- test-requirements.txt
# 설치 가이드
1. 코드 내려받기
git clone https://github.com/huggingface/huggingface-inference-toolkit
깃허브에서 프로젝트 코드 전체를 내 컴퓨터로 내려받습니다.
cd huggingface-inference-toolkit
방금 내려받은 프로젝트 폴더 안으로 이동합니다.
2. Docker
쉬움 추천사전 준비물
- Git GitHub에서 프로젝트 코드를 내려받으려면 필요합니다.
- Docker Desktop 컨테이너를 빌드하고 실행하려면 필요합니다. 설치 후 실행해서 백그라운드에 켜두세요.
docker run -ti -p 5000:5000 -e HF_MODEL_ID=distilbert-base-uncased-distilled-squad -e HF_TASK=question-answering integration-test-pytorch:cpu
빌드된 이미지를 실제 컨테이너로 실행합니다.
docker run -ti -p 5000:5000 --gpus all -e HF_MODEL_ID=nlpconnect/vit-gpt2-image-captioning -e HF_TASK=image-to-text integration-test-pytorch:gpu
빌드된 이미지를 실제 컨테이너로 실행합니다.
docker run -ti -p 5000:5000 --gpus all -e HF_MODEL_ID=echarlaix/tiny-random-stable-diffusion-xl -e HF_TASK=text-to-image integration-test-pytorch:gpu
빌드된 이미지를 실제 컨테이너로 실행합니다.
docker run -ti -p 5000:5000 --gpus all -e HF_MODEL_ID=stabilityai/stable-diffusion-xl-base-1.0 -e HF_TASK=text-to-image integration-test-pytorch:gpu
빌드된 이미지를 실제 컨테이너로 실행합니다.
docker run -ti -p 5000:5000 -e HF_MODEL_DIR=/repository -v $(pwd)/distilbert-base-uncased-emotion:/repository integration-test-pytorch:cpu
빌드된 이미지를 실제 컨테이너로 실행합니다.
터미널에 docker compose ps 를 입력해 컨테이너들이 Up 상태인지 확인하세요. README에 포트 번호가 적혀있다면 브라우저에서 http://localhost:포트번호 로 접속해보세요.
이 레포의 README에 적힌 실제 명령어를 그대로 가져왔습니다.
3. Python
쉬움사전 준비물
pip install -r requirements.txt
requirements.txt 등에 명시된 파이썬 라이브러리를 설치합니다.
python <실행할 파일명>.py # README에서 정확한 실행 파일명을 확인하세요
파이썬 스크립트(또는 모듈)를 실행합니다.
에러 메시지 없이 실행되고 터미널에 안내 문구가 출력되면 정상입니다.
4. Make
보통사전 준비물
- Git GitHub에서 프로젝트 코드를 내려받으려면 필요합니다.
- Make Linux/macOS는 보통 기본 설치되어 있습니다. Windows는 별도 설치(예: MSYS2, WSL)가 필요합니다.
make inference-pytorch-cpu
생성된 빌드 설정을 바탕으로 실제 컴파일을 진행해 실행 파일을 만듭니다.
make inference-pytorch-gpu
생성된 빌드 설정을 바탕으로 실제 컴파일을 진행해 실행 파일을 만듭니다.
make inference-pytorch-inf2
생성된 빌드 설정을 바탕으로 실제 컴파일을 진행해 실행 파일을 만듭니다.
에러 없이 끝나면 성공입니다. 생성된 실행 파일을 직접 실행해보세요.
이 레포의 README에 적힌 실제 명령어를 그대로 가져왔습니다.
// repository documentation
Was this content helpful?
(0 ratings)
