Skip to main content
For concepts, architecture, and usage guidance, see the Sprocket overview.

sprocket.Sprocket

Base class for inference workers. Class attributes:

sprocket.run

Entry point for starting a Sprocket worker.

sprocket.FileOutput

Wraps a local file path for automatic upload after predict() returns. Extends pathlib.PosixPath.
The FileOutput is replaced with the public URL in the final job result.

sprocket.emit_info

Report progress updates from inside predict(). Emitted data is available to clients via the info field on the job status endpoint.
Updates are batched and merged (later values overwrite earlier ones for the same keys). When using use_torchrun=True, call emit_info() only from rank 0 to avoid duplicate updates.

sprocket.InputOutputProcessor

Override for custom file download/upload behavior. Attach to your Sprocket via the processor class attribute.

Custom I/O Processing

Default behavior:
  • process_input_file: writes resp.content to dst
  • finalize: returns outputs unchanged

HTTP Endpoints

CLI Arguments

Environment Variables

Complete Examples

Image Classification

Video Generation with File Output

Multi-Model Pipeline