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:
objectLightweight 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
- 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
pyhazards.engine.distributed module¶
pyhazards.engine.inference module¶
Module contents¶
- class pyhazards.engine.DistributedConfig(strategy='auto', devices=None)[source]¶
Bases:
object-
devices:
int|None= None¶
-
strategy:
Literal['auto','ddp','dp','none'] = 'auto'¶
-
devices:
- class pyhazards.engine.SlidingWindowInference(model, window_fn=None)[source]¶
Bases:
objectPlaceholder 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:
objectLightweight 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
- 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