taskflow#
- class Taskflow(task, model=None, mode=None, device_id=0, from_hf_hub=False, **kwargs)[源代码]#
基类:
object
- The Taskflow is the end2end interface that could convert the raw text to model result, and decode the model result to task result. The main functions as follows:
Convert the raw text to task result.
Convert the model to the inference model.
Offer the usage and help message.
- 参数:
task (str) -- The task name for the Taskflow, and get the task class from the name.
model (str, optional) -- The model name in the task, if set None, will use the default model.
mode (str, optional) -- Select the mode of the task, only used in the tasks of word_segmentation and ner. If set None, will use the default mode.
device_id (int, optional) -- The device id for the gpu, xpu and other devices, the defalut value is 0.
kwargs (dict, optional) -- Additional keyword arguments passed along to the specific task.