fovi package

fovi.get_trainer_from_base_fn(base_fn, load=True, load_strict=True, quiet=False, allow_distributed=False, gpu=0, model_dirs=['../models', SAVE_DIR + '/logs', SLOW_DIR + '/logs'], **kwargs)[source]

Get a Trainer instance based on a base filename and optional parameters.

This function loads a model configuration and optionally its weights from a specified directory, creates a Trainer instance with the loaded configuration, and returns it.

Parameters:
  • base_fn (str) – The base filename to look for in the logs directory.

  • load (bool, optional) – Whether to load the model weights. Defaults to True.

  • load_strict (bool, optional) – Whether to strictly enforce matching keys when loading weights. Defaults to True.

  • quiet (bool, optional) – Whether to suppress print statements. Defaults to False.

  • allow_distributed (bool, optional) – Whether to allow distributed training configuration. Defaults to False.

  • **kwargs – Additional keyword arguments to override or add to the configuration.

Returns:

An instance of Trainer with the specified configuration and optionally loaded weights.

Return type:

Trainer

Note

The function searches for the model in both SLOW_DIR and SAVE_DIR. It prioritizes loading final weights over non-final weights if available.

fovi.get_model_from_base_fn(base_fn, load=True, load_strict=True, quiet=False, device='cuda', model_dirs=['../models'], fovinet_cls: Type[Module] = FoviNet, **kwargs)[source]

Get a FoviNet instance based on a base filename and optional parameters.

This function loads a model configuration and optionally its weights from a specified directory, creates an FoviNet instance with the loaded configuration, and returns it.

Parameters:
  • base_fn (str) – The base filename to look for in the logs directory.

  • load (bool, optional) – Whether to load the model weights. Defaults to True.

  • load_strict (bool, optional) – Whether to strictly enforce matching keys when loading weights. Defaults to True.

  • quiet (bool, optional) – Whether to suppress print statements. Defaults to False.

  • device (str, optional) – Device to load the model on. Defaults to ‘cuda’.

  • **kwargs – Additional keyword arguments to override or add to the configuration.

Returns:

An instance of FoviNet with the specified configuration and optionally loaded weights.

Return type:

FoviNet

Note

The function searches for the model in both SLOW_DIR and SAVE_DIR. It prioritizes loading final weights over non-final weights if available.

Subpackages

Modules