Skip to content

Examples

Every example in the repository, grouped by what it does. Each one is a folder or a file you can copy and run.

Uses names the library API the example calls: Jobs, Endpoints, Tasks or Images. The agent folders start with the same name.

Training

Fine-tune a model with Axolotl

QLoRA on Qwen/Qwen2.5-0.5B on one spot H100, with the config and the results in Object Storage.

Uses: Jobs · Format: Python · YAML

Read walkthrough → · View files →

Compare fine-tuning runs

An Axolotl sweep over two model configurations, one spot H100 job each, with each result in its own folder.

Uses: Jobs · Format: Python · YAML

Read walkthrough → · View files →

Inference

Serve a model with vLLM

Qwen/Qwen3-0.6B behind an OpenAI-compatible API and a bearer token, on one H100 endpoint.

Uses: Endpoints · Format: Python · YAML

Read walkthrough → · View files →

Batch

Multiply matrices in parallel jobs

Three GPU jobs, one matrix size each: submit every job first, then wait for each and check its report.

Uses: Jobs · Format: Python

Read walkthrough → · View files →

Pipelines

Train MNIST with a pipeline of tasks

Prepare, train with four learning rates at once, evaluate, and pick the best run, as ns.Task steps. Runs as plain Python or as a Prefect flow.

Uses: Tasks · Images · Format: Python

Read walkthrough → · View files →

Pick the best fine-tuning config with tasks

Three Axolotl configs at once on H100s, a perplexity check for each adapter, and the best one picked on a CPU. Runs as plain Python or as a Prefect flow.

Uses: Tasks · Prefect · Format: Python

Read walkthrough → · View files →

Fine-tune and evaluate with CPU and GPU steps

Prepare data on a CPU, fine-tune on an H100, evaluate on a GPU, and report on a CPU. Files pass between steps through /ns, and project code goes to the jobs with local_libs.

Uses: Tasks · Prefect · Format: Python

Read walkthrough → · View files →

Run tasks in a Prefect flow

A pipeline of tasks as a Prefect flow. The flow runs on a small Nebius job, and every task is a Prefect task run with a link to its job.

Uses: Tasks · Prefect · Format: Python

Read walkthrough → · View files →

Agents

Agents that start GPUs as tools. The agent decides when it needs a GPU. Our code decides everything that costs money or touches credentials, and cleans up whatever the agent leaves behind. Each example folder stands alone: copy one folder to start your own agent.

Generate images with an agent and an endpoint

The agent starts a Sana endpoint, generates an image, looks at it, and stops the endpoint. Every endpoint the run created is deleted at the end.

Uses: Endpoints · Format: Python

Read walkthrough → · View files →

Generate images with an agent and a task

Up to four keyframe options in one H100 job that stops by itself. A retried tool call in the same process starts no second job.

Uses: Tasks · Format: Python

Read walkthrough → · View files →

Notebooks

Job lifecycle

One GPU job, one cell at a time: describe it, dry-run it, create it, wait, read the logs, reload it by id, and cancel it.

Uses: Jobs · Format: Notebook

Read walkthrough → · View files →

Endpoint workflow

A vLLM endpoint from create to delete: wait until the model answers, send a chat request, stop it and start it again.

Uses: Endpoints · Format: Notebook

Read walkthrough → · View files →

Evaluate a model in a notebook

An evaluation function defined in a cell runs as a task on an H100, with sync calls only: a blocking call, submit, and a failure with the job's traceback.

Uses: Tasks · Images · Format: Notebook

Read walkthrough → · View files →

Build an image

Build a Dockerfile on Nebius with ns.Image, check the dry run, and run a GPU job on the image.

Uses: Images · Jobs · Format: Notebook

Read walkthrough → · View files →