fast-gliner 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. fast_gliner-0.1.0/PKG-INFO +108 -0
  2. fast_gliner-0.1.0/README.md +82 -0
  3. fast_gliner-0.1.0/bindings/python/.gitignore +1 -0
  4. fast_gliner-0.1.0/bindings/python/Cargo.lock +1952 -0
  5. fast_gliner-0.1.0/bindings/python/Cargo.toml +25 -0
  6. fast_gliner-0.1.0/bindings/python/Makefile +37 -0
  7. fast_gliner-0.1.0/bindings/python/README.md +82 -0
  8. fast_gliner-0.1.0/bindings/python/poetry.lock +390 -0
  9. fast_gliner-0.1.0/bindings/python/py_src/fast_gliner/__init__.py +112 -0
  10. fast_gliner-0.1.0/bindings/python/rust-toolchain +1 -0
  11. fast_gliner-0.1.0/bindings/python/src/lib.rs +118 -0
  12. fast_gliner-0.1.0/gline-rs/Cargo.toml +70 -0
  13. fast_gliner-0.1.0/gline-rs/LICENSE.txt +201 -0
  14. fast_gliner-0.1.0/gline-rs/README.md +231 -0
  15. fast_gliner-0.1.0/gline-rs/Readme.md +231 -0
  16. fast_gliner-0.1.0/gline-rs/docs/Changelog.md +80 -0
  17. fast_gliner-0.1.0/gline-rs/docs/Model.md +32 -0
  18. fast_gliner-0.1.0/gline-rs/docs/ORT.md +38 -0
  19. fast_gliner-0.1.0/gline-rs/docs/Processing.pdf +0 -0
  20. fast_gliner-0.1.0/gline-rs/docs/Processing.typ +575 -0
  21. fast_gliner-0.1.0/gline-rs/examples/benchmark_cpu.rs +39 -0
  22. fast_gliner-0.1.0/gline-rs/examples/benchmark_gpu.rs +56 -0
  23. fast_gliner-0.1.0/gline-rs/examples/relation_extraction.rs +62 -0
  24. fast_gliner-0.1.0/gline-rs/examples/span_mode.rs +44 -0
  25. fast_gliner-0.1.0/gline-rs/examples/token_mode.rs +44 -0
  26. fast_gliner-0.1.0/gline-rs/src/lib.rs +13 -0
  27. fast_gliner-0.1.0/gline-rs/src/model/input/encoded.rs +295 -0
  28. fast_gliner-0.1.0/gline-rs/src/model/input/mod.rs +19 -0
  29. fast_gliner-0.1.0/gline-rs/src/model/input/prompt.rs +136 -0
  30. fast_gliner-0.1.0/gline-rs/src/model/input/relation/mod.rs +106 -0
  31. fast_gliner-0.1.0/gline-rs/src/model/input/relation/schema.rs +78 -0
  32. fast_gliner-0.1.0/gline-rs/src/model/input/tensors/mod.rs +4 -0
  33. fast_gliner-0.1.0/gline-rs/src/model/input/tensors/span.rs +188 -0
  34. fast_gliner-0.1.0/gline-rs/src/model/input/tensors/token.rs +68 -0
  35. fast_gliner-0.1.0/gline-rs/src/model/input/text.rs +43 -0
  36. fast_gliner-0.1.0/gline-rs/src/model/input/tokenized.rs +90 -0
  37. fast_gliner-0.1.0/gline-rs/src/model/mod.rs +28 -0
  38. fast_gliner-0.1.0/gline-rs/src/model/output/decoded/greedy.rs +88 -0
  39. fast_gliner-0.1.0/gline-rs/src/model/output/decoded/mod.rs +38 -0
  40. fast_gliner-0.1.0/gline-rs/src/model/output/decoded/sort.rs +23 -0
  41. fast_gliner-0.1.0/gline-rs/src/model/output/decoded/span.rs +100 -0
  42. fast_gliner-0.1.0/gline-rs/src/model/output/decoded/token.rs +147 -0
  43. fast_gliner-0.1.0/gline-rs/src/model/output/decoded/token_flat.rs +118 -0
  44. fast_gliner-0.1.0/gline-rs/src/model/output/mod.rs +6 -0
  45. fast_gliner-0.1.0/gline-rs/src/model/output/relation.rs +164 -0
  46. fast_gliner-0.1.0/gline-rs/src/model/output/tensors.rs +34 -0
  47. fast_gliner-0.1.0/gline-rs/src/model/params.rs +83 -0
  48. fast_gliner-0.1.0/gline-rs/src/model/pipeline/context.rs +43 -0
  49. fast_gliner-0.1.0/gline-rs/src/model/pipeline/mod.rs +6 -0
  50. fast_gliner-0.1.0/gline-rs/src/model/pipeline/relation.rs +63 -0
  51. fast_gliner-0.1.0/gline-rs/src/model/pipeline/span.rs +98 -0
  52. fast_gliner-0.1.0/gline-rs/src/model/pipeline/token.rs +82 -0
  53. fast_gliner-0.1.0/gline-rs/src/text/mod.rs +7 -0
  54. fast_gliner-0.1.0/gline-rs/src/text/prompt.rs +28 -0
  55. fast_gliner-0.1.0/gline-rs/src/text/span.rs +65 -0
  56. fast_gliner-0.1.0/gline-rs/src/text/splitter.rs +88 -0
  57. fast_gliner-0.1.0/gline-rs/src/text/token.rs +33 -0
  58. fast_gliner-0.1.0/gline-rs/src/text/tokenizer.rs +42 -0
  59. fast_gliner-0.1.0/gline-rs/src/util/error.rs +37 -0
  60. fast_gliner-0.1.0/gline-rs/src/util/math.rs +5 -0
  61. fast_gliner-0.1.0/gline-rs/src/util/mod.rs +5 -0
  62. fast_gliner-0.1.0/gline-rs/src/util/result.rs +7 -0
  63. fast_gliner-0.1.0/py_src/fast_gliner/__init__.py +112 -0
  64. fast_gliner-0.1.0/pyproject.toml +80 -0
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: fast_gliner
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Intended Audience :: Education
7
+ Classifier: Intended Audience :: Science/Research
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Dist: huggingface-hub>=0.16.4,<1.0
19
+ Summary: Python bindings for gline-rs: Inference Engine for GLiNER Models, written in Rust
20
+ Keywords: nlp,ner,named entity recognition,natural language processing,onnx,transformers,rust,pyo3,gliner,span extraction,token classification,zero-shot
21
+ Author: Tal Almagor <almagoric@gmail.com>
22
+ Author-email: Tal Almagor <almagoric@gmail.com>
23
+ License: Apache
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
26
+
27
+ # fast_gliner: Python bindings for [gline-rs](https://github.com/fbilhaut/gline-rs) (Inference Engine for GLiNER Models, written in Rust)
28
+
29
+ ## ⏳ Installation
30
+
31
+ ```bash
32
+ $ pip install fast_gliner
33
+ ```
34
+
35
+ ## 🚀 Quickstart
36
+
37
+ ```python
38
+ from fast_gliner import FastGLiNER
39
+
40
+ model = FastGLiNER.from_pretrained(
41
+ model_id="onnx-community/gliner_multi-v2.1",
42
+ onnx_path="onnx/model.onnx"
43
+ )
44
+
45
+ model.predict_entities("I am James Bond", ["person"])
46
+ ```
47
+
48
+ Output:
49
+
50
+ ```
51
+ [
52
+ {
53
+ 'text': 'James Bond',
54
+ 'label': 'person',
55
+ 'score': 0.9012733697891235,
56
+ 'start': 5,
57
+ 'end': 15
58
+ }
59
+ ]
60
+ ```
61
+
62
+ ## Development
63
+
64
+ Set up environment
65
+
66
+ ```sh
67
+ $ cd fast_gliner/bindings/python
68
+ $ make dev
69
+ ```
70
+
71
+ Run code formatting
72
+
73
+ ```sh
74
+ $ make style
75
+ ```
76
+
77
+ Release package to PyPI
78
+
79
+ ```sh
80
+ $ make
81
+ $ make release
82
+ ```
83
+
84
+ ## References
85
+
86
+ [1] [GLiNER](https://github.com/urchade/GLiNER): Generalist Model for Named Entity Recognition using Bidirectional Transformer.
87
+
88
+ ```
89
+ @inproceedings{zaratiana-etal-2024-gliner,
90
+ title = "{GL}i{NER}: Generalist Model for Named Entity Recognition using Bidirectional Transformer",
91
+ author = "Zaratiana, Urchade and
92
+ Tomeh, Nadi and
93
+ Holat, Pierre and
94
+ Charnois, Thierry",
95
+ editor = "Duh, Kevin and
96
+ Gomez, Helena and
97
+ Bethard, Steven",
98
+ booktitle = "Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers)",
99
+ month = jun,
100
+ year = "2024",
101
+ address = "Mexico City, Mexico",
102
+ publisher = "Association for Computational Linguistics",
103
+ url = "https://aclanthology.org/2024.naacl-long.300",
104
+ doi = "10.18653/v1/2024.naacl-long.300",
105
+ pages = "5364--5376",
106
+ abstract = "Named Entity Recognition (NER) is essential in various Natural Language Processing (NLP) applications. Traditional NER models are effective but limited to a set of predefined entity types. In contrast, Large Language Models (LLMs) can extract arbitrary entities through natural language instructions, offering greater flexibility. However, their size and cost, particularly for those accessed via APIs like ChatGPT, make them impractical in resource-limited scenarios. In this paper, we introduce a compact NER model trained to identify any type of entity. Leveraging a bidirectional transformer encoder, our model, GLiNER, facilitates parallel entity extraction, an advantage over the slow sequential token generation of LLMs. Through comprehensive testing, GLiNER demonstrate strong performance, outperforming both ChatGPT and fine-tuned LLMs in zero-shot evaluations on various NER benchmarks.",
107
+ }
108
+ ```
@@ -0,0 +1,82 @@
1
+ # fast_gliner: Python bindings for [gline-rs](https://github.com/fbilhaut/gline-rs) (Inference Engine for GLiNER Models, written in Rust)
2
+
3
+ ## ⏳ Installation
4
+
5
+ ```bash
6
+ $ pip install fast_gliner
7
+ ```
8
+
9
+ ## 🚀 Quickstart
10
+
11
+ ```python
12
+ from fast_gliner import FastGLiNER
13
+
14
+ model = FastGLiNER.from_pretrained(
15
+ model_id="onnx-community/gliner_multi-v2.1",
16
+ onnx_path="onnx/model.onnx"
17
+ )
18
+
19
+ model.predict_entities("I am James Bond", ["person"])
20
+ ```
21
+
22
+ Output:
23
+
24
+ ```
25
+ [
26
+ {
27
+ 'text': 'James Bond',
28
+ 'label': 'person',
29
+ 'score': 0.9012733697891235,
30
+ 'start': 5,
31
+ 'end': 15
32
+ }
33
+ ]
34
+ ```
35
+
36
+ ## Development
37
+
38
+ Set up environment
39
+
40
+ ```sh
41
+ $ cd fast_gliner/bindings/python
42
+ $ make dev
43
+ ```
44
+
45
+ Run code formatting
46
+
47
+ ```sh
48
+ $ make style
49
+ ```
50
+
51
+ Release package to PyPI
52
+
53
+ ```sh
54
+ $ make
55
+ $ make release
56
+ ```
57
+
58
+ ## References
59
+
60
+ [1] [GLiNER](https://github.com/urchade/GLiNER): Generalist Model for Named Entity Recognition using Bidirectional Transformer.
61
+
62
+ ```
63
+ @inproceedings{zaratiana-etal-2024-gliner,
64
+ title = "{GL}i{NER}: Generalist Model for Named Entity Recognition using Bidirectional Transformer",
65
+ author = "Zaratiana, Urchade and
66
+ Tomeh, Nadi and
67
+ Holat, Pierre and
68
+ Charnois, Thierry",
69
+ editor = "Duh, Kevin and
70
+ Gomez, Helena and
71
+ Bethard, Steven",
72
+ booktitle = "Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers)",
73
+ month = jun,
74
+ year = "2024",
75
+ address = "Mexico City, Mexico",
76
+ publisher = "Association for Computational Linguistics",
77
+ url = "https://aclanthology.org/2024.naacl-long.300",
78
+ doi = "10.18653/v1/2024.naacl-long.300",
79
+ pages = "5364--5376",
80
+ abstract = "Named Entity Recognition (NER) is essential in various Natural Language Processing (NLP) applications. Traditional NER models are effective but limited to a set of predefined entity types. In contrast, Large Language Models (LLMs) can extract arbitrary entities through natural language instructions, offering greater flexibility. However, their size and cost, particularly for those accessed via APIs like ChatGPT, make them impractical in resource-limited scenarios. In this paper, we introduce a compact NER model trained to identify any type of entity. Leveraging a bidirectional transformer encoder, our model, GLiNER, facilitates parallel entity extraction, an advantage over the slow sequential token generation of LLMs. Through comprehensive testing, GLiNER demonstrate strong performance, outperforming both ChatGPT and fine-tuned LLMs in zero-shot evaluations on various NER benchmarks.",
81
+ }
82
+ ```
@@ -0,0 +1 @@
1
+ data