Pyworker
Backends
4min
worker instances run the vast pyworker https //github com/vast ai/pyworker/tree/main code, which is configured to support several backends the currently supported backends are tgi for text generation inference https //github com/huggingface/text generation inference comfyui for comfy ui https //github com/comfyanonymous/comfyui backend configuration each backend has its own launch script and expected environment variables we provide custom templates that configure everything needed to set up an autogroup for these backends, available here https //docs vast ai/serverless/templates reference to modify default parameters, refer to the readme files for each backend in the vast pyworker repository tgi https //github com/vast ai/pyworker/blob/main/workers/tgi/readme md comfyui https //github com/vast ai/pyworker/blob/main/workers/comfyui/readme md after launch, these images run inference code in a separate process accessible as an api server the vast pyworker backend code wraps http calls to this inference process, meaning each backend can support any endpoint that the underlying inference api server supports however, each endpoint requires defining a wrapper function in the appropriate server py file adding endpoints to add an endpoint to an existing backend, follow the instructions in the pyworker extension guide this guide's architecture can also be used to write new backends, where the underlying inference code is accessible through an http server in its own process supported endpoints you can see the currently supported endpoints for each backend tgi workers/tgi/server py https //github com/vast ai/pyworker/blob/main/workers/tgi/server py comfyui workers/comfyui/server py https //github com/vast ai/pyworker/blob/main/workers/comfyui/server py to support additional endpoints, follow the guide and fork the repository to add your own code these wrapper endpoints have the same name, input arguments, and output format as the underlying endpoint authentication the authentication information returned by https //run vast ai/route/ https //docs vast ai/serverless/route must be included in the request json to the endpoint but will be filtered out before forwarding to the backend server when vast’s autoscaling server returns a server address from the /route/ endpoint, it provides a unique signature with your request the authentication server verifies this signature to ensure that only authorized clients can send requests to your server for more detailed information and advanced configuration, please visit the vast pyworker repository https //github com/vast ai/pyworker/