filters.models.qe_models#

Module Contents#

Classes#

Data#

API#

class filters.models.qe_models.COMETQEModel(
name: str,
model: collections.abc.Callable,
gpu: bool = False,
)#

Bases: filters.models.qe_models.QEModel

Initialization

MODEL_NAME_TO_HF_PATH: Final[dict[str, str]]#

None

classmethod load_model(
model_name: str,
gpu: bool = False,
) filters.models.qe_models.COMETQEModel#
predict(input_list: list) list[float]#
static wrap_qe_input(
src: str,
tgt: str,
reverse: bool = False,
) dict[str, str]#
filters.models.qe_models.COMET_IMPORT_MSG#

‘To run QE filtering with COMET, you need to install from PyPI with: pip install unbabel-comet. Mor…’

filters.models.qe_models.PYMARIAN_IMPORT_MSG#

‘To run QE filtering with Cometoid/PyMarian, you need to install PyMarian. More information at https:…’

class filters.models.qe_models.PyMarianQEModel(
name: str,
model: collections.abc.Callable,
gpu: bool = False,
)#

Bases: filters.models.qe_models.QEModel

Initialization

MARIAN_CPU_ARGS#

‘ –cpu-threads 1 -w 2000’

MARIAN_GPU_ARGS#

‘ -w 8000 –mini-batch 32 -d 0’

MODEL_NAME_TO_HF_PATH: Final[dict[str, str]]#

None

SHARD_SIZE#

5000

classmethod load_model(
model_name: str,
gpu: bool = False,
) filters.models.qe_models.PyMarianQEModel#
predict(input_list: list) list[float]#
static wrap_qe_input(src: str, tgt: str, reverse: bool = False) list[str]#
class filters.models.qe_models.QEModel(name: str, model: collections.abc.Callable, gpu: bool = False)#

Bases: abc.ABC

Initialization

abstractmethod classmethod load_model(model_name: str) filters.models.qe_models.QEModel#
abstractmethod predict(**kwargs) list[float]#
abstractmethod static wrap_qe_input(src: str, tgt: str, reverse: bool = False) list[str]#
filters.models.qe_models.comet#

‘safe_import(…)’

filters.models.qe_models.pymarian#

‘safe_import(…)’