tesseract
command line application¶
tesseract¶
Tesseract: A toolkit for universal, autodiff-native software components.
tesseract [OPTIONS] COMMAND [ARGS]...
Options
- --loglevel <LEVEL>¶
Set the logging level. At debug level, also print tracebacks for user errors.
- Default:
'info'
- Options:
debug | info | warning | error | critical
- --version¶
Print Tesseract CLI version and exit.
- --install-completion¶
Install completion for the current shell.
- --show-completion¶
Show completion for the current shell, to copy it or customize the installation.
apidoc¶
Serve the OpenAPI schema for a Tesseract.
tesseract apidoc [OPTIONS] IMAGE_NAME
Options
- --browser, --no-browser¶
Open the browser after serving the OpenAPI schema
- Default:
True
Arguments
- IMAGE_NAME¶
Required argument
Tesseract image name
build¶
Build a new Tesseract from a context directory.
The passed directory must contain the files tesseract_api.py and tesseract_config.yaml (can be created via tesseract init).
Prints the built images as JSON array to stdout, for example: [“mytesseract:latest”]. If –generate-only is set, the path to the build context is printed instead.
tesseract build [OPTIONS] SRC_DIR
Options
- -t, --tag <tag>¶
Tag for the resulting Tesseract. By default, this will be inferred from the version specified in tesseract_config.yaml, and the Tesseract will also be tagged as latest.
- --build-dir <build_dir>¶
Directory to use for the build. Defaults to a temporary directory.
- --forward-ssh-agent, --no-forward-ssh-agent¶
Forward the SSH agent to the Docker build environment. Has to be provided if requirements.txt contains private dependencies.
- Default:
False
- --config-override <KEYPATH=VALUE>¶
Override a configuration option in the Tesseract. Format:
keypath=value
wherekeypath
is a dot-separated path to the attribute in tesseract_config.yaml. Possible keypaths are: name, version, description, build_config.Possible build_config options are: base_image, target_platform, extra_packages, package_data, custom_build_steps, requirements, skip_checks.
Example:
--config-override build_config.target_platform=linux/arm64
.
- --generate-only, --no-generate-only¶
Only generate the build context and do not actually build the image.
- Default:
False
Arguments
- SRC_DIR¶
Required argument
Source directory for the Tesseract. Must contain tesseract_api.py and tesseract_config.yaml.
init¶
Initialize a new Tesseract API module.
tesseract init [OPTIONS]
Options
- --name <name>¶
Tesseract name as specified in tesseract_config.yaml. Will be prompted if not provided.
- --target-dir <target_dir>¶
Path to the directory where the Tesseract API module should be created.
- Default:
'current directory'
- --recipe <recipe>¶
Use a pre-configured template to initialize Tesseract API and configuration.
- Default:
'base'
- Options:
base | jax | pytorch
list¶
Display all Tesseract images.
tesseract list [OPTIONS]
ps¶
Display all Tesseract containers.
tesseract ps [OPTIONS]
run¶
Execute a command in a Tesseract.
This command starts a Tesseract instance and executes the given command.
tesseract run [OPTIONS] TESSERACT_IMAGE CMD [PAYLOAD]
Options
- -i, --input-path <input_path>¶
Input path to read input files from, such as local directory or S3 URI (may be anything supported by fsspec).
- -o, --output-path <output_path>¶
Output path to write output files to, such as local directory or S3 URI (may be anything supported by fsspec).
- -f, --output-format <output_format>¶
Output format to use for the Tesseract.
- Options:
json | json+base64 | json+binref
- --output-file <output_file>¶
Output filename to write the result to (relative to output path). If not set, results will be written to stdout.
- -v, --volume <source:target>¶
Bind mount a volume, in Docker format: source:target.
- --gpus <'all' | int>¶
IDs of host GPUs to make available in the tesseract. You can use all GPUs via –gpus all or pass (multiple) IDs: –gpus 0 –gpus 1.
- -e, --env <key=value>¶
Set environment variables in the Tesseract container, in Docker format: key=value.
- --network <network>¶
Network to use for the Tesseract container, analogous to Docker’s –network option. For example, ‘host’ uses the host system’s network. Alternatively, you can create a custom network with docker network create <network-name> and use it here.
- --user <user>¶
User to run the Tesseract as e.g. ‘1000’ or ‘1000:1000’ (uid:gid). Defaults to the current user.
- -h, --help¶
Show help for the Tesseract command.
- Default:
False
Arguments
- TESSERACT_IMAGE¶
Optional argument
Tesseract image name
- CMD¶
Optional argument
Tesseract command to run, must be one of [‘abstract-eval’, ‘apply’, ‘check’, ‘check-gradients’, ‘health’, ‘input-schema’, ‘jacobian’, ‘jacobian-vector-product’, ‘openapi-schema’, ‘output-schema’, ‘serve’, ‘vector-jacobian-product’]
- PAYLOAD¶
Optional argument
Optional payload to pass to the Tesseract command. This can be a JSON string or an @ prefixed path to a JSON file.
For more information about a specific Tesseract, try tesseract run <tesseract-name> <cmd> –help. For example, tesseract run helloworld apply –help.
serve¶
Serve one or more Tesseract images.
A successful serve command will display on standard output a JSON object with the Tesseract container name, which is required to run the teardown command and its respective port.
tesseract serve [OPTIONS] IMAGE_NAME
Options
- -v, --volume <source:target>¶
Bind mount a volume in all Tesseracts, in Docker format: source:target[:ro|rw]
- -e, --env <environment>¶
Set environment variables in the Tesseract containers, in Docker format: key=value.
- -p, --port <port>¶
Optional port/port range to serve the Tesseract on (e.g. -p ‘8080-8082’). Port must be between 1025 and 65535.
- --network <network>¶
Network to use for the Tesseract container, analogous to Docker’s –network option. For example, ‘host’ uses the host system’s network. Alternatively, you can create a custom network with docker network create <network-name> and use it here.
- --network-alias <network_alias>¶
Network alias to use for the Tesseract container. This makes the Tesseract accessible via this alias within the specified network. Must be used with –network.
- --host-ip <host_ip>¶
IP address of the host to bind the Tesseract to. Defaults to 127.0.0.1 (localhost). To bind to all interfaces, use ‘0.0.0.0’. WARNING: This may expose Tesseract to all local networks, use with caution.
- Default:
'127.0.0.1'
- --gpus <'all' | int>¶
IDs of host Nvidia GPUs to make available in the Tesseract. You can use all GPUs via –gpus all or pass (multiple) IDs: –gpus 0 –gpus 1.
- --num-workers <num_workers>¶
Number of worker processes to use when serving the Tesseract.
- Default:
1
- --debug¶
Enable debug mode. This will propagate full tracebacks to the client and start a debugpy server in the Tesseract. WARNING: This may expose sensitive information, use with caution (and never in production).
- Default:
False
- --user <user>¶
User to run the Tesseracts as e.g. ‘1000’ or ‘1000:1000’ (uid:gid). Defaults to the current user.
- -i, --input-path <input_path>¶
Input path to read input files from, such as local directory or S3 URI (may be anything supported by fsspec).
- -o, --output-path <output_path>¶
Output path to write output files to, such as local directory or S3 URI (may be anything supported by fsspec).
- -f, --output-format <output_format>¶
Output format to use for the Tesseract.
- Options:
json | json+base64 | json+binref
Arguments
- IMAGE_NAME¶
Required argument
Tesseract image name
teardown¶
Tear down one or more Tesseracts that were previously started with tesseract serve.
One or more Tesseract container names must be specified unless –all is set.
tesseract teardown [OPTIONS] [CONTAINER_NAMES]...
Options
- --all¶
Tear down all Tesseracts currently being served.
- Default:
False
Arguments
- CONTAINER_NAMES¶
Optional argument(s)
Tesseract container names