{"id":17025967,"url":"https://github.com/urchade/GLiNER","last_synced_at":"2026-04-13T00:30:20.745Z","repository":{"id":207312467,"uuid":"718748920","full_name":"urchade/GLiNER","owner":"urchade","description":"Generalist and Lightweight Model for Named Entity Recognition (Extract any entity types from texts) @ NAACL 2024","archived":false,"fork":false,"pushed_at":"2024-10-18T10:53:30.000Z","size":32266,"stargazers_count":1360,"open_issues_count":34,"forks_count":117,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-10-29T15:03:28.958Z","etag":null,"topics":["information-extraction","large-language-models","named-entity-recognition","natural-language-processing","prompt-tuning"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2311.08526","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/urchade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-14T18:11:11.000Z","updated_at":"2024-10-29T00:14:26.000Z","dependencies_parsed_at":"2024-05-20T13:27:59.678Z","dependency_job_id":"59a9cf10-ae2c-46a4-9a8f-d9dc0f7be70c","html_url":"https://github.com/urchade/GLiNER","commit_stats":{"total_commits":329,"total_committers":29,"mean_commits":"11.344827586206897","dds":0.5501519756838906,"last_synced_commit":"1169120cd90327a5bf1078ab603850de93b44edb"},"previous_names":["urchade/gliner"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urchade%2FGLiNER","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urchade%2FGLiNER/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urchade%2FGLiNER/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urchade%2FGLiNER/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/urchade","download_url":"https://codeload.github.com/urchade/GLiNER/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239997217,"owners_count":19731368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["information-extraction","large-language-models","named-entity-recognition","natural-language-processing","prompt-tuning"],"created_at":"2024-10-14T07:30:16.656Z","updated_at":"2026-04-13T00:30:20.686Z","avatar_url":"https://github.com/urchade.png","language":"Python","funding_links":[],"categories":["NLP","Python"],"sub_categories":[],"readme":"# 👑 GLiNER: Generalist and Lightweight Model for Named Entity Recognition\n\nGLiNER is a Named Entity Recognition (NER) model capable of identifying any entity type using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to traditional NER models, which are limited to predefined entities, and Large Language Models (LLMs) that, despite their flexibility, are costly and large for resource-constrained scenarios.\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.org/project/gliner/\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Python\" src=\"https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54\" /\u003e\n        \u003cimg alt=\"Version\" src=\"https://img.shields.io/pypi/v/gliner?style=for-the-badge\u0026color=3670A0\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://aclanthology.org/2024.naacl-long.300/\"\u003e📄 Paper\u003c/a\u003e\n    \u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n    \u003ca href=\"https://discord.gg/Y2yVxpSQnG\"\u003e📢 Discord\u003c/a\u003e\n    \u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n    \u003ca href=\"https://huggingface.co/spaces/urchade/gliner_mediumv2.1\"\u003e🤗 Demo\u003c/a\u003e\n    \u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n    \u003ca href=\"https://huggingface.co/models?library=gliner\u0026sort=trending\"\u003e🤗 Available models\u003c/a\u003e\n    \u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n    \u003ca href=\"https://colab.research.google.com/drive/1mhalKWzmfSTqMnR0wQBZvt9-ktTsATHB?usp=sharing\"\u003e\n        \u003cimg align=\"center\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Example Notebooks\n\nExplore various examples including finetuning, ONNX conversion, and synthetic data generation. \n\n- [Example Notebooks](https://github.com/urchade/GLiNER/tree/main/examples)\n- Finetune on Colab \u0026nbsp;[\u003cimg align=\"center\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" /\u003e](https://colab.research.google.com/drive/1HNKd74cmfS9tGvWrKeIjSxBt01QQS7bq?usp=sharing)\n## 🛠 Installation \u0026 Usage\n\n### Installation\n```bash\n!pip install gliner\n```\n\n### Usage\nAfter the installation of the GLiNER library, import the `GLiNER` class. Following this, you can load your chosen model with `GLiNER.from_pretrained` and utilize `predict_entities` to discern entities within your text.\n\n```python\nfrom gliner import GLiNER\n\n# Initialize GLiNER with the base model\nmodel = GLiNER.from_pretrained(\"urchade/gliner_medium-v2.1\")\n\n# Sample text for entity prediction\ntext = \"\"\"\nCristiano Ronaldo dos Santos Aveiro (Portuguese pronunciation: [kɾiʃˈtjɐnu ʁɔˈnaldu]; born 5 February 1985) is a Portuguese professional footballer who plays as a forward for and captains both Saudi Pro League club Al Nassr and the Portugal national team. Widely regarded as one of the greatest players of all time, Ronaldo has won five Ballon d'Or awards,[note 3] a record three UEFA Men's Player of the Year Awards, and four European Golden Shoes, the most by a European player. He has won 33 trophies in his career, including seven league titles, five UEFA Champions Leagues, the UEFA European Championship and the UEFA Nations League. Ronaldo holds the records for most appearances (183), goals (140) and assists (42) in the Champions League, goals in the European Championship (14), international goals (128) and international appearances (205). He is one of the few players to have made over 1,200 professional career appearances, the most by an outfield player, and has scored over 850 official senior career goals for club and country, making him the top goalscorer of all time.\n\"\"\"\n\n# Labels for entity prediction\n# Most GLiNER models should work best when entity types are in lower case or title case\nlabels = [\"Person\", \"Award\", \"Date\", \"Competitions\", \"Teams\"]\n\n# Perform entity prediction\nentities = model.predict_entities(text, labels, threshold=0.5)\n\n# Display predicted entities and their labels\nfor entity in entities:\n    print(entity[\"text\"], \"=\u003e\", entity[\"label\"])\n```\n\n#### Expected Output\n\n```\nCristiano Ronaldo dos Santos Aveiro =\u003e person\n5 February 1985 =\u003e date\nAl Nassr =\u003e teams\nPortugal national team =\u003e teams\nBallon d'Or =\u003e award\nUEFA Men's Player of the Year Awards =\u003e award\nEuropean Golden Shoes =\u003e award\nUEFA Champions Leagues =\u003e competitions\nUEFA European Championship =\u003e competitions\nUEFA Nations League =\u003e competitions\nEuropean Championship =\u003e competitions\n```\n## 🌟 Maintainers\n\n\u003cdiv align=\"center\"\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cstrong\u003eUrchade Zaratiana\u003c/strong\u003e\u003cbr\u003e\n        \u003cem\u003ePhD Student at LIPN\u003c/em\u003e\u003cbr\u003e\n        \u003ca href=\"https://www.linkedin.com/in/urchade-zaratiana/\"\u003e\u003cimg src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\" alt=\"LinkedIn\" /\u003e\u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cstrong\u003eIhor Stepanov\u003c/strong\u003e\u003cbr\u003e\n        \u003cem\u003eCo-Founder at Knowledgator\u003c/em\u003e\u003cbr\u003e\n        \u003ca href=\"https://www.linkedin.com/in/ihor-stepanov/\"\u003e\u003cimg src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\" alt=\"LinkedIn\" /\u003e\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\n## 👨‍💻 Model Authors\nThe model authors are:\n* [Urchade Zaratiana](https://huggingface.co/urchade)\n* Nadi Tomeh\n* Pierre Holat\n* Thierry Charnois\n\n## 📚 Citation\n\nIf you find GLiNER useful in your research, please consider citing our paper:\n\n```bibtex\n@inproceedings{zaratiana-etal-2024-gliner,\n    title = \"{GL}i{NER}: Generalist Model for Named Entity Recognition using Bidirectional Transformer\",\n    author = \"Zaratiana, Urchade  and\n      Tomeh, Nadi  and\n      Holat, Pierre  and\n      Charnois, Thierry\",\n    editor = \"Duh, Kevin  and\n      Gomez, Helena  and\n      Bethard, Steven\",\n    booktitle = \"Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers)\",\n    month = jun,\n    year = \"2024\",\n    address = \"Mexico City, Mexico\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://aclanthology.org/2024.naacl-long.300\",\n    doi = \"10.18653/v1/2024.naacl-long.300\",\n    pages = \"5364--5376\",\n    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.\",\n}\n```\n## Support and funding\n\nThis project has been supported and funded by **F.initiatives** and **Laboratoire Informatique de Paris Nord**.\n\nF.initiatives has been an expert in public funding strategies for R\u0026D, Innovation, and Investments (R\u0026D\u0026I) for over 20 years. With a team of more than 200 qualified consultants, F.initiatives guides its clients at every stage of developing their public funding strategy: from structuring their projects to submitting their aid application, while ensuring the translation of their industrial and technological challenges to public funders. Through its continuous commitment to excellence and integrity, F.initiatives relies on the synergy between methods and tools to offer tailored, high-quality, and secure support.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo/FI_COMPLET_CW.png\" alt=\"FI Group\" width=\"300\"/\u003e\n\u003c/p\u003e\n\nWe also extend our heartfelt gratitude to the open-source community for their invaluable contributions, which have been instrumental in the success of this project.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furchade%2FGLiNER","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furchade%2FGLiNER","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furchade%2FGLiNER/lists"}