HuggingFace runtime for MLServer
This package provides a MLServer runtime compatible with HuggingFace Transformers.
Usage
You can install the runtime, alongside mlserver, as:
pip install mlserver mlserver-huggingface
For further information on how to use MLServer 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": "mlserver_huggingface.HuggingFaceRuntime",
"parameters": {
"extra": {
"task": "question-answering",
"optimum_model": true
}
}
}
These settings can also be injected through environment variables prefixed with `MLSERVER_MODEL_HUGGINGFACE_`, e.g.
```bash
MLSERVER_MODEL_HUGGINGFACE_TASK="question-answering"
MLSERVER_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:: mlserver_huggingface.settings.HuggingFaceSettings
Metadata
Release files for mlserver-huggingface 1.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mlserver_huggingface-1.7.1.tar.gz | 15.4 kB | Without provenance | Details for mlserver_huggingface-1.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mlserver_huggingface-1.7.1-py3-none-any.whl | Python 3 | none | any | Details for mlserver_huggingface-1.7.1-py3-none-any.whl |
Total release size: 36.8 kB
Release files / mlserver_huggingface-1.7.1.tar.gz
| Download URL | mlserver_huggingface-1.7.1.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3299b8526dfbbfbdb350dca34545328d0dac3cc8710549a8f60c332845cec9fa
|
|
BLAKE2b-256 checksum How to use checksums |
3dcecf39b6e124ca20e51fced16ab9b2d42b1b0d9accef3f0a917aff6d8e10d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1015-azure
|
Release files / mlserver_huggingface-1.7.1-py3-none-any.whl
| Download URL | mlserver_huggingface-1.7.1-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
027e36fef0b11853cdd0982ce5fa9322773f2f0e49537a73c2db6c4013af767f
|
|
BLAKE2b-256 checksum How to use checksums |
20fdf0be7ad050c160bbdf433c045dc89a96e9029a843cbf8dcb754f30d6c387
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1015-azure
|
Security for mlserver-huggingface 1.7.1
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.