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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlx_gliner2-0.1.1.tar.gz.
File metadata
- Download URL: mlx_gliner2-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f55f197210c7492cf8445ec6450a4f707361e1df64039786fef46914ed2a5611
|
|
| MD5 |
ade432c74a6f52121ae484e602a1b678
|
|
| BLAKE2b-256 |
da2cbb61a6ae5902e82218205cd10f220623ae45a438c90dcbb594092fc341c3
|
File details
Details for the file mlx_gliner2-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mlx_gliner2-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4db9bebdf12aafa14d9e8f0c3aff6351a047d29edf3930534671be940ea2cfe
|
|
| MD5 |
b06d9b64808217bd1169cb7e6b6341f1
|
|
| BLAKE2b-256 |
6608ebeeffc6ecfebabaec1337b2019b88d4dd3e52f7184e29087944fa5d2c49
|