Skip to main content

Semantix GenAI Serve

Semantix GenAI Serve is a library designed for users of Semantix GenAI Hub to create their own servers running AI models. This library provides an easy-to-use interface for serving AI models using the scalable infrastructure of Semantix GenAI Hub.

Features

  • Easy integration with Hugging Face Transformers models
  • Support for serving Seq2Seq models
  • Customizable server settings
  • Built-in support for GPU acceleration

Installation

To install the Semantix GenAI Serve library, run the following command:

pip install semantix-genai-serve

Usage

Basic Example

Here's a simple example of how to use the Semantix GenAI Serve library to serve a Hugging Face Transformers model:

from semantix_genai_serve import SemantixTorchKserve
from semantix_genai_serve.huggingface import ServeAutoSeq2SeqLM

class MyModel(ServeAutoSeq2SeqLM):
    def predict(self, payload, headers):
        # Implement your custom inference logic here
        pass

model = MyModel(checkpoint="facebook/bart-large-cnn")
model.start_server()

Customizing Server Settings

You can customize the server settings by passing additional arguments to the SemantixTorchKserve constructor:

model = MyModel(
    checkpoint="facebook/bart-large-cnn",
    name="my_model",
    base_cache_dir="/path/to/cache",
    force_local_load=True
)
  • name: The name of the predictor (default: "predictor")
  • base_cache_dir: The base directory for caching models (default: "/mnt/models"). Do not change that when deploying to Semantix GenAI Hub.
  • force_local_load: If set to True, the model will be loaded from the local cache directory instead of downloading from Hugging Face's model hub (default: False). Do not change that when deploying to Semantix GenAI Hub.

Implementing Custom Inference Logic

To implement custom inference logic, you need to override the predict method in your model class:

class MyModel(ServeAutoSeq2SeqLM):
    def predict(self, payload, headers):
        # Implement your custom inference logic here
        input_example = payload["input_example"]
        # do something for inference
        # your output must be a dictionary so it gets automatically converted to JSON
        return {"response": "output"}

Contributing

We welcome contributions to the Semantix GenAI Serve library! If you have any suggestions, bug reports, or feature requests, please open an issue on our GitHub repository.

License

Semantix GenAI Serve is released under the MIT License.

Metadata

Release files for semantix-genai-serve 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for semantix-genai-serve 0.0.5
File Size Uploaded Provenance Actions
semantix_genai_serve-0.0.5.tar.gz 4.5 kB Without provenance Details for semantix_genai_serve-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for semantix-genai-serve 0.0.5
File Interpreter ABI Platform Actions
semantix_genai_serve-0.0.5-py3-none-any.whl Python 3 none any Details for semantix_genai_serve-0.0.5-py3-none-any.whl

Total release size: 11.4 kB

Release files / semantix_genai_serve-0.0.5.tar.gz

Download URL semantix_genai_serve-0.0.5.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c88145b6c0b86f67341ed9d6bf71c2095d214f6572d03e4d03a9b4a75db8dc10
BLAKE2b-256 checksum
How to use checksums
be611984e3a69b1e6532cc5b8af396d6a69cdbf2f7f53a01a12a9239393c8cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.0 Darwin/22.6.0

Release files / semantix_genai_serve-0.0.5-py3-none-any.whl

Download URL semantix_genai_serve-0.0.5-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b22530e44761c51dc7a8bd536e1d4b9752b7787e0bbde4dc51d93f55d78d6e5
BLAKE2b-256 checksum
How to use checksums
a69727d7b08c0b09195ef899f064e505d1e0915bf9033180cdf417bb85926afd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.0 Darwin/22.6.0

Security for semantix-genai-serve 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page