Skip to main content
The project teaches Qwen/Qwen2.5-Coder-1.5B-Instruct to answer a question about a database with one SQLite query. It trains a LoRA adapter on a public text-to-SQL dataset, runs every query the base model and the tuned model write, and counts how often each returns the right rows. You get a Markdown report with both accuracies, a vLLM server that hosts both models behind one OpenAI-compatible URL, and an endpoint that shows their answers side by side.

How it fits together

One volume holds the weights, data, checkpoints and adapters. Two secrets, SQL_SERVER_URL and SQL_SERVER_TOKEN, reach only compare. Nothing holds a GPU while idle. The volume holds about 3 GB of base weights plus the adapter and two checkpoints per run.

Run it

1

Download

The CLI installs once with uv tool install lazycloud-client. The commands below download a standalone project and install its dependencies; no repository checkout is needed. The guide then runs from that directory through uv run, which uses the project’s pinned SDK.
PyTorch, PEFT and vLLM sit in the gpu dependency group and the dataset tools in data; only the remote images install them.
2

Deploy

Deploying starts nothing. The pod waits for its first request and the functions wait for calls.
3

Train and evaluate

evaluate returns both accuracies and a report_url. A second run with other settings gets its own name:
4

Configure

Create an access token in the dashboard under Settings, then Tokens. The script asks for it and for the sql-server URL from the deploy output, the one whose host ends in -8000, and stores both as secrets.
5

Use

--database points at your own file of CREATE TABLE and INSERT statements. The first request after an idle period starts the GPU pod. Any OpenAI client can call the server directly, with your token as the API key and base or tuned as the model.

One volume for every step

A volume mounts at the same path in every container, so the base weights download once and training, evaluation and serving read them from storage.
lora_sql/resources.py

A GPU function that resumes

A GPU list takes whichever card is free first, and a preempted call restarts from the newest complete checkpoint on the volume.
lora_sql/train.py

Fan out scoring with .map

.map runs one call per batch, the autoscaler spreads them over up to ten containers, and a batch that fails after its retries yields None.
lora_sql/evaluate.py
lora_sql/evaluate.py

The report as an artifact

An artifact saved by a task gets a public link that lasts up to seven days, or less when your plan keeps artifacts for a shorter time.
lora_sql/evaluate.py

A pod behind an endpoint

sql-server is a pod that runs vllm serve with health_check_path="/health", stops after five idle minutes and checks a LazyCloud token on every request. A container holds no credential of its own, so the endpoint reads the pod’s URL and a token from secrets.
lora_sql/compare.py

Adapt it

  • BASE_MODEL in resources.py picks another model. A 7B model needs a larger GPU, such as GpuType.L40S, in GPUS.
  • usable_examples takes any rows with a question, the database statements and reference SQL. Your own query logs make a better training set for your own database.
  • SERVED_RUN in serve.py picks the adapter the server loads. Change it and redeploy to promote a run.

Clean up

Then delete the access token in the dashboard. Keeping the volume keeps the base weights, datasets and adapters for the next run.