Instructions to use FluidInference/gliner2-5-multi-coreml with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER2
How to use FluidInference/gliner2-5-multi-coreml with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("FluidInference/gliner2-5-multi-coreml") # 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 tests/test_extraction_routing.py from FluidInference/gliner2-5-multi-coreml: direct link, hf CLI and curl.
- Browser
- Download file 824 Bytes
-
https://huggingface.co/FluidInference/gliner2-5-multi-coreml/resolve/main/tests/test_extraction_routing.py
- Command line
-
hf download hf://FluidInference/gliner2-5-multi-coreml/tests/test_extraction_routing.py
-
curl -L -o test_extraction_routing.py https://huggingface.co/FluidInference/gliner2-5-multi-coreml/resolve/main/tests/test_extraction_routing.py
824 Bytes
| """Schema routing for the quantized multilingual extraction runtime.""" | |
| from gliner2 import Schema | |
| from extraction_runtime import CoreMLAdaptiveBoundaryExtractor | |
| def record_schema(mode: str): | |
| schema = Schema() | |
| schema.structure("employment", mode=mode).field("person", dtype="str").field("company", dtype="str") | |
| return schema | |
| def test_latent_record_uses_fp32(): | |
| assert CoreMLAdaptiveBoundaryExtractor.selected_precision(record_schema("latent")) == "fp32" | |
| def test_other_selected_schemas_use_fp16(): | |
| assert CoreMLAdaptiveBoundaryExtractor.selected_precision(Schema().entities(["person"])) == "fp16" | |
| assert CoreMLAdaptiveBoundaryExtractor.selected_precision(record_schema("natural")) == "fp16" | |
| assert CoreMLAdaptiveBoundaryExtractor.selected_precision(record_schema("anchorless")) == "fp16" | |