huggingface-inference-toolkit
Hugging Face Inference Toolkit used to serve transformers, sentence-transformers, and diffusers models.
File Explorer
Download Latest Version (.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
# Installation Guide
git clone https://github.com/huggingface/huggingface-inference-toolkit
Downloads the entire project code from GitHub to your computer.
cd huggingface-inference-toolkit
Moves into the project folder you just downloaded.
2. Docker
Easy Recommended- Git Needed to download the project code from GitHub.
- Docker Desktop Needed to build and run containers. Install it and keep it running in the background.
docker run -ti -p 5000:5000 -e HF_MODEL_ID=distilbert-base-uncased-distilled-squad -e HF_TASK=question-answering integration-test-pytorch:cpu
Runs the built image as an actual container.
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
Runs the built image as an actual container.
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
Runs the built image as an actual container.
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
Runs the built image as an actual container.
docker run -ti -p 5000:5000 -e HF_MODEL_DIR=/repository -v $(pwd)/distilbert-base-uncased-emotion:/repository integration-test-pytorch:cpu
Runs the built image as an actual container.
Pulled directly from this repo's README.
3. Python
Easypip install -r requirements.txt
Installs the Python libraries listed in requirements.txt (or similar).
python <μ€νν νμΌλͺ
>.py # READMEμμ μ νν μ€ν νμΌλͺ
μ νμΈνμΈμ
Runs the Python script (or module).
4. Make
Medium- Git Needed to download the project code from GitHub.
- Make Usually pre-installed on Linux/macOS. On Windows, install separately (e.g. via MSYS2 or WSL).
make inference-pytorch-cpu
Compiles the code based on the generated build configuration to produce an executable.
make inference-pytorch-gpu
Compiles the code based on the generated build configuration to produce an executable.
make inference-pytorch-inf2
Compiles the code based on the generated build configuration to produce an executable.
Pulled directly from this repo's README.
