Instructions to use talmago/gliformer-large-v1-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiFormer
How to use talmago/gliformer-large-v1-onnx with GLiFormer:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- GLiNER
How to use talmago/gliformer-large-v1-onnx with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("talmago/gliformer-large-v1-onnx") - Notebooks
- Google Colab
- Kaggle
GLiFormer Large v1 ONNX
ONNX weights for knowledgator/gliformer-large-v1, for use with fast_gliner. This repository does not include the PyTorch checkpoint.
FastGLiFormer exposes the same methods as FastGLiNER2. Relations come from the joint head, and structures are flat records.
from fast_gliner import FastGLiFormer
model = FastGLiFormer.from_pretrained("talmago/gliformer-large-v1-onnx")
Named entity recognition
model.predict_entities(
"Marie Curie worked at the University of Paris in France.",
["person", "organization", "location"],
)
[
{"text": "Marie Curie", "label": "person", "score": 0.999790, "start": 0, "end": 11},
{"text": "University of Paris", "label": "organization", "score": 0.999745, "start": 26, "end": 45},
{"text": "France", "label": "location", "score": 0.999939, "start": 49, "end": 55},
]
Text classification
classify returns every label score, highest first.
model.classify(
"The new search feature is fast and easy to use.",
["positive", "negative", "neutral"],
)
[
("positive", 1.0),
("neutral", 0.0),
("negative", 0.0),
]
Relation extraction
Pass entity labels together with the relation schema. Endpoint labels constrain which pairs are kept.
model.extract_relations(
"Alice works at Acme and lives in London.",
["person", "organization", "location"],
[
{
"relation": "works_at",
"subject_labels": ["person"],
"object_labels": ["organization"],
},
{
"relation": "lives_in",
"subject_labels": ["person"],
"object_labels": ["location"],
},
],
)
Alice => works_at => Acme
Alice => lives_in => London
Structured extraction
Flat records use name::str for a single string. A bare field name, or any other suffix, is returned as a list.
model.extract_json(
"Alice joined Acme as a software engineer.",
{"employee": ["name::str", "company::str"]},
)
{
"employee": [
{"name": "Alice", "company": "Acme"}
]
}
Several tasks in one call
schema = (
model.create_schema()
.entities(["person", "organization"])
.classification("topic", ["business", "sports", "technology"])
.structure("employee")
.field("name")
.field("company")
)
model.extract("Alice joined Acme as a software engineer.", schema)
On this sentence the topic scores are technology 1.0, business 1.0, and sports 0.0. The employee record is name: Alice, company: Acme.
Files
onnx/encoder.onnx is the shared encoder. onnx/ner.onnx, onnx/classification.onnx, onnx/relations.onnx, and onnx/structuring.onnx are the task heads.
Model tree for talmago/gliformer-large-v1-onnx
Base model
knowledgator/gliformer-large-v1