{"id":23237014,"url":"https://github.com/nicolay-r/AREnets","last_synced_at":"2025-08-19T23:31:18.058Z","repository":{"id":109047678,"uuid":"577404575","full_name":"nicolay-r/AREnets","owner":"nicolay-r","description":"Tensorflow-based framework which lists attentive implementation of the conventional neural network models (CNN, RNN-based), applicable for Relation Extraction classification tasks as well as API for custom model implementation","archived":false,"fork":false,"pushed_at":"2023-11-08T13:39:58.000Z","size":1400,"stargazers_count":7,"open_issues_count":12,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-15T19:48:57.672Z","etag":null,"topics":["attention","bilstm","classification","cnn","cnn-attention","cnn-model","lstm","ml","neural-network","nlp","nlp-machine-learning","pcnn","rcnn-model","relation-extraction","rnn","self-attention","self-attentive-rnn","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicolay-r.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}},"created_at":"2022-12-12T16:58:12.000Z","updated_at":"2023-09-06T08:20:40.000Z","dependencies_parsed_at":"2023-12-18T06:47:08.797Z","dependency_job_id":null,"html_url":"https://github.com/nicolay-r/AREnets","commit_stats":{"total_commits":158,"total_committers":1,"mean_commits":158.0,"dds":0.0,"last_synced_commit":"f05169cb1fe46ea10176192fb5ea0358280f17ee"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2FAREnets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2FAREnets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2FAREnets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2FAREnets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolay-r","download_url":"https://codeload.github.com/nicolay-r/AREnets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230374271,"owners_count":18216044,"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":["attention","bilstm","classification","cnn","cnn-attention","cnn-model","lstm","ml","neural-network","nlp","nlp-machine-learning","pcnn","rcnn-model","relation-extraction","rnn","self-attention","self-attentive-rnn","tensorflow"],"created_at":"2024-12-19T04:13:24.391Z","updated_at":"2025-08-19T23:31:18.039Z","avatar_url":"https://github.com/nicolay-r.png","language":"Python","funding_links":[],"categories":["Frameworks"],"sub_categories":[],"readme":"# AREnets\n\n![](https://img.shields.io/badge/Python-3.6.9-brightgreen.svg)\n![](https://img.shields.io/badge/Tensorflow-1.14-orange.svg)\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nicolay-r/AREnets/blob/master/arenets_colab_tutorial.ipynb)\n[![PyPI downloads](https://img.shields.io/pypi/dm/arenets.svg)](https://pypistats.org/packages/arenets)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"logo.png\"/\u003e\n\u003c/p\u003e\n\n\n**AREnets** -- is an [OpenNRE](https://github.com/thunlp/OpenNRE) like project, but the kernel based on [tensorflow](https://www.tensorflow.org/)\nlibrary, with implementation of neural networks on top of it, designed for **A**ttitude and **R**elation **E**xtraction tasks.\nAREnets is a result of advances in [Sentiment Attitude Extraction task](http://nlpprogress.com/russian/sentiment-analysis.html)\nbut introduced in generalized form and applicable for other relation-extraction related classification tasks. \nIt provides ready to use [neural networks](#models-list) and API for `subject`→`object` pairs classification in a given samples. \nThis project is powered by \n[AREkit](https://github.com/nicolay-r/AREkit) \ncore API, squeezed into a tiny \n[kernel](https://github.com/nicolay-r/AREnets/tree/dev/arenets/arekit).\n\n## Contents\n* [Installation](#installation)\n* [Quick Start](#quick-start)\n* [Models List](#models-list)\n* [FAQ](#faq)\n* [Test Details](#test-details)\n* [How to cite](#how-to-cite)\n\n## Installation\n\n```bash\npip install git+https://github.com/nicolay-r/AREnets@master\n```\n\n## Quick Start\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nicolay-r/AREnets/blob/master/arenets_colab_tutorial.ipynb)\n\nSimply just open and follow the [google-colab](https://colab.research.google.com/github/nicolay-r/AREnets/blob/master/arenets_colab_tutorial.ipynb) \nversion like IDE to modify the train and inference code of provided tutorial:\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"docs/colab-as-ide-logo.png\"/\u003e\n\u003c/p\u003e\n\nThe complete examples are in [tutorials](tutorials) folder.\n\nFirst of all, prepare your `_data` folder with data required for training model and performing inference.\n* **Input samples**: check out [input data formatting guide](docs/input_data.md).\n* **Embeddings** could be obtained from [NLPL repository](http://vectors.nlpl.eu/repository/), \n  with `model.txt` file placed at `_data` folder; \n    * See [downloading script](tutorials/_data/download_embedding.sh);\n\nMore on input features could be [found here](docs/input_features.md).\n\n### Train\n```python\nfrom arenets.quickstart.train import train\nfrom arenets.enum_name_types import ModelNames\n\ntrain(input_data_dir=\"_data\", labels_count=3, model_name=ModelNames.CNN, epochs_count=10)\n```\nRuns `cnn` model with `10` epochs for `3-class` classification problem; \nall the model-related details will be stored at `_data` model by default.\n\n### Predict \n```python\nfrom arenets.quickstart.predict import predict\nfrom arenets.arekit.common.data_type import DataType\nfrom arenets.enum_name_types import ModelNames\n\npredict(input_data_dir=\"_data\", output_dir=\"_out\", labels_count=3, model_name=ModelNames.CNN, data_type=DataType.Test)\n```\nPredict `test` results for pre-trained `cnn` model and saves them into `_out` folder\n\n## Models List\n\n* **Aspect-based Attentive encoders**:\n    - Multilayer Perceptron (MLP)\n        [[code]](arenets/attention/architectures/mlp.py) /\n        [[github:nicolay-r]](https://github.com/nicolay-r/mlp-attention);\n* **Self-based Attentive encoders**:\n    - P. Zhou et. al.\n        [[code]](arenets/attention/architectures/self_p_zhou.py) /\n        [[github:SeoSangwoo]](https://github.com/SeoSangwoo/Attention-Based-BiLSTM-relation-extraction);\n    - Z. Yang et. al.\n        [[code]](arenets/attention/architectures/self_z_yang.py) /\n        [[github:ilivans]](https://github.com/ilivans/tf-rnn-attention);\n* **Single Sentence Based Architectures**:\n    - CNN\n        [[code]](arenets/context/architectures/cnn.py) /\n        [[github:roomylee]](https://github.com/roomylee/cnn-relation-extraction);\n    - CNN + Aspect-based MLP Attention\n        [[code]](arenets/context/architectures/base/att_cnn_base.py);\n    - PCNN\n        [[code]](arenets/context/architectures/pcnn.py) /\n        [[github:nicolay-r]](https://github.com/nicolay-r/sentiment-pcnn);\n    - PCNN + Aspect-based MLP Attention\n        [[code]](arenets/context/architectures/base/att_pcnn_base.py);\n    - RNN (LSTM/GRU/RNN)\n        [[code]](arenets/context/architectures/rnn.py) /\n        [[github:roomylee]](https://github.com/roomylee/rnn-text-classification-tf);\n    - IAN (frames based)\n        [[code]](arenets/context/architectures/ian_frames.py) /\n        [[github:lpq29743]](https://github.com/lpq29743/IAN);\n    - RCNN (BiLSTM + CNN)\n        [[code]](arenets/context/architectures/rcnn.py) /\n        [[github:roomylee]](https://github.com/roomylee/rcnn-text-classification);\n    - BiLSTM\n        [[code]](arenets/context/architectures/bilstm.py) /\n        [[github:roomylee]](https://github.com/roomylee/rnn-text-classification-tf);\n    - Bi-LSTM + Aspect-based MLP Attention \n        [[code]](arenets/context/architectures/base/att_bilstm_base.py)\n    - Bi-LSTM + Self Attention\n        [[code]](arenets/context/architectures/self_att_bilstm.py) /\n        [[github:roomylee]](https://github.com/roomylee/self-attentive-emb-tf);\n    - RCNN + Self Attention\n        [[code]](arenets/context/architectures/att_self_rcnn.py);\n* **Multi Sentence Based Encoders Architectures**:\n    - Self Attentive \n        [[code]](arenets/multi/architectures/att_self.py);\n    - Max Pooling\n        [[code]](arenets/multi/architectures/max_pooling.py) /\n        [[paper]](https://pdfs.semanticscholar.org/8731/369a707046f3f8dd463d1fd107de31d40a24.pdf);\n    - Single MLP\n        [[code]](arenets/multi/architectures/base/base_single_mlp.py);\n      \n## FAQ\n\n#### [How to prepare input data?](docs/input_data.md)\n#### [How to setup `jsonl` or `csv` data reader?](docs/input_readers.md)\n#### [How to implement a custom model with attention?](docs/tutorial_attention.md)\n#### [How to customize the prediction output?](docs/tutorial_predict_output.md)\n\n## Test Details\n\nThis project has been tested under the following setup:\n* NVidia GTX-1060/1080 TI\n* CUDA compilation tools, release 10.0, V10.0.130\n* Python 3.6.9\n* Pandas 0.25.3 (Optional, only for `CSV` reading)\n* [Pip freeze package list](docs/pip-freeze-list.txt)\n\n## How to cite\n\nOur one and my personal interest is to help you better explore and analyze attitude and relation extraction related tasks with AREnets.\nA great research is also accompanied with the faithful reference.\nif you use or extend our work, please cite as follows:\n```bibtex\n@misc{arenets2023,\n  author={Nicolay Rusnachenko},\n  title={{AREnets}: Tensorflow-based framework of attentive neural-network \n         models for text classfication and relation extraction tasks},\n  year={2023},\n  url={https://github.com/nicolay-r/AREnets},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolay-r%2FAREnets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolay-r%2FAREnets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolay-r%2FAREnets/lists"}