Skip to main content

Package for HuggingFace-based templates

Project description




Sinapsis Hugging Face

Package providing seamless integration with Hugging Face models, specializing in zero-shot object detection, classification, segmentation, generative workflows, and embeddings. It leverages state-of-the-art tools like Grounding DINO, Hugging Face Diffusers, and Transformers, enabling efficient implementation and customization.

🐍 Installation📦 Packages🌐 Webapps📙 Documentation🔍 License

🐍 Installation

This repo consists of different packages to handle huggingface tools for different tasks:

  • sinapsis-huggingface-diffusers
  • sinapsis-huggingface-embeddings
  • sinapsis-huggingface-grounding-dino
  • sinapsis-huggingface-transformers

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

Example with uv:

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

or with raw pip:

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

Change the name of the package for the one you want to install.

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

with uv:

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

or with raw pip:

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

Change the name of the package accordingly

[!TIP] You can also install all the packages within this project:

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

📦 Packages

This repository is structured into modular packages, each designed for specific Hugging Face model integrations. These packages provide ready-to-use templates for tasks like text generation, embeddings, object detection, and diffusion-based image processing.

Each package can be used independently or combined to create more complex workflows. Below is an overview of the available packages:

Sinapsis Hugging Face Diffusers

This sinapsis package provides a powerful and flexible implementation of Hugging Face's diffusers library. It includes:

  • Templates for tasks like text-to-image, image-to-image, inpainting, and image-to-video generation.
  • Support for state-of-the-art models like Stable Diffusion and other diffusion-based architectures.
  • Robust pipelines for generating and transforming visual content.

For specific instructions and further details, see the README.md.

Sinapsis Hugging Face Embeddings

This package provides templates for generating and managing embeddings using Hugging Face models:

  • Speaker Embeddings: Extract embeddings from audio packets or pre-defined Hugging Face datasets and attach them to audio or text packets.
  • Text Embeddings: Generate embeddings for documents, with support for customizable chunking and metadata handling.

For more details, see the README.md.

Sinapsis Hugging Face Grounding DINO

This sinapsis package provides zero-shot detection and classification capabilities using Hugging Face's Grounding DINO. It includes:

  • Ready-to-use inference templates for object detection tasks and classification pipelines.
  • Template for fine-tuning Grounding DINO checkpoints on specific datasets.

For detailed instructions and additional information, see the README.md.

Sinapsis Hugging Face Transformers

This sinapsis package offers advanced capabilities for text, speech, and image processing tasks. It includes a variety of customizable inference templates designed for seamless integration into machine learning workflows:

  • Text-to-Speech (TTS) Template: Convert text into high-quality, natural-sounding speech.
  • Speech-to-Text (STT) Template: Transcribe spoken audio into text with support for multiple languages.
  • Translation Template: Translate text from one language to another with support for various source and target languages.
  • Summarization Template: Condense long-form content into concise summaries.
  • Image-to-Text Template: Generate textual descriptions from input images.

For more details and specific templates, see the README.md.

For more details, see the official documentation

🌐 Webapps

The Sinapsis web applications provide an interactive way to explore and experiment with AI models. They allow users to generate outputs, test different inputs, and visualize results in real time, making it easy to experience the capabilities of each model. Below are the available webapps and instructions to launch them.

[!IMPORTANT] To run any of the apps, you first need to clone this repo:

git clone git@github.com:Sinapsis-ai/sinapsis-huggingface.git
cd sinapsis-huggingface

[!NOTE] If you'd like to enable external app sharing in Gradio, export GRADIO_SHARE_APP=True

[!NOTE] Agent configuration can be changed through the AGENT_CONFIG_PATH env var. You can check the available configurations in each package configs folder.

[!IMPORTANT] Please make sure you have a valid huggingface access token in order to run the paligemma webapp. For further instructions on how to create an access token see https://huggingface.co/docs/transformers.js/en/guides/private

🐳 Build with Docker

IMPORTANT The docker image depends on the sinapsis-nvidia:base image. To build it, refer to the official sinapsis documentation

  1. Build the sinapsis-huggingface image:
docker compose -f docker/compose.yaml build
  1. Start the container:

For Diffusers app

docker compose -f docker/compose_diffusers.yaml up sinapsis-huggingface-diffusers-gradio -d

For Grounding-Dino app

docker compose -f docker/compose_vision.yaml up sinapsis-huggingface-vision-gradio -d

For Paligemma app

export HF_TOKEN="your_huggingface_token"
docker compose -f docker/compose_pali_gemma.yaml up sinapsis-huggingface-paligemma-gradio -d
  1. Check the status:

For Diffusers app

docker logs -f sinapsis-huggingface-diffusers-gradio

For Grounding-Dino app

docker logs -f sinapsis-huggingface-vision-gradio

For Paligemma app

docker logs -f sinapsis-huggingface-paligemma-gradio

NOTE: If using the vision app, please change the name of the service accordingly

  1. The logs will display the URL to access the webapp, e.g.,:
Running on local URL:  http://127.0.0.1:7860

NOTE: The local URL can be different, please check the logs

  1. To stop the app:

For Diffusers app

docker compose -f docker/compose_diffusers.yaml down

For Grounding-Dino app

docker compose -f docker/compose_vision.yaml down

For Paligemma app

docker compose -f docker/compose_pali_gemma.yaml down
📦 UV
  1. Create the virtual environment and sync the dependencies:
uv sync --frozen
  1. Install the dependencies:
uv pip install sinapsis-huggingface[all] --extra-index-url https://pypi.sinapsis.tech
  1. Run the webapp.

For Diffusers app

uv run webapps/diffusers_demo.py

For Grounding-Dino app

uv run webapps/vision_demo.py

For Paligemma app

export HF_TOKEN="your_huggingface_token"
uv run webapps/paligemma_demo.py
  1. The terminal will display the URL to access the webapp, e.g., :
Running on local URL:  http://127.0.0.1:7860

📙 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-0.2.3.tar.gz (44.6 kB view details)

Uploaded Source

Built Distribution

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

sinapsis_huggingface-0.2.3-py3-none-any.whl (63.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for sinapsis_huggingface-0.2.3.tar.gz
Algorithm Hash digest
SHA256 185b73b480a877a0b25b4b49427c2696092cddd4572aeb5753f28802b4965675
MD5 f2cf76469a7cde3ec3bb93e33f59050e
BLAKE2b-256 62bc89c4692a3bc24b6cc8fab3849fcf7f83b6112bcd6f762ad4e7e3772eea6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sinapsis_huggingface-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 481aa5904cae0d3260f505ca4881495e9ee6ad14264ceb08788b7816fb5563da
MD5 65ade77260f8fa0d8a4816ddce7523e1
BLAKE2b-256 5f80dbece0eb7fb88342b1a91e79e5a487d9de8296a8e511c512d7f68e80a4eb

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