Skip to content

Commit

Permalink
docs(runner): update dev container and docs
Browse files Browse the repository at this point in the history
This commit updates the dev container so that developers know which run
argument to enable when using GPU parallelism. It also adds a debug
config example to the developer docs.
  • Loading branch information
rickstaa committed Jan 27, 2025
1 parent cd56616 commit 83261f1
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 35 deletions.
61 changes: 31 additions & 30 deletions runner/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "ai-runner",
// Image to use for the dev container. More info: https://containers.dev/guide/dockerfile.
"build": {
"dockerfile": "../Dockerfile",
// "dockerfile": "../docker/Dockerfile.text_to_speech",
"context": ".."
},
"runArgs": [
"--gpus=all"
],
// Features to add to the dev container. More info: https://containers.dev/features.
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"ms-python.python",
"ms-python.black-formatter"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8000
],
// Use 'mounts' to make a list of local folders available inside the container.
"mounts": [
// "source=${localWorkspaceFolder}/models,target=/models,type=bind"
"source=${localEnv:HOME}/.lpData/models,target=/models,type=bind"
]
"name": "ai-runner",
// Image to use for the dev container. More info: https://containers.dev/guide/dockerfile.
"build": {
"dockerfile": "../Dockerfile",
// "dockerfile": "../docker/Dockerfile.text_to_speech",
"context": ".."
},
"runArgs": [
"--gpus=all"
// "--shm-size=1g" // Increase shared memory size to 1GB for GPU parallelism.
],
// Features to add to the dev container. More info: https://containers.dev/features.
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"ms-python.python",
"ms-python.black-formatter"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8000
],
// Use 'mounts' to make a list of local folders available inside the container.
"mounts": [
// "source=${localWorkspaceFolder}/models,target=/models,type=bind"
"source=${localEnv:HOME}/.lpData/models,target=/models,type=bind"
]
}
48 changes: 43 additions & 5 deletions runner/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,42 @@ Leverage the [VSCode DevContainer](https://code.visualstudio.com/docs/remote/con

For more, see the [VSCode documentation on DevContainers](https://code.visualstudio.com/docs/devcontainers/containers).

### Debugging Locally

To debug the AI runner locally, follow these steps:

1. **Configure launch.json**: Add the following configuration to your `launch.json` file:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: LLM",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"app.main:app",
"--log-config",
"app/cfg/uvicorn_logging_config.json",
"--host",
"0.0.0.0",
"--port",
"8000"
],
"env": {
"PIPELINE": "text-to-image",
"MODEL_ID": "SG161222/RealVisXL_V4.0_Lightning"
}
}
]
}
```

2. **Set Breakpoints**: Add breakpoints to the code where you wish to pause execution.
3. **Launch Debugger**: Press `F5` to start the debugger.

### Debugging with External Services

To debug the AI runner when it operates within a container orchestrated by external services, such as [go-livepeer](https://github.com/livepeer/go-livepeer/tree/ai-video), follow these steps to attach to the container:
Expand Down Expand Up @@ -80,17 +116,19 @@ To debug the AI runner when it operates within a container orchestrated by exter
}
```

7. **Revert Changes**: After debugging, undo the debug patch.
7. **Set Breakpoints**: Add breakpoints to the code where you wish to pause execution.
8. **Launch Debugger**: Press `F5` to start the debugger.
9. **Revert Changes**: After debugging, undo the debug patch.

```bash
cd .. && git apply -R ./runner/dev/patches/debug.patch && cd runner
```

8. **Rebuild the Image**: Execute a rebuild of the image, ensuring to exclude the debug changes.
10. **Rebuild the Image**: Execute a rebuild of the image, ensuring to exclude the debug changes.

```bash
docker build -t livepeer/ai-runner:latest .
```
```bash
docker build -t livepeer/ai-runner:latest .
```

### Mocking the Pipelines

Expand Down

0 comments on commit 83261f1

Please sign in to comment.