tesseract-runtime command line application

This is the command line interface of the Tesseract runtime that is bundled with each Tesseract container.

tesseract-runtime

Invoke the Tesseract runtime.

The Tesseract runtime can be configured via environment variables; for example, export TESSERACT_RUNTIME_PORT=8080 sets the port to use for tesseract serve to 8080.

tesseract-runtime [OPTIONS] COMMAND [ARGS]...

Options

--install-completion

Install completion for the current shell.

--show-completion

Show completion for the current shell, to copy it or customize the installation.

abstract-eval

Perform abstract evaluation of the Tesseract on the input data.

Calculate output shape of apply from the shape of its inputs.

First argument is the payload, which should be a JSON object with the following structure.

Input schema:
inputs: The abstract input data to evaluate the Tesseract on. Has the same structure as InputSchema, but with array fields replaced by ShapeDType.
a: An arbitrary vector normalized according to […]
shape: None
dtype: None
b: An arbitrary vector. Needs to have the same dimensions as a.
shape: None
dtype: None
s: A scalar. [default: 3]
normalize: True if the output should be normalized, False otherwise. [default: False]
Returns:
Abstract outputs with the same structure as OutputSchema, but with array fields replaced by ShapeDType.
result: Vector s·a + b
shape: None
dtype: None
tesseract-runtime abstract-eval [OPTIONS] JSON_PAYLOAD

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

Arguments

JSON_PAYLOAD

Required argument

apply

Apply the Tesseract to the input data.

Multiplies a vector a by s, and sums the result to b.

First argument is the payload, which should be a JSON object with the following structure.

Input schema:
inputs: The input data to apply the Tesseract to.
a: An arbitrary vector normalized according to […]
b: An arbitrary vector. Needs to have the same dimensions as a.
s: A scalar. [default: 3]
normalize: True if the output should be normalized, False otherwise. [default: False]
Returns:
The output data from applying the Tesseract.
result: Vector s·a + b
tesseract-runtime apply [OPTIONS] JSON_PAYLOAD

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

Arguments

JSON_PAYLOAD

Required argument

check

Check whether the Tesseract API can be imported.

tesseract-runtime check [OPTIONS]

check-gradients

Check gradients of endpoints against a finite difference approximation.

This is an automated way to check the correctness of the gradients of the different AD endpoints (jacobian, jacobian_vector_product, vector_jacobian_product) of a tesseract_api.py module. It will sample random indices and compare the gradients computed by the AD endpoints with the finite difference approximation.

Warning:

Finite differences are not exact and the comparison is done with a tolerance. This means that the check may fail even if the gradients are correct, and vice versa.

Finite difference approximations are sensitive to numerical precision. When finite differences are reported incorrectly as 0.0, it is likely that the chosen eps is too small, especially for inputs that do not use float64 precision.

tesseract-runtime check-gradients [OPTIONS] JSON_PAYLOAD

Options

--endpoints <endpoints>

Endpoints to check gradients for (default: check all).

--input-paths <input_paths>

Paths to differentiable inputs to check gradients for (default: check all).

--output-paths <output_paths>

Paths to differentiable outputs to check gradients for (default: check all).

--eps <eps>

Step size for finite differences.

Default:

0.0001

--rtol <rtol>

Relative tolerance when comparing finite differences to gradients.

Default:

0.1

--max-evals <max_evals>

Maximum number of evaluations per input.

Default:

1000

--max-failures <max_failures>

Maximum number of failures to report per endpoint.

Default:

10

--seed <seed>

Seed for random number generator. If not set, a random seed is used.

--show-progress

Show progress bar.

Arguments

JSON_PAYLOAD

Required argument

health

Get health status of the Tesseract instance.

tesseract-runtime health [OPTIONS]

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

input-schema

Get input schema for tesseract apply function.

tesseract-runtime input-schema [OPTIONS]

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

jacobian

Computes the Jacobian of the Tesseract.

Differentiates jac_outputs with respect to jac_inputs, at the point inputs.

