Source code for pie_extended.processes
""" What a model needs besides its Hugging Face model: the processes of a language (tokenizer, processors, disambiguation).
A family of languages has a module here (`latin`, `french`, `armenian`...) with a `PROCESSES` dictionary, and a model of
`pie_extended.models` names one of them (`process="latin:lasla"`). Several models can share one.
"""
from dataclasses import dataclass
from typing import Any, Callable, Optional, Tuple
[docs]
@dataclass(frozen=True)
class Process:
""" The code that goes with a model
:param pipeline: `pipeline(max_tokens=256) -> (data iterator, processor)`
:param disambiguator: An `ObjectCreator` of the disambiguator, if the model has one
:param disambiguation_tasks: The tasks that must be computed for the disambiguation to run
:param addons: `addons(model) -> bool`: what the model needs besides its files (`pie-extended install-addons`)
"""
pipeline: Callable
disambiguator: Any = None
disambiguation_tasks: Tuple[str, ...] = ()
addons: Optional[Callable] = None