fastie


Namefastie JSON
Version 1.0.1.dev0 PyPI version JSON
download
home_pagehttps://github.com/xusenlinzy/FastIE
SummaryEasy-to-use Information Extraction Framework
upload_time2024-09-06 15:35:13
maintainerNone
docs_urlNone
authorxusenlin
requires_python>=3.8.0
licenseApache 2.0 License
keywords nlp information extraction ner text classification event extraction transformer pytorch deep learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FastIE

<p align="center">
    <a href="https://github.com/xusenlinzy/fastie"><img src="https://img.shields.io/github/license/xusenlinzy/fastie"></a>
    <a href=""><img src="https://img.shields.io/badge/python-3.8+-aff.svg"></a>
    <a href=""><img src="https://img.shields.io/badge/pytorch-%3E=2.0-red?logo=pytorch"></a>
    <a href="https://github.com/xusenlinzy/fastie"><img src="https://img.shields.io/github/last-commit/xusenlinzy/fastie"></a>
    <a href="https://github.com/xusenlinzy/fastie"><img src="https://img.shields.io/github/issues/xusenlinzy/fastie?color=9cc"></a>
    <a href="https://github.com/xusenlinzy/fastie"><img src="https://img.shields.io/github/stars/xusenlinzy/fastie?color=ccf"></a>
    <a href="https://github.com/xusenlinzy/fastie"><img src="https://img.shields.io/badge/langurage-py-brightgreen?style=flat&color=blue"></a>
</p>

此项目为开源**文本分类、实体抽取、关系抽取和事件抽取**[模型](MODELS.md)的训练和推理提供统一的框架,具有以下特性


+ ✨ 支持多种开源文本分类、实体抽取、关系抽取和事件抽取模型


