Buckets:

HuggingFaceDocBuilder's picture
|
download
raw
4.2 kB
# pipelines
Pipelines provide a high-level, easy to use, API for running machine learning models.
**Example:** Instantiate pipeline using the `pipeline` function.
```javascript
import { pipeline } from '@huggingface/transformers';
const classifier = await pipeline('sentiment-analysis');
const output = await classifier('I love transformers!');
// [{'label': 'POSITIVE', 'score': 0.999817686}]
```
* [pipelines](#module_pipelines)
* _static_
* [`.pipeline(task, [model], [options])`](#module_pipelines.pipeline) ⇒ Promise.<AllTasks>
* [`~files_loading`](#module_pipelines.pipeline..files_loading) : FilesLoadingMap
* [`~metadata`](#module_pipelines.pipeline..metadata) : Array.<{exists: boolean, size: number, contentType: string, fromCache: boolean}>
* _inner_
* [`~AllTasks`](#module_pipelines..AllTasks) : string
* * *
## `pipelines.pipeline(task, [model], [options])` ⇒ Promise.<AllTasks>
Utility factory method to build a `Pipeline` object.
**Kind**: static method of [pipelines](#module_pipelines)
**Returns**: Promise.<AllTasks> - A Pipeline object for the specified task.
**Throws**:
- Error If an unsupported pipeline is requested.
ParamTypeDefaultDescription
taskTThe task defining which pipeline will be returned. Currently accepted tasks are:
"audio-classification": will return a AudioClassificationPipeline.
"automatic-speech-recognition": will return a AutomaticSpeechRecognitionPipeline.
"background-removal": will return a BackgroundRemovalPipeline.
"depth-estimation": will return a DepthEstimationPipeline.
"document-question-answering": will return a DocumentQuestionAnsweringPipeline.
"feature-extraction": will return a FeatureExtractionPipeline.
"fill-mask": will return a FillMaskPipeline.
"image-classification": will return a ImageClassificationPipeline.
"image-segmentation": will return a ImageSegmentationPipeline.
"image-to-text": will return a ImageToTextPipeline.
"object-detection": will return a ObjectDetectionPipeline.
"question-answering": will return a QuestionAnsweringPipeline.
"summarization": will return a SummarizationPipeline.
"text2text-generation": will return a Text2TextGenerationPipeline.
"text-classification" (alias "sentiment-analysis" available): will return a TextClassificationPipeline.
"text-generation": will return a TextGenerationPipeline.
"token-classification" (alias "ner" available): will return a TokenClassificationPipeline.
"translation": will return a TranslationPipeline.
"translation_xx_to_yy": will return a TranslationPipeline.
"zero-shot-classification": will return a ZeroShotClassificationPipeline.
"zero-shot-audio-classification": will return a ZeroShotAudioClassificationPipeline.
"zero-shot-image-classification": will return a ZeroShotImageClassificationPipeline.
"zero-shot-object-detection": will return a ZeroShotObjectDetectionPipeline.
[model]stringnullThe name of the pre-trained model to use. If not specified, the default model for the task will be used.
[options]PretrainedModelOptionsOptional parameters for the pipeline.
* [`.pipeline(task, [model], [options])`](#module_pipelines.pipeline) ⇒ Promise.<AllTasks>
* [`~files_loading`](#module_pipelines.pipeline..files_loading) : FilesLoadingMap
* [`~metadata`](#module_pipelines.pipeline..metadata) : Array.<{exists: boolean, size: number, contentType: string, fromCache: boolean}>
* * *
### `pipeline~files_loading` : FilesLoadingMap
**Kind**: inner property of [pipeline](#module_pipelines.pipeline)
* * *
### `pipeline~metadata` : Array.<{exists: boolean, size: number, contentType: string, fromCache: boolean}>
**Kind**: inner constant of [pipeline](#module_pipelines.pipeline)
* * *
## `pipelines~AllTasks` : string
All possible pipeline types.
**Kind**: inner typedef of [pipelines](#module_pipelines)
* * *

Xet Storage Details

Size:
4.2 kB
·
Xet hash:
3b576f0476be3eb9d1237f6e4bdecd8155d09ef2f2336fc03edf54eae1cce156

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.