Zero-Shot Classification
Core ML
GLiNER
GLiNER2
English
coremltools
deberta-v3
apple-silicon
fp16
multifunction
Instructions to use augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER
How to use augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512") text = "Cristiano Ronaldo dos Santos Aveiro was born on 5 February 1985 in Funchal, Madeira, Portugal." labels = ["person", "date", "location"] entities = model.predict_entities(text, labels) for entity in entities: print(entity["text"], "=>", entity["label"]) - GLiNER2
How to use augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512 with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512") # Extract entities text = "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday." result = extractor.extract_entities(text, ["company", "person", "product", "location"]) print(result) - Notebooks
- Google Colab
- Kaggle
Download scripts/make_golden.py from augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512/resolve/5ab302c1c46028fc10925717dca4a7624db12515/scripts/make_golden.py
- Command line
-
hf download hf://augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512@5ab302c1c46028fc10925717dca4a7624db12515/scripts/make_golden.py
-
curl -L -o make_golden.py https://huggingface.co/augustoFranke/GLiNER2.5-Decide-CoreML-FP16-MultiFn-L64-512/resolve/5ab302c1c46028fc10925717dca4a7624db12515/scripts/make_golden.py
1.58 kB
| """Record native (PyTorch) GLiNER2.5-Decide answers for tests/cases.py into tests/golden.json. | |
| Downloads the pinned source checkpoint (~1.7 GB) on first run. The tests compare the Core ML | |
| router against this file, so they need neither PyTorch weights nor a network connection. | |
| uv run python scripts/make_golden.py | |
| """ | |
| import json | |
| import sys | |
| import warnings | |
| from pathlib import Path | |
| warnings.filterwarnings("ignore") | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT / "tests")) | |
| sys.path.insert(0, str(ROOT / "scripts" / "build")) | |
| from gliner2 import AutoExtractor # noqa: E402 | |
| from huggingface_hub import snapshot_download # noqa: E402 | |
| from cases import CASES # noqa: E402 | |
| from convert_names import MODEL_ID, MODEL_REVISION # noqa: E402 | |
| def main(): | |
| source = snapshot_download( | |
| MODEL_ID, revision=MODEL_REVISION, | |
| allow_patterns=["config.json", "encoder_config/*", "model.safetensors", "tokenizer.json", | |
| "tokenizer_config.json", "special_tokens_map.json"], | |
| ) | |
| native = AutoExtractor.from_pretrained(source, map_location="cpu").eval() | |
| golden = {} | |
| for case in CASES: | |
| golden[case["id"]] = native.classify_text(case["text"], case["tasks"], include_confidence=True) | |
| print(case["id"], json.dumps(golden[case["id"]])) | |
| out = ROOT / "tests" / "golden.json" | |
| out.write_text(json.dumps({"source_model": MODEL_ID, "source_revision": MODEL_REVISION, "cases": golden}, | |
| indent=2) + "\n") | |
| print("wrote", out) | |
| if __name__ == "__main__": | |
| main() | |