Skip to content

Specs

sheaf.spec

ModelSpec — declares what Sheaf should serve.

ModelSpec

Bases: BaseModel

Declares a model to be served by Sheaf.

Example (registry-based — backend module must be imported first): spec = ModelSpec( name="chronos2-small", model_type=ModelType.TIME_SERIES, backend="chronos2", backend_kwargs={"model_size": "small"}, resources=ResourceConfig(num_gpus=1, replicas=2), batch_policy=BatchPolicy(max_batch_size=64, bucket_by="horizon"), )

Example (class-based — useful for custom or test backends): spec = ModelSpec( name="my-model", model_type=ModelType.TIME_SERIES, backend="my-model", backend_cls=MyModelBackend, )

When backend_cls is provided it takes precedence over the registry lookup. Ray Serve serializes the class via cloudpickle, so it works for locally- defined backends without needing a separate module import in the worker.