First argument is the payload, which should be a JSON object with the following structure.

Input schema:
inputs: The input data to compute the Jacobian at.
a: An arbitrary vector normalized according to […]
b: An arbitrary vector. Needs to have the same dimensions as a.
s: A scalar. [default: 3]
normalize: True if the output should be normalized, False otherwise. [default: False]
jac_inputs: The set of differentiable inputs to compute the Jacobian with respect to.
jac_outputs: The set of differentiable outputs to compute the Jacobian of.
Returns:
Container for the results of Jacobian computations. The result represents a nested structure of the Jacobian matrix as a mapping with structure {jac_outputs: {jac_inputs: array}}. The shape of each array is the concatenation of the shapes of the output and input arrays, i.e. (*output_array.shape, *input_array.shape).
tesseract-runtime jacobian [OPTIONS] JSON_PAYLOAD

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

Arguments

JSON_PAYLOAD

Required argument

jacobian-vector-product

Compute the Jacobian vector product of the Tesseract at the input data.

Evaluates the Jacobian vector product between the Jacobian given by jvp_outputs with respect to jvp_inputs at the point inputs and the given tangent vector.

First argument is the payload, which should be a JSON object with the following structure.

Input schema:
inputs: The input data to compute the JVP at.
a: An arbitrary vector normalized according to […]
b: An arbitrary vector. Needs to have the same dimensions as a.
s: A scalar. [default: 3]
normalize: True if the output should be normalized, False otherwise. [default: False]
jvp_inputs: The set of differentiable inputs to compute the JVP with respect to.
jvp_outputs: The set of differentiable outputs to compute the JVP of.
tangent_vector: Tangent vector to multiply the Jacobian with. Expected to be a mapping with structure {jvp_inputs: array}. The shape of each array is the same as the shape of the corresponding input array.
Returns:
Container for the results of Jacobian-vector products. The result is a mapping with structure {jvp_outputs: array}. The shape of each array is the same as the shape of the corresponding output array.
tesseract-runtime jacobian-vector-product [OPTIONS] JSON_PAYLOAD

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

Arguments

JSON_PAYLOAD

Required argument

openapi-schema

Get the openapi.json schema.

tesseract-runtime openapi-schema [OPTIONS]

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

output-schema

Get output schema for tesseract apply function.

tesseract-runtime output-schema [OPTIONS]

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

serve

Start running this Tesseract’s web server.

tesseract-runtime serve [OPTIONS]

Options

-p, --port <port>

Port number

-h, --host <host>

Host IP address

-w, --num-workers <num_workers>

Number of worker processes

vector-jacobian-product

Compute the Jacobian vector product of the Tesseract at the input data.

Computes the vector Jacobian product between the Jacobian given by vjp_outputs with respect to vjp_inputs at the point inputs and the given cotangent vector.

First argument is the payload, which should be a JSON object with the following structure.

Input schema:
inputs: The input data to compute the VJP at.
a: An arbitrary vector normalized according to […]
b: An arbitrary vector. Needs to have the same dimensions as a.
s: A scalar. [default: 3]
normalize: True if the output should be normalized, False otherwise. [default: False]
vjp_inputs: The set of differentiable inputs to compute the VJP with respect to.
vjp_outputs: The set of differentiable outputs to compute the VJP of.
cotangent_vector: Cotangent vector to multiply the Jacobian with. Expected to be a mapping with structure {vjp_outputs: array}. The shape of each array is the same as the shape of the corresponding output array.
Returns:
Container for the results of vector-Jacobian products. The result is a mapping with structure {vjp_inputs: array}. The shape of each array is the same as the shape of the corresponding input array.
tesseract-runtime vector-jacobian-product [OPTIONS] JSON_PAYLOAD

Options

-o, --output-path <output_path>

Output path to write the result to, such as local directory or S3 URI (may be anything supported by fsspec). [default: write to stdout]

-f, --output-format <output_format>

Output format to write results in.

Options:

json | msgpack | json+base64 | json+binref

Arguments

JSON_PAYLOAD

Required argument