Running The Container

The CPU container can be run with the following command:

docker run --rm -v "full path to license.json":/app/license/license.json \
-p 8080:8080 -it<version>

The command to run the GPU container required an additional --gpus flag to specify the GPU ID to use:

docker run --gpus <GPU_ID, usually 0> --rm -v "full path to license.json":/app/license/license.json \
-p 8080:8080 -it<version>

It is recommended to deploy the container on single GPU machines. For multi-GPU machines, please launch a container instance for each GPU and specify the GPU_ID accordingly.

For cloud deployment, please see Deployment and the Kubernetes Setup Guide.

info is intended for image distribution only. For production use, it is strongly recommended to set up a container registry inside your own compute environment to host the image.

URI-Based File Support

Running the container with the above commands allows for base64-encoded files to be processed with /v3/process/files/base64. However, to utilize the /v3/process/files/uri route, a volume where input files are stored and PAI_OUTPUT_FILE_DIR must be provided. Note that PAI_OUTPUT_FILE_DIR must reside inside the mounted volume.

docker run --rm -v "full path to your license.json file":/app/license/license.json \
-e PAI_OUTPUT_FILE_DIR=<full path to files>/output_dir \
-v <full path to files>:<full path to files> \
-p 8080:8080 -it<version>

For example, if your license file is in your home directory, the input directory you wish to mount is called inputfiles and the output directory is inputfiles/output:

docker run --rm -v /home/<username>/license.json:/app/license/license.json \
-e PAI_OUTPUT_FILE_DIR=/home/<username>/inputfiles/output \
-v /home/<username>/inputfiles:/home/<username>/inputfiles \
-p 8080:8080 -it

Environment Variables

The Private AI container supports a number of environment variables. The environment variables can be set in the Docker run command as follows:

docker run --rm -e <ENVIRONMENT_VARIABLE>=<VALUE> -p 8080:8080 -it deid:<version number>

Supported Environment Variables

Variable Name
PAI_ACCURACY_MODES Controls which entity detection models are loaded at container start. By default, the container loads all models. Setting this environment variable allows for faster startup and reduced RAM and GPU memory usage. A request specifying an accuracy mode that wasn't loaded will return an error. Allowed values are the accuracy modes specified in the accuracy field in entity_detection, e.g. PAI_ACCURACY_MODES=high
PAI_ALLOW_LIST Allows for the allow list to be set globally, instead of passing into each POST request. An example could be PAI_ALLOW_LIST='["John","Grace"]'. Please see Processing Text
PAI_DISABLE_GPU_CHECK When defined and set to any value, the startup GPU check is disabled. This variable is only applicable to the GPU container and allows the GPU container to run in fallback CPU mode
PAI_DISABLE_RAM_CHECK When defined and set to any value, the sufficient RAM check performed at container startup is disabled. Please note that Private AI cannot guarantee container stability if this is switched off
PAI_ENABLED_CLASSES Allows for the enabled classes to be set globally, instead of passing it into each POST request. An example could be PAI_ENABLED_CLASSES="NAME," or PAI_ENABLED_CLASSES="NAME,AGE,ORGANIZATION". Please see Processing Text
PAI_ENABLE_PII_COUNT_METERING When defined and set to any value, Aggregated entity detection counts are sent back to Private AI servers for reporting and visualization inside the dashboard. Note that feature is off by default
PAI_LOG_LEVEL Controls the verbosity of the container logging output. Allowed values are info, warning or error. Default is info
PAI_MARKER_FORMAT Allows for the redaction marker format to be set globally, instead of passing into each POST request. Please see Processing Text
PAI_OUTPUT_FILE_DIR The directory where /v3/process/files/uri will write processed files to. Note that this does not need to be specified for /v3/process/files/base64
PAI_SYNTHETIC_PII_ACCURACY_MODES Same as PAI_ACCURACY_MODES, except for synthetic entity generation models. Unlike PAI_ACCURACY_MODES, this environment variable can be set empty via PAI_SYNTHETIC_PII_ACCURACY_MODES= to disable synthetic entity generation
PAI_WORKERS Number of pre/post-processing workers used in the GPU container. Defaults to 16 - increasing this number allows for higher throughput, at the cost of increased RAM usage

To change the port used by the container, please set the host port as per the command below:

docker run --rm -v "full path to license.json":/app/license/license.json \
-p <host port>:8080 -it<version>

Authentication and External Communications

The only external communications made by the container are for authentication and usage reporting with Private AI's servers. These communications do not contain any customer data - if training data is required, this must be given to Private AI separately. An authentication call is made upon the first API call after the Docker image is started, and again at pre-defined intervals based on your subscription.

An "airgapped" version of the container that doesn't require external communication can be delivered upon request for pro tier customers.

© Copyright 2022, Private AI.