Skip to content

Commit

Permalink
docs: add installation tutorials for skypilot serving (TabbyML#1099)
Browse files Browse the repository at this point in the history
* docs: add installation tutorials for skypilot serving

* Apply suggestions from code review

Co-authored-by: Zongheng Yang <[email protected]>

* Update index.md

* Update index.md

---------

Co-authored-by: Zongheng Yang <[email protected]>
  • Loading branch information
wsxiaoys and concretevitamin authored Dec 22, 2023
1 parent 2d44018 commit 9c46709
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
86 changes: 86 additions & 0 deletions website/docs/installation/skypilot/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# SkyPilot Serving

[SkyPilot](https://skypilot.readthedocs.io/en/latest/) is a versatile framework designed for the execution of LLMs, AI, and batch jobs on any cloud vendors. It stands out by offering significant cost savings, optimal GPU availability, and managed execution capabilities.

[SkyServe](https://skypilot.readthedocs.io/en/latest/serving/sky-serve.html) is SkyPilot’s model serving library. SkyServe (short for SkyPilot Serving) takes an existing serving framework and deploys it across one or more regions or clouds.

When leveraging SkyServe, all replica Tabby instances are seamlessly deployed within your own cloud accounts and VPCs.

## Configuration

At first, let's specified the resource requirements for the Tabby service in the YAML configuration for SkyServe.

```yaml
resources:
ports: 8080
accelerators: T4:1
```
Skypilot supports GPU from various cloud vendors. Please refer to the official [Skypilot documentation](https://skypilot.readthedocs.io/en/latest/getting-started/installation.html) for detailed installation instructions.
As Tabby exposes its health check at `/v1/health`, we can define the following service configuration:

```yaml
service:
readiness_probe: /v1/health
replicas: 1
```

Finally, we define the command line that actually initiates the container job:

```yaml
run: |
docker run --gpus all -p 8080:8080 -v ~/.tabby:/data \
tabbyml/tabby \
serve --model TabbyML/StarCoder-1B --device cuda
```

## Launch the service

We first execute `sky serve up tabby.yaml -n tabby`.

![start tabby service](./start-service.png)

If everything goes well, you'll see messages below
![service ready](./service-ready.png)

This finishes launching SkyServe's control VM which runs a load balancer for this serve; the actual replica running the Tabby service is undergoing provisioning.

When you execute the following command, you'll encounter a message indicating that the replica is not ready:

```bash
$ curl -L 'http://44.203.34.65:30001/v1/health'
{"detail":"No available replicas. Use \"sky serve status [SERVICE_NAME]\" to check the replica status."}%
```

You can monitor the progress of starting the actual tabby job by checking the replica log:

```bash
# Tailing the logs of replica 1 for the tabby service
sky serve logs tabby 1
```

Once the service is ready, you will see something like the following:

![tabby ready](./tabby-ready.png)

SkyServe uses a redirect load balancer at its front, so the `-L` command is necessary if you would like to test the completion api with `curl`.

```bash
$ curl -L -X 'POST' \
'http://44.203.34.65:30001/v1/completions' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"language": "python",
"segments": {
"prefix": "def fib(n):\n ",
"suffix": "\n return fib(n - 1) + fib(n - 2)"
}
}'
{"id":"cmpl-ba9aae81-ed9c-419b-9616-fceb92cdbe79","choices":[{"index":0,"text":" if n <= 1:\n return n"}]}
```

Now, you can utilize the load balancer URL (`http://44.203.34.65:30001` in this case) within Tabby editor extensions. Please refer to `tabby.yaml` for the comprehensive configuration used in this tutorial.
3 changes: 3 additions & 0 deletions website/docs/installation/skypilot/service-ready.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/installation/skypilot/start-service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/docs/installation/skypilot/tabby-ready.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions website/docs/installation/skypilot/tabby.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resources:
ports: 8080
accelerators: T4:1

service:
readiness_probe: /v1/health
replicas: 1

run: |
docker run --gpus all -p 8080:8080 -v ~/data:/data \
tabbyml/tabby \
serve --model TabbyML/StarCoder-1B --device cuda

0 comments on commit 9c46709

Please sign in to comment.