+ 👑 支持百度 [UIE](https://github.com/PaddlePaddle/PaddleNLP) 模型的训练和推理


+ 🚀 统一的训练和推理框架


+ 🎯 集成对抗训练方法,简便易用


## 📢 更新日志 

+ 【2024.8.30】 发布初始版本


---

## 📦 快速安装

pip 安装

```shell
pip install --upgrade fastie
```

源码安装

```shell
git clone https://github.com/xusenlinzy/FastIE.git
pip install -e .
```


## 🚀 模型训练

### 实体抽取

```shell
cd examples/named_entity_recognition
fastie-cli train global_pointer.yaml
```

具体参数详见 [named_entity_recognition](./examples/named_entity_recognition)

### 关系抽取

```shell
cd examples/relation_extraction
fastie-cli train gplinker.yaml
```

具体参数详见 [relation_extraction](./examples/relation_extraction)


### 事件抽取

```shell
cd examples/event_extraction
fastie-cli train gplinker.yaml
```

具体参数详见 [event_extraction](./examples/event_extraction)


## 📊 模型推理

本项目实现了对各类模型推理代码的封装,只需要4行代码即可推理!

```python
from transformers import AutoModel, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("path_to_model", trust_remote_code=True)
model = AutoModel.from_pretrained("path_to_model", trust_remote_code=True)

print(model.predict(tokenizer, "因肺过度充气,常将肝脏推向下方。"))
```

一键启动模型接口或DEMO

```shell
# fastie-cli api --model_name_or_path path_to_model --port 9000
fastie-cli demo --model_name_or_path path_to_model --port 9000
```


## 致谢

本项目受益于 [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory),感谢以上诸位作者的付出。

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xusenlinzy/FastIE",
    "name": "fastie",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": null,
    "keywords": "NLP, Information Extraction, NER, Text Classification, Event Extraction, transformer, pytorch, deep learning",
    "author": "xusenlin",
    "author_email": "15797687258@163.com",
    "download_url": "https://files.pythonhosted.org/packages/e0/36/3edf6e875ea72b410d21238179a80df1e88478d7236eeee5fdbfe4de986b/fastie-1.0.1.dev0.tar.gz",
    "platform": null,
    "description": "# FastIE\r\n\r\n<p align=\"center\">\r\n    <a href=\"https://github.com/xusenlinzy/fastie\"><img src=\"https://img.shields.io/github/license/xusenlinzy/fastie\"></a>\r\n    <a href=\"\"><img src=\"https://img.shields.io/badge/python-3.8+-aff.svg\"></a>\r\n    <a href=\"\"><img src=\"https://img.shields.io/badge/pytorch-%3E=2.0-red?logo=pytorch\"></a>\r\n    <a href=\"https://github.com/xusenlinzy/fastie\"><img src=\"https://img.shields.io/github/last-commit/xusenlinzy/fastie\"></a>\r\n    <a href=\"https://github.com/xusenlinzy/fastie\"><img src=\"https://img.shields.io/github/issues/xusenlinzy/fastie?color=9cc\"></a>\r\n    <a href=\"https://github.com/xusenlinzy/fastie\"><img src=\"https://img.shields.io/github/stars/xusenlinzy/fastie?color=ccf\"></a>\r\n    <a href=\"https://github.com/xusenlinzy/fastie\"><img src=\"https://img.shields.io/badge/langurage-py-brightgreen?style=flat&color=blue\"></a>\r\n</p>\r\n\r\n\u6b64\u9879\u76ee\u4e3a\u5f00\u6e90**\u6587\u672c\u5206\u7c7b\u3001\u5b9e\u4f53\u62bd\u53d6\u3001\u5173\u7cfb\u62bd\u53d6\u548c\u4e8b\u4ef6\u62bd\u53d6**[\u6a21\u578b](MODELS.md)\u7684\u8bad\u7ec3\u548c\u63a8\u7406\u63d0\u4f9b\u7edf\u4e00\u7684\u6846\u67b6\uff0c\u5177\u6709\u4ee5\u4e0b\u7279\u6027\r\n\r\n\r\n+ \u2728 \u652f\u6301\u591a\u79cd\u5f00\u6e90\u6587\u672c\u5206\u7c7b\u3001\u5b9e\u4f53\u62bd\u53d6\u3001\u5173\u7cfb\u62bd\u53d6\u548c\u4e8b\u4ef6\u62bd\u53d6\u6a21\u578b\r\n\r\n\r\n+ \ud83d\udc51 \u652f\u6301\u767e\u5ea6 [UIE](https://github.com/PaddlePaddle/PaddleNLP) \u6a21\u578b\u7684\u8bad\u7ec3\u548c\u63a8\u7406\r\n\r\n\r\n+ \ud83d\ude80 \u7edf\u4e00\u7684\u8bad\u7ec3\u548c\u63a8\u7406\u6846\u67b6\r\n\r\n\r\n+ \ud83c\udfaf \u96c6\u6210\u5bf9\u6297\u8bad\u7ec3\u65b9\u6cd5\uff0c\u7b80\u4fbf\u6613\u7528\r\n\r\n\r\n## \ud83d\udce2 \u66f4\u65b0\u65e5\u5fd7 \r\n\r\n+ \u30102024.8.30\u3011 \u53d1\u5e03\u521d\u59cb\u7248\u672c\r\n\r\n\r\n---\r\n\r\n## \ud83d\udce6 \u5feb\u901f\u5b89\u88c5\r\n\r\npip \u5b89\u88c5\r\n\r\n```shell\r\npip install --upgrade fastie\r\n```\r\n\r\n\u6e90\u7801\u5b89\u88c5\r\n\r\n```shell\r\ngit clone https://github.com/xusenlinzy/FastIE.git\r\npip install -e .\r\n```\r\n\r\n\r\n## \ud83d\ude80 \u6a21\u578b\u8bad\u7ec3\r\n\r\n### \u5b9e\u4f53\u62bd\u53d6\r\n\r\n```shell\r\ncd examples/named_entity_recognition\r\nfastie-cli train global_pointer.yaml\r\n```\r\n\r\n\u5177\u4f53\u53c2\u6570\u8be6\u89c1 [named_entity_recognition](./examples/named_entity_recognition)\r\n\r\n### \u5173\u7cfb\u62bd\u53d6\r\n\r\n```shell\r\ncd examples/relation_extraction\r\nfastie-cli train gplinker.yaml\r\n```\r\n\r\n\u5177\u4f53\u53c2\u6570\u8be6\u89c1 [relation_extraction](./examples/relation_extraction)\r\n\r\n\r\n### \u4e8b\u4ef6\u62bd\u53d6\r\n\r\n```shell\r\ncd examples/event_extraction\r\nfastie-cli train gplinker.yaml\r\n```\r\n\r\n\u5177\u4f53\u53c2\u6570\u8be6\u89c1 [event_extraction](./examples/event_extraction)\r\n\r\n\r\n## \ud83d\udcca \u6a21\u578b\u63a8\u7406\r\n\r\n\u672c\u9879\u76ee\u5b9e\u73b0\u4e86\u5bf9\u5404\u7c7b\u6a21\u578b\u63a8\u7406\u4ee3\u7801\u7684\u5c01\u88c5\uff0c\u53ea\u9700\u89814\u884c\u4ee3\u7801\u5373\u53ef\u63a8\u7406\uff01\r\n\r\n```python\r\nfrom transformers import AutoModel, AutoTokenizer\r\n\r\ntokenizer = AutoTokenizer.from_pretrained(\"path_to_model\", trust_remote_code=True)\r\nmodel = AutoModel.from_pretrained(\"path_to_model\", trust_remote_code=True)\r\n\r\nprint(model.predict(tokenizer, \"\u56e0\u80ba\u8fc7\u5ea6\u5145\u6c14\uff0c\u5e38\u5c06\u809d\u810f\u63a8\u5411\u4e0b\u65b9\u3002\"))\r\n```\r\n\r\n\u4e00\u952e\u542f\u52a8\u6a21\u578b\u63a5\u53e3\u6216DEMO\r\n\r\n```shell\r\n# fastie-cli api --model_name_or_path path_to_model --port 9000\r\nfastie-cli demo --model_name_or_path path_to_model --port 9000\r\n```\r\n\r\n\r\n## \u81f4\u8c22\r\n\r\n\u672c\u9879\u76ee\u53d7\u76ca\u4e8e [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)\uff0c\u611f\u8c22\u4ee5\u4e0a\u8bf8\u4f4d\u4f5c\u8005\u7684\u4ed8\u51fa\u3002\r\n",
    "bugtrack_url": null,
    "license": "Apache 2.0 License",
    "summary": "Easy-to-use Information Extraction Framework",
    "version": "1.0.1.dev0",
    "project_urls": {
        "Homepage": "https://github.com/xusenlinzy/FastIE"
    },
    "split_keywords": [
        "nlp",
        " information extraction",
        " ner",
        " text classification",
        " event extraction",
        " transformer",
        " pytorch",
        " deep learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6220ca7bb92df5aea4b4c452a1bf559be43da041281d7cdc7cc48113a934dcb5",
                "md5": "92c1fc1f2241262052666bcfecefd1b7",
                "sha256": "927d79e182a83b38c904f25c3e2ccef9b0362c94f0376b0349263ac4b5d53f72"
            },
            "downloads": -1,
            "filename": "fastie-1.0.1.dev0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "92c1fc1f2241262052666bcfecefd1b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 209422,
            "upload_time": "2024-09-06T15:35:10",
            "upload_time_iso_8601": "2024-09-06T15:35:10.675733Z",
            "url": "https://files.pythonhosted.org/packages/62/20/ca7bb92df5aea4b4c452a1bf559be43da041281d7cdc7cc48113a934dcb5/fastie-1.0.1.dev0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0363edf6e875ea72b410d21238179a80df1e88478d7236eeee5fdbfe4de986b",
                "md5": "6ab30d1a91f70f5ebacf1d58461fdfa7",
                "sha256": "2a205edef056f382e73eb2dd714c99f8bdc8d54e43f1a5c48eb27aa2c6c8146e"
            },
            "downloads": -1,
            "filename": "fastie-1.0.1.dev0.tar.gz",
            "has_sig": false,
            "md5_digest": "6ab30d1a91f70f5ebacf1d58461fdfa7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 155796,
            "upload_time": "2024-09-06T15:35:13",
            "upload_time_iso_8601": "2024-09-06T15:35:13.459841Z",
            "url": "https://files.pythonhosted.org/packages/e0/36/3edf6e875ea72b410d21238179a80df1e88478d7236eeee5fdbfe4de986b/fastie-1.0.1.dev0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-06 15:35:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xusenlinzy",
    "github_project": "FastIE",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "fastie"
}
        
Elapsed time: 0.70735s