kiwi.lib.predict
RunConfig
Base class for all pydantic configs. Used to configure base behaviour of configs.
Configuration
load_system(system_path: Union[str, Path], gpu_id: Optional[int] = None)
load_system
Load a pretrained system (model) into a Runner object.
predict_from_configuration(configuration_dict: Dict[str, Any])
predict_from_configuration
Run the entire prediction pipeline using the configuration options received.
run(config: Configuration, output_dir: Path) → Tuple[Dict[str, List], Optional[MetricsReport]]
run
Run the prediction pipeline.
make_predictions(output_dir: Path, best_model_path: Path, data_partition: Literal['train', 'valid', 'test'], data_config: WMTQEDataset.Config, outputs_config: QEOutputs.Config = None, batch_size: Union[int, BatchSizeConfig] = None, num_workers: int = 0, gpu_id: int = None)
make_predictions
Make predictions over the validation set using the best model created during
setup_run(config: RunConfig, quiet=False, debug=False, anchor_dir: Path = None) → Path
setup_run
Prepare for running the prediction pipeline.
kiwi.lib.predict.
logger
Bases: kiwi.utils.io.BaseConfig
kiwi.utils.io.BaseConfig
seed
Random seed
run_id
If specified, MLflow/Default Logger will log metrics and params under this ID. If it exists, the run status will change to running. This ID is also used for creating this run’s output directory. (Run ID must be a 32-character hex string).
output_dir
Output several files for this run under this directory. If not specified, a directory under “runs” is created or reused based on the Run UUID.
predict_on_data_partition
Name of the data partition to predict upon. File names are read from the corresponding data configuration field.
data
check_consistency
system
use_gpu
If true and only if available, use the CUDA device specified in gpu_id or the first CUDA device. Otherwise, use the CPU.
gpu_id
Use CUDA on the listed device, only if use_gpu is true.
verbose
quiet
enforce_loading
setup_gpu
setup_gpu_id
system_path – A path to the saved checkpoint file produced by a training run.
gpu_id – id of the gpu to load the model into (-1 or None to use CPU)
Exception: If the path does not exist, or is not a valid system file.
Load the model and necessary files and create the model’s predictions for the configured data partition.
config – validated configuration values for the (predict) pipeline.
output_dir – directory where to save predictions.
Dictionary with format {‘target’: predictions}
Predictions
Make predictions over the validation set using the best model created during training.
output_dir – output Directory where predictions should be saved.
best_model_path – path pointing to the checkpoint with best performance.
data_partition – on which dataset to predict (one of ‘train’, ‘valid’, ‘test’).
data_config – configuration containing options for the data_partition set.
data_partition
outputs_config – configuration specifying which outputs to activate.
batch_size – for predicting.
num_workers – number of parallel data loaders.
gpu_id – GPU to use for predicting; 0 for CPU.
predictions}.
dictionary with predictions in the format {‘target’
This includes setting up the output directory, random seeds, and loggers.
config – configuration options.
quiet – whether to suppress info log messages.
debug – whether to additionally log debug messages (:param:`quiet` has precedence)
anchor_dir – directory to use as root for paths.
the resolved path to the output directory.
kiwi.lib.evaluate
kiwi.lib.pretrain