Skip to main content

GLiNER2 information extraction on Apple Silicon via MLX

Project description

MLX GLiNER2

Port of GLiNER2 to Apple MLX for efficient information extraction on Apple Silicon.

Installation

pip install mlx-gliner2

Quick Start

# One-time model conversion
python -m mlx_gliner2.convert --repo-id fastino/gliner2-base-v1
from mlx_gliner2 import GLiNER2

extractor = GLiNER2.from_pretrained("mlx_models/fastino_gliner2-base-v1")

result = extractor.extract_entities(
    "Apple CEO Tim Cook announced iPhone 15 in Cupertino.",
    ["company", "person", "product", "location"]
)
# {"company": ["Apple"], "person": ["Tim Cook"], "product": ["iPhone 15"], "location": ["Cupertino"]}

Features

  • Entity Extraction - Named entity recognition
  • Text Classification - Single and multi-label
  • Structured JSON Extraction - Parse structured data from text
  • Relation Extraction - Extract relationships between entities
  • Multi-Task Schemas - Combine all tasks in a single pass
  • Batch Processing - Process multiple texts efficiently

No PyTorch or GPU required. Runs entirely on MLX.

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install pytest

Testing

Tests require a converted model. Run the conversion first, then pytest:

python -m mlx_gliner2.convert --repo-id fastino/gliner2-base-v1
pytest tests/ -v

To use a model at a custom path, set the MLX_GLINER2_MODEL environment variable:

MLX_GLINER2_MODEL=path/to/model pytest tests/ -v

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

mlx_gliner2-0.1.0.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

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

mlx_gliner2-0.1.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file mlx_gliner2-0.1.0.tar.gz.

File metadata

  • Download URL: mlx_gliner2-0.1.0.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mlx_gliner2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f51f611f8f9449c22c1d7ec2b3fd0ad70872b11b8d4fd54b166a544b139ff0eb
MD5 a0a1689eba94f2e9cf626a77fcf938a3
BLAKE2b-256 d47933cac4f8c0d3c41457c170c9b95197610a0090cd27f30c1240072db32a0f

See more details on using hashes here.

File details

Details for the file mlx_gliner2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mlx_gliner2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mlx_gliner2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b72ccab6a888b244f122db4a71d648cb490bb977313eba8eb4edff23072ac7ec
MD5 36a12c97a434890857e511df01462b40
BLAKE2b-256 c43352ae7f1a5aeb7e5566105959ed42961ca3ca5daaef6118a54a30d05c4702

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