Quick start

Start with Redwood installed, a model’s .rdl file and its local checkpoint directory.

Compile the model

uv run redwood compile <path-to-model-rdl> \
    checkpoint=/path/to/model \
    --output /path/to/compiled-model

Use a new output directory. The compiler will not overwrite an existing one.

checkpoint is a name declared by the RDL. Another program may use different names or require several checkpoints. Inspect its upfront Model(...) declarations and bind each required name.

The compiler reads weights, infers shapes and dtypes, selects kernels and writes the compiled model. The final message gives the output path.

Run one prompt

uv run redwood run /path/to/compiled-model

Enter a prompt and press Enter. The CLI reads one request per line. With the standard text processors, it prints the generated answer.

Each plain-text line is a complete prompt. For a conversation, supply the complete message list as JSON, or keep that list in your application.

Use Python

from redwood.runtime import Model

with Model[str, str]("/path/to/compiled-model", threads=4) as model:
    answer = model.run("Explain CPU inference in one sentence.")
    print(answer)

This uses preprocessing and postprocessing declared by the RDL and recorded in the compiled directory. If neither defaults nor supplied callbacks exist for either stage, Model raises an error.

The context manager keeps caches between requests and releases resources when it exits. Use Model for streaming and application input, or Runtime for named tensor input.

Try audio or images

The selected processor defines the request format. For example, a compiled Whisper model accepts an audio path. An image model accepts a JSON request with a prompt and generation settings.

See the processing reference for request examples and model-specific requirements.

Where to go next