Dataset & DataLoader

class softs.SoftIterableDataset[source]

Infinite dataset yielding decoded tensor dicts.

Call set_model(model_id) to switch models at any time. DataLoader workers detect the change and discard pending work.

__init__(model_id, endpoint, batch_config, medium_cls, num_slots=8, retry_delay=0.01, request_timeout=60.0)[source]
Parameters:
property model_id: str
set_model(model_id)[source]
Parameters:

model_id (str)

Return type:

None

class softs.SoftDataLoader[source]

DataLoader with model switching support.

Usage:

loader = SoftDataLoader(model_id="teacher_v1", endpoint=ep.frontend,
                        batch_config=config, medium_cls=ShmMedium,
                        num_slots=8, batch_size=4)
for batch in loader:
    train(batch)

loader.set_model("teacher_v2")  # switch the requested product id
__init__(model_id, endpoint, batch_config, medium_cls, num_slots=8, retry_delay=0.01, request_timeout=60.0, **dataloader_kwargs)[source]
Parameters:
set_model(model_id)[source]
Parameters:

model_id (str)

Return type:

None

property model_id: str
class softs.Batch[source]
__init__(tensors, slot_ids=None, client=None)[source]
Parameters:
keys()[source]
release()[source]
Return type:

None

softs.make_collate_fn(client, batch_config, auto_release=True)[source]
Parameters:
Return type:

Callable[[list[int]], Batch]