Docs /Templates/ sinapsis-huggingface-transformers

SentimentAnalysisTransformers

sinapsis-huggingface-transformersTransformersmodelsaudiospeechtext-to-speech

Python template · sinapsis_huggingface_transformers.templates.sentiment_analysis_transformers

Overview

This template collects all the content in the text packets and runs inference using the sentiment-analysis task within the pipeline. Depending on the model, the label can be as simple as positive-negative or more complex.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-huggingface-transformers==1.0.0
uv pip install sinapsis-huggingface-transformers==1.0.0
uv add sinapsis-huggingface-transformers==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

seed
int | None
Optional
Default: null
task
typing.Literal['zero-shot-classification', 'sentiment-analysis']
Optional
Default: "zero-shot-classification"
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
model_path
Model from Huggingface hub that accepts sentiment-analysis or zero-short-classification in the pipeline. Options for zero-shot-classification:"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli", "facebook/bart-large-mnli",… Read full field description

Model from Huggingface hub that accepts sentiment-analysis or zero-short-classification in the pipeline. Options for zero-shot-classification:"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli", "facebook/bart-large-mnli", "MoritzLaurer/deberta-v3-base-zeroshot-v2.0", "joeddav/xlm-roberta-large-xnli" Options for sentiment-analysis: "finiteautomata/bertweet-base-sentiment-analysis", "distilbert/distilbert-base-uncased-finetuned-sst-2-english", "nlptown/bert-base-multilingual-uncased-sentiment", "tabularisai/multilingual-sentiment-analysis",

str
Optional
Default: "MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli"
torch_dtype
typing.Literal['float16', 'float32']
Optional
Default: "float16"
model_cache_dir
str
Optional
Default: "/home/ariel/.cache/sinapsis"
pipeline_kwargs
PipelineKwargs
Optional
Default: null
deviceRequired
typing.Literal['cuda', 'cpu']
Required
Default: null
torch_dtype
typing.Literal['float16', 'float32', 'auto']
Optional
Default: "float16"
inference_kwargs
BaseInferenceKwargs
Optional
Default: null
generate_kwargs

A dictionary of advanced parameters passed directly to the model's `generate` method for fine-tuning the pipeline generation.

dict[str, typing.Any] | None
Optional
Default: null

Configuration example

Example from the Python docstring:

yaml
agent:
  name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: SentimentAnalysisTransformers
  class_name: SentimentAnalysisTransformers
  template_input: InputTemplate
  attributes:
    model_path: '/path/to/model'
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "SentimentAnalysisTransformers"
    class_name: "SentimentAnalysisTransformers"
    attributes:
      seed: null
      task: "zero-shot-classification"
      model_path: "MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli"
      torch_dtype: "float16"
      model_cache_dir: "/home/ariel/.cache/sinapsis"
      pipeline_kwargs:
        device: "<required>"
        torch_dtype: "float16"
      inference_kwargs:
        generate_kwargs: null

Inheritance

Immediate parent: sinapsis_huggingface_transformers.templates.base_transformers.TransformersBase

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.