Request Validation¶
omnirt.validate() and the omnirt validate command check whether a request would run without touching the hardware: model existence, task compatibility, config field legality, dimension constraints, adapter / model compatibility.
Why validate before running on real hardware¶
- Cheap: validation only reads the registry, presets, and schema — no weight loading, no GPU time
- Predictable: a
ValidationErrorpoints to the exact field, e.g. "widthmust be a multiple of 8", instead of a cryptic CUDA runtime error - Consistent: the same request validates identically on
cpu-stub,cuda, andascend
Minimal examples¶
from omnirt import validate
from omnirt.requests import text2image
req = text2image(model="sd15", prompt="a lighthouse", width=513) # 513 isn't a multiple of 8
result = validate(req, backend="cpu-stub")
print(result.ok) # False
print(result.errors) # [("config.width", "must be a multiple of 8"), ...]
There is no separate /v1/validate endpoint yet; set "dry_run": true inside config to run validation only:
What validation covers¶
- Model existence — whether
model(or an alias) is in the registry - Task match — whether the model supports the task (via
ModelCapabilities.tasks) - Required fields —
prompt(text2image / text2video),image(image2image / image2video),audio(audio2video), etc. - Numerical constraints —
width/heightmultiples,strength ∈ (0, 1],num_frames/fpsranges - Preset legality —
preset ∈ {fast, balanced, quality, low-vram}and defined for this task + model - Adapter compatibility — LoRA / ControlNet references must appear in
ModelCapabilities.adapters - Backend reachability —
backend=cudawithtorch.cuda.is_available()=Falsefails unlessbackend=auto
In production¶
The FastAPI server runs the same validate() before inference; a failure returns 400 Bad Request with the errors array.
Related¶
- Python API — full
validate()/generate()signatures - Service Schema — field-level reference for
GenerateRequest - CLI —
omnirt validatesubcommand flags