Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

HuggingFace runtime for KozmoServer

This package provides a KozmoServer runtime compatible with HuggingFace Transformers.

Usage

You can install the runtime, alongside kozmoserver, as:

pip install kozmoserver kozmoserver-huggingface

For further information on how to use KozmoServer with HuggingFace, you can check out this worked out example.

Content Types

The HuggingFace runtime will always decode the input request using its own built-in codec. Therefore, content type annotations at the request level will be ignored. Note that this doesn't include input-level content type annotations, which will be respected as usual.

Settings

The HuggingFace runtime exposes a couple extra parameters which can be used to customise how the runtime behaves. These settings can be added under the parameters.extra section of your model-settings.json file, e.g.

---
emphasize-lines: 5-8
---
{
  "name": "qa",
  "implementation": "kozmoserver_huggingface.HuggingFaceRuntime",
  "parameters": {
    "extra": {
      "task": "question-answering",
      "optimum_model": true
    }
  }
}
These settings can also be injected through environment variables prefixed with `KOZMOSERVER_MODEL_HUGGINGFACE_`, e.g.

```bash
KOZMOSERVER_MODEL_HUGGINGFACE_TASK="question-answering"
KOZMOSERVER_MODEL_HUGGINGFACE_OPTIMUM_MODEL=true
```

Loading models

Local models

It is possible to load a local model into a HuggingFace pipeline by specifying the model artefact folder path in parameters.uri in model-settings.json.

HuggingFace models

Models in the HuggingFace hub can be loaded by specifying their name in parameters.extra.pretrained_model in model-settings.json.

If `parameters.extra.pretrained_model` is specified, it takes precedence over `parameters.uri`.

Reference

You can find the full reference of the accepted extra settings for the HuggingFace runtime below:

.. autopydantic_settings:: kozmoserver_huggingface.settings.HuggingFaceSettings

Release files for kozmoserver-huggingface 0.1.0.dev1

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

Source distribution (sdist)

Source distribution for kozmoserver-huggingface 0.1.0.dev1
File Size Uploaded
kozmoserver_huggingface-0.1.0.dev1.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kozmoserver-huggingface 0.1.0.dev1
File Interpreter ABI Platform
kozmoserver_huggingface-0.1.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 37.5 kB

Release files / kozmoserver_huggingface-0.1.0.dev1.tar.gz

Download URL kozmoserver_huggingface-0.1.0.dev1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
00a23156cb028f463f23660c3778fe937766c325e187b89ac7cbd7d601402728
BLAKE2b-256 checksum
How to use checksums
3a6ca6ade1231fdc98641e353bcb6b276bbc6cc5697c45c2ab0264e04e9b1412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.9.13 Darwin/22.1.0

Release files / kozmoserver_huggingface-0.1.0.dev1-py3-none-any.whl

Download URL kozmoserver_huggingface-0.1.0.dev1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2cdbd9c9cefaa39602f2bb764494ecaf36337e5f9549275fafbdbb360b59e73
BLAKE2b-256 checksum
How to use checksums
37206ac580e6fc86a402e5b73106d59f07cf18051b0778dc89b984dcf2fffc47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.9.13 Darwin/22.1.0

Release history Release notifications | RSS feed

This release

0.1.0.dev1 This release

2 release files

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