Sign inSign up

rodrigocaus/python-transformers

By rodrigocaus

•Updated over 3 years ago

https://github.com/rodrigocaus/python-transformers

Image
0

543

rodrigocaus/python-transformers repository overview

⁠Python Transformers

Repository to make Dockerfiles available for containers with Huggingface's Transformers. Build your own Docker Base Image to use Huggingface's Transformers in production.

⁠Tags

Image tags follow the single formulation: <python_version_or_tag>-<transformers_version>-<framework>-<compatible_hardware>

Where:

  • python_version_or_tag: is the Python version from base image or from python official releases
  • transformers_version: is the Transformers library major.minor version
  • framework: is the base framework used by Transformers (currently only torch is available)
  • compatible_hardware: is the base acceleration hardware available (CPU and GPU are available)

Examples:

  • 3.9-slim-4.27-torch-cpu
  • 3.10-4.29-torch-gpu

⁠Building

Run docker build with build args to manage transformers installation.

⁠Transformers and PyTorch (CPU)

Specify PYTHON_BASE_TAG (from official Python Docker Image⁠) and TRANSFORMERS_VERSION (using Pip version identification⁠). One can also specify EXTRA_PACKAGES to be installed with transformers[torch]:

$ export PYTHON_TAG=3.9-slim
$ export VERSION="==4.26"
$ docker build -t python-transformers \
    --build-arg PYTHON_BASE_TAG=$PYTHON_TAG \
    --build-arg TRANSFORMERS_VERSION=$VERSION \
    --build-arg EXTRA_PACKAGES="torchvision torchaudio" \
    -f Dockerfile.torch-cpu .
⁠Transformers and PyTorch (GPU)

This image uses an official nvidia/cuda⁠ container as base image. Specify PYTHON_VERSION and TRANSFORMERS_VERSION (using Pip version identification⁠). One can also specify EXTRA_PACKAGES to be installed with transformers[torch]:

$ export PYTHON_VERSION=3.10
$ export VERSION="~=4.26"
$ docker build -t python-transformers \
    --build-arg PYTHON_VERSION=$PYTHON_VERSION \
    --build-arg TRANSFORMERS_VERSION=$VERSION \
    --build-arg EXTRA_PACKAGES="torchvision torchaudio" \
    -f Dockerfile.torch-gpu .

Tag summary

Content type

Image

Digest

sha256:81c433a70…

Size

4.5 GB

Last updated

over 3 years ago

docker pull rodrigocaus/python-transformers:3.10-4.29-torch-gpu