Model In The Loop
- class cheese.models.BaseModel(batch_size: int = 1)[source]
BaseModel object handles anything that may require a model for processing data. It can also be used more generally just to handle data processing separately from the pipeline and client.
- Parameters
batch_size (int) – The maximum number of elements to process at once. If there are not this many elements available, the model will simply process everything that is in the task queue.
- handle_queued_tasks()[source]
Handle every task in queue. New tasks can be added to queue if needed. Should not be called again if still running.
- abstract process(data: Iterable[cheese.data.BatchElement]) → Iterable[cheese.data.BatchElement][source]
Process BatchElement with model. Assume the inputs to the model are in the BatchElement, then use them to create some outputs. The outputs should be added to the BatchElement before it is returned.
- Parameters
data – The data to process. Can be an iterable of BatchElements, or a single one, depending on use-case.
- queue_task(task: cheese.tasks.Task)[source]
Creates a task and queue to client.
- Parameters
task (Task) – The task to queue