Pipelines provide a high-level, easy to use, API for running machine learning models.
Example: Instantiate pipeline using the pipeline function.
import { pipeline } from '@huggingface/transformers';
const classifier = await pipeline('sentiment-analysis');
const output = await classifier('I love transformers!');
// [{'label': 'POSITIVE', 'score': 0.999817686}].pipeline(task, [model], [options]) ⇒ Promise.<AllTasks> ~files_loading : FilesLoadingMap~metadata : Array.<{exists: boolean, size: number, contentType: string, fromCache: boolean}>~AllTasks : stringUtility factory method to build a Pipeline object.
Kind: static method of pipelines
Returns: Promise.<AllTasks> - A Pipeline object for the specified task.
Throws:
Error If an unsupported pipeline is requested.| Param | Type | Default | Description |
|---|---|---|---|
| task | T | The task defining which pipeline will be returned. Currently accepted tasks are:
| |
| [model] | string | null | The name of the pre-trained model to use. If not specified, the default model for the task will be used. |
| [options] | PretrainedModelOptions | Optional parameters for the pipeline. |
.pipeline(task, [model], [options]) ⇒ Promise.<AllTasks> ~files_loading : FilesLoadingMap~metadata : Array.<{exists: boolean, size: number, contentType: string, fromCache: boolean}>Kind: inner property of pipeline
Kind: inner constant of pipeline
All possible pipeline types.
Kind: inner typedef of pipelines