Skip to content

Commit

Permalink
Merge branch 'main' of github.com:bacalhau-project/lilypad
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemarsden committed Sep 26, 2023
2 parents 52f9cee + 3473631 commit 46e132a
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 23 deletions.
112 changes: 110 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,116 @@
# Lilypad 🍃
# Lilypad v2 🍃

This cloud is just someone else's computer.

![image](https://github.com/bacalhau-project/lilypad/assets/264658/d91dad9a-ca46-43d4-a94b-d33454efc7ae)

Read the [docs](https://docs.lilypadnetwork.org)!
# Getting started

Welcome to the prerelease series of Lilypad v2.

## Testnet

The testnet has a base curency of ETH and you will also get LP to pay for jobs (and nodes to stake).

Metamask:

```
Network name: Lilypad v2 testnet
New RPC URL: http://testnetv2.arewehotshityet.com:8545
Chain ID: 1337
Currency symbol: ETH
Block explorer URL: (leave blank)
```

### Fund your wallet with ETH and LP

To obtain funds, go to [http://testnetv2.arewehotshityet.com:8080](http://testnetv2.arewehotshityet.com:8080)

The faucet will give you both ETH (to pay for gas) and LP (to stake and pay for jobs).

## Install CLI

Currently only supports x86_64 Linux

```
curl -sSL -o lilypad https://github.com/bacalhau-project/lilypad/releases/download/v2.0.0-b7e9e04/lilypad
chmod +x lilypad
sudo mv lilypad /usr/local/bin
```

## Run a job

```
export WEB3_PRIVATE_KEY=<your private key>
```
(or arrange for the key to be in your environment in a more secure way that doesn't get written to your shell history)


### Cows

```
lilypad run cowsay:v0.0.1 -i Message="hey beautiful"
```


### SDXL

```
lilypad run sdxl:v0.9-lilypad1 -i PromptEnv="PROMPT=record player in reykjavik"
```

![image-42](https://github.com/bacalhau-project/lilypad/assets/264658/d48bb897-79a0-4f3a-b938-e85a8cfa3f0e)

## Run a node, earn LP

```
lilypad serve
```

systemd units & more details [here](https://github.com/bacalhau-project/lilypad/tree/main/ops)

## Available modules

Check the github releases page for each module or just use the git hash as the tag.

* [sdxl](https://github.com/bacalhau-project/lilypad-module-sdxl)
* [stable-diffusion](https://github.com/bacalhau-project/lilypad-module-stable-diffusion)
* [duckdb](https://github.com/bacalhau-project/lilypad-module-duckdb)
* [fastchat](https://github.com/bacalhau-project/lilypad-module-fastchat)
* [lora-inference](https://github.com/bacalhau-project/lilypad-module-lora-inference)
* [lora-training](https://github.com/bacalhau-project/lilypad-module-lora-training)
* [filecoin-data-prep](https://github.com/bacalhau-project/lilypad-module-filecoin-data-prep)
* [wasm](https://github.com/bacalhau-project/lilypad-module-wasm)
* [cowsay](https://github.com/bacalhau-project/lilypad-module-cowsay)


## Write a module

A module is just a git repo.

Module versions are just git tags.

In your repo, create a file called `lilypad_module.json.tmpl`

See [cowsay](https://github.com/bacalhau-project/lilypad-module-cowsay) for example

This is a json template with Go text/template style `{{.Message}}` sections which will be replaced by Lilypad with valid JSON strings which are passed as input to modules. You can also do fancy things with go templates like setting defaults, see cowsay for example. While developing a module, you can use the git hash to test it.

Pass inputs as:

```
lilypad run github.com/username/repo:tag -i Message=moo
```

Inputs are a map of strings to strings.

**YOU MUST MAKE YOUR MODULE DETERMINISTIC**

Tips:
* Make the output reproducible, for example for the diffusers library, see [here](https://huggingface.co/docs/diffusers/using-diffusers/reproducibility)
* Strip timestamps and time measurements out of the output, including to stdout/stderr
* Don't read any sources of entropy (e.g. /dev/random)
* When referencing docker images, you MUST specify their sha256 hashes, as shown in this example

If your module is not deterministic, compute providers will not adopt it and add it to their allowlists.

3 changes: 3 additions & 0 deletions hardhat/scripts/print-contract-env.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {
getControllerAddress,
getTokenAddress,
} from '../utils/web3'

async function main() {
const controllerAddress = await getControllerAddress()
const tokenAddress = await getTokenAddress()
console.log(`export WEB3_CONTROLLER_ADDRESS=${controllerAddress}`)
console.log(`export WEB3_TOKEN_ADDRESS=${tokenAddress}`)
}

main().catch((error) => {
Expand Down
47 changes: 26 additions & 21 deletions stack
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ function geth-command() {
docker exec -i geth geth --exec "$@" attach /data/geth/geth.ipc
}

############################################################################
############################################################################
# faucet
############################################################################
############################################################################

# fun the faucet container
function faucet() {
source .env
eval $(./stack print-contract-env)
local privateKey=$(echo -n "$ADMIN_PRIVATE_KEY" | sed 's/^0x//')
local tokenAddress=$(echo -n "$WEB3_TOKEN_ADDRESS" | sed 's/^0x//')
docker run -d \
--name faucet \
-p 8080:8080 \
--network lilypad \
-e WEB3_PROVIDER=http://geth:8545 \
-e PRIVATE_KEY=$privateKey \
-e TOKEN_ADDRESS=$WEB3_TOKEN_ADDRESS \
faucet \
--faucet.amount=100 \
--faucet.tokenamount=100 \
--faucet.minutes=1
}


############################################################################
############################################################################
# bacalhau
Expand Down Expand Up @@ -301,25 +327,4 @@ function integration-tests() {
)
}

############################################################################
############################################################################
# faucet
############################################################################
############################################################################

# fun the faucet container
function faucet() {
local privateKey=$(echo -n "$FAUCET_PRIVATE_KEY" | sed 's/^0x//')
docker run -d \
--name faucet \
-p 81:8080 \
--network modicum \
-e WEB3_PROVIDER=http://geth:8545 \
-e PRIVATE_KEY=$privateKey \
chainflag/eth-faucet:1.1.0 \
--faucet.amount=100 \
--faucet.minutes=1
}


eval "$@"

0 comments on commit 46e132a

Please sign in to comment.