HuggingFace runtime for KozmoServer
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kozmoserver_huggingface-0.1.0.dev1.tar.gz
.
File metadata
- Download URL: kozmoserver_huggingface-0.1.0.dev1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.13 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00a23156cb028f463f23660c3778fe937766c325e187b89ac7cbd7d601402728 |
|
MD5 | 3bfed2f58408f191f68058f3e4fbf68f |
|
BLAKE2b-256 | 3a6ca6ade1231fdc98641e353bcb6b276bbc6cc5697c45c2ab0264e04e9b1412 |
File details
Details for the file kozmoserver_huggingface-0.1.0.dev1-py3-none-any.whl
.
File metadata
- Download URL: kozmoserver_huggingface-0.1.0.dev1-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.13 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2cdbd9c9cefaa39602f2bb764494ecaf36337e5f9549275fafbdbb360b59e73 |
|
MD5 | 15fe39bcbd35da9235be02266007418d |
|
BLAKE2b-256 | 37206ac580e6fc86a402e5b73106d59f07cf18051b0778dc89b984dcf2fffc47 |