Skip to main content

Templates for HuggingFace Transformers, supporting automatic-speech-recognition, text-to-speech, translation and summarization templates

Project description




Sinapsis Hugging Face Transformers

Templates for seamless integration with Transformers models

🐍 Installation📂 Features▶️ Example usage📦 Documentation🔍 License

🐍 Installation

Install using your package manager of choice. We encourage the use of uv

Example with uv:

  uv pip install sinapsis-huggingface-transformers --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-huggingface-transformers --extra-index-url https://pypi.sinapsis.tech

[!IMPORTANT] Templates may require extra optional dependencies. For development, we recommend installing the package with all the optional dependencies:

with uv:

  uv pip install sinapsis-huggingface-transformers[all] --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-huggingface-transformers[all] --extra-index-url https://pypi.sinapsis.tech

📦 Features

Sinapsis Hugging Face Transformers provides customizable inference templates for a variety of tasks, including image captioning, object detection, instance segmentation, speech-to-text, and text-to-speech.

Templates:

  • ImageToTextTransformers: Generates textual descriptions from input images using Hugging Face image-to-text models.
  • PaliGemmaInference: Generate captions for images.
  • PaliGemmaDetection: Detect specific objects in images.
  • SpeechToTextTransformers: Converts spoken audio into text using automatic speech recognition (ASR) models.
  • SummarizationTransformers: Summarizes long text into concise summaries using Hugging Face summarization models.
  • TextToSpeechTransformers: Converts text into lifelike audio using text-to-speech (TTS) models.
  • TranslationTransformers: Translates text from a source language to a target language using Hugging Face translation models.

▶️ Example Usage

Below is an example YAML configuration for text-to-speech (TTS) conversion using the Suno Bark model.

Config
agent:
  name: test_agent

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name: TextInput
    class_name: TextInput
    attributes:
      text: Hello, my name is Suno. And, uh — and I like pizza. [laughs] But I also have other interests such as playing tic tac toe.

  - template_name: TextToSpeechTransformers
    class_name: TextToSpeechTransformers
    template_input: TextInput
    attributes:
      model_path: 'suno/bark'
      device: "cuda"
      torch_dtype: float32
      seed: 7
      use_embeddings: false
      n_words: 30
      inference_kwargs:
        generate_kwargs:
          do_sample: true
          temperature: 0.7

  - template_name: AudioWriterSoundfile
    class_name: AudioWriterSoundfile
    template_input: TextToSpeechTransformers
    attributes:
      root_dir: ./test
      save_dir: audios

[!IMPORTANT] The TextInput and AudioWriterSoundfile templates correspond to the sinapsis-data-readers and sinapsis-data-writers packages respectively. If you want to use the example, please make sure you install these packages.

To run the config, use the CLI:

sinapsis run name_of_config.yml

📙 Documentation

Documentation is available on the sinapsis website

Tutorials for different projects within sinapsis are available at sinapsis tutorials page

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinapsis_huggingface_transformers-0.2.3.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file sinapsis_huggingface_transformers-0.2.3.tar.gz.

File metadata

File hashes

Hashes for sinapsis_huggingface_transformers-0.2.3.tar.gz
Algorithm Hash digest
SHA256 b477df2b8cd56752b94842f8ae131dc6742e7e062be52c49cd3855b2f42e73ee
MD5 7eae1243792f5b8ff289d0b7bea1d9f9
BLAKE2b-256 eae3396d001d0ec643f85f4f0f387f2966480940f74e8f389e944147b2d7716b

See more details on using hashes here.

File details

Details for the file sinapsis_huggingface_transformers-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_huggingface_transformers-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 082f093b93035559af2d474aeec98d2f14ebcf0b074abf7af383e20ad8269d0f
MD5 8bf0fef9c506fb38d693dfd7203f7c30
BLAKE2b-256 0bbddb8ff315fba1fccb2d3b93961cf24e7ce7e3b2311b3182e7016fee078800

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page