How to build your own compute job for Lilypad
A Lilypad module is a Git repository that allows you to perform various tasks using predefined templates and inputs.
This guide will walk you through the process of creating a Lilypad module, including defining a JSON template, handling inputs, and following best practices.
If you're new to Docker, consider exploring this step-by-step tutorial on creating, building, and running a Docker image for a simple Hello World style application.
Start by creating a Git repository for your Lilypad module. The module's versions will be represented as Git tags.
Inside your module's repository, create a file named lilypad_module.json.tmpl
. This file will serve as a JSON template with Go text/template style sections, like {{.Message}}
, which will be replaced by Lilypad with JSON-encoded inputs.
You can also use Go templates to set defaults and perform other template-related operations. Refer to the cowsay
example for inspiration.
Inputs are passed to your Lilypad module as key-value pairs, where both the keys and values are strings. You can pass inputs using the following command:
Ensure that your module is set up to accept and process inputs according to the specified format.
During development, you can use the Git hash to test your module. This allows you to verify that your module functions correctly and produces the expected results.
Here are some example Lilypad modules for reference:
Cowsay: Lilypad "Hello World" example
SDXL v0.9/v1.0: Text to image generation.
SDV v1.0/1.1: Text to video generation.
Deprecated examples:
lora-training: An example module for LoRa training tasks.
lora-inference: An example module for LoRa inference tasks.
duckdb: An example module related to DuckDB.
These examples can help you understand how to structure your Lilypad modules and follow best practices.
In this guide, we've covered the essential steps to create a Lilypad module, including defining a JSON template, handling inputs, and testing your module. By following these best practices, you can build reliable and reusable modules for Lilypad.
For more information and additional examples, refer to the official Lilypad documentation and the Cowsay example module.