pyhazards.engine package

Submodules

pyhazards.engine.trainer module

class pyhazards.engine.trainer.Trainer(model, device=None, metrics=None, strategy='auto', mixed_precision=False)[source]

Bases: object

Lightweight training abstraction with a familiar API: fit -> evaluate -> predict.

_make_loader(inputs, targets, batch_size, num_workers, collate_fn, shuffle=True)[source]
Return type:

Iterable

_to_device(obj)[source]
Return type:

Any

evaluate(data, split='test', batch_size=64, num_workers=0, collate_fn=None)[source]
Return type:

Dict[str, float]

fit(data, train_split='train', val_split=None, max_epochs=1, optimizer=None, loss_fn=None, batch_size=32, num_workers=0, collate_fn=None)[source]

Minimal fit loop that works for tensor-based splits. Extend/replace with custom DataLoaders for complex data.

Return type:

None

predict(data, split='test', batch_size=64, num_workers=0, collate_fn=None)[source]
Return type:

List[Tensor]

save_checkpoint(path)[source]
Return type:

None

pyhazards.engine.distributed module

class pyhazards.engine.distributed.DistributedConfig(strategy='auto', devices=None)[source]

Bases: object

devices: int | None = None
strategy: Literal['auto', 'ddp', 'dp', 'none'] = 'auto'
pyhazards.engine.distributed.select_strategy(prefer='auto')[source]
Return type:

Literal['auto', 'ddp', 'dp', 'none']

pyhazards.engine.inference module

class pyhazards.engine.inference.SlidingWindowInference(model, window_fn=None)[source]

Bases: object

Placeholder for sliding-window inference over large rasters or grids. Implement windowing logic and stitching as needed.

Module contents

class pyhazards.engine.DistributedConfig(strategy='auto', devices=None)[source]

Bases: object

devices: int | None = None
strategy: Literal['auto', 'ddp', 'dp', 'none'] = 'auto'
class pyhazards.engine.SlidingWindowInference(model, window_fn=None)[source]

Bases: object

Placeholder for sliding-window inference over large rasters or grids. Implement windowing logic and stitching as needed.

class pyhazards.engine.Trainer(model, device=None, metrics=None, strategy='auto', mixed_precision=False)[source]

Bases: object

Lightweight training abstraction with a familiar API: fit -> evaluate -> predict.

_make_loader(inputs, targets, batch_size, num_workers, collate_fn, shuffle=True)[source]
Return type:

Iterable

_to_device(obj)[source]
Return type:

Any

evaluate(data, split='test', batch_size=64, num_workers=0, collate_fn=None)[source]
Return type:

Dict[str, float]

fit(data, train_split='train', val_split=None, max_epochs=1, optimizer=None, loss_fn=None, batch_size=32, num_workers=0, collate_fn=None)[source]

Minimal fit loop that works for tensor-based splits. Extend/replace with custom DataLoaders for complex data.

Return type:

None

predict(data, split='test', batch_size=64, num_workers=0, collate_fn=None)[source]
Return type:

List[Tensor]

save_checkpoint(path)[source]
Return type:

None

pyhazards.engine.select_strategy(prefer='auto')[source]
Return type:

Literal['auto', 'ddp', 'dp', 'none']