A toolkit for Relation Extraction and more...
Project description
A toolkit for Relation & Event eXtraction (REx) and more...
This project has not been finished yet, so be careful when using it, or wait until the first release comes out.
This project is suffering from the second-system effect. I would like to cut some features to make this going smoothly.
Accelerate seems to be a very sweet wrapper for multi-GPU, TPU training, we highly recommend you to use such frameworks, instead of adding hard codes on your own.
⚙️Installation
Make sure you have installed all the dependencies below.
- Python>=3.6
- torch>=1.2.0 : project is developed with torch==1.7.1, should be compatable with >=1.2.0 versions
- numpy>=1.19.0
- scikit-learn>=0.21.3
- omegaconf>=2.0.6
- loguru>=0.5.3
- tqdm>=4.61.1
- transformers>=4.8.2
$ git clone https://github.com/Spico197/REx.git
$ cd REx
$ pip install -e .
# or you can download and install from pypi, not recommend for now
$ pip install pytorch-rex -i https://pypi.org/simple
🚀QuickStart
Checkout the examples
folder.
Name | Model | Dataset | Task |
---|---|---|---|
SentRE-MCML | PCNN | IPRE | Sentence-level Multi-class multi-label relation classification |
BagRE | PCNN+ONE | NYT10 | Bag-level relation classification (Multi-Instance Learning, MIL) |
JointERE | CasRel | WebNLG | Jointly entity relation extraction |
- To create new task for classification, try:
rex new classification <task_name>
- To create new task for tagging, try:
rex new tagging <task_name>
✈️Abilities
Dataset
- IPRE preprocess
- NYT10
Tasks
- Chinese sentence-level relation extraction
- English bag-level relation extraction
Modules & Models
- Piecewise CNN
- PCNN + ONE
- PCNN + ATT
⚗ Development
-
fork to your namespace
-
install
pytorch-rex
with[dev]
option
$ pip install pytorch-rex[dev]
- install pre-commit hooks
$ pre-commit install
✉️Update
- v0.1.4: move accelerate to
rex.__init__
, update multi process tqdm & logging (only show in the main process in default), remove cache in debug mode, fix bugs inrex.cmds.new
, addrank_zero_only
in task dump,load_best_ckpt
ifresumed_training
- v0.1.3: fix emb import
- v0.1.1: update registry and add
accelerate
multi-gpu support - v0.1.0: huge update with lots of new features, check the usage in
examples/IPRE
~ - v0.0.15: add safe_try to kill ugly statements in example main call
- v0.0.14: update vocab embedding loading to be compatible with other embedding files
- v0.0.13: update vocab, label_encoder, fix bugs in cnn reshaping and crf importing
- v0.0.12: fix crf module import issue
- v0.0.11: fix templates data resources
- v0.0.10: update
utils.config
module,StaticEmbedding
decoupling, remove eps in metrics, add templates generation entrypoints, add more tests (coverage stat for the whole repo, lots of codes are not test case covered) - v0.0.9: use
argparse
instead ofclick
, move loguru logger intorex.utils.logging
, add hierarchical config setting - v0.0.8: fix config loading, change default of
makedirs
anddump_configfile
to beTrue
- v0.0.7: fix recursive import bug
- v0.0.6: integrate omega conf loading into the inner task, add
load_*_data
option to data managers - v0.0.5: update ffn
- v0.0.4: return detailed classification information in
mc_prf1
, support nested dict tensor movement - v0.0.3: fix packaging bug in
setup.py
- v0.0.2: add black formatter and pytest testing
- v0.0.1: change
LabelEncoder.to_binary_labels
intoconvert_to_multi_hot
orconvert_to_one_hot
🔑LICENCE
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytorch-rex-0.1.4.tar.gz
.
File metadata
- Download URL: pytorch-rex-0.1.4.tar.gz
- Upload date:
- Size: 56.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.27.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d99f40303d197a199248067a5a95206c25bee87ba899cbe6a581a0491eb9170c |
|
MD5 | 595d4d3c893ed90ba29236f9c90554d0 |
|
BLAKE2b-256 | fb5b028d2e96ab989642be0d6c7f086be95d2dd57df7f1ef2c811a976304bc68 |
File details
Details for the file pytorch_rex-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: pytorch_rex-0.1.4-py3-none-any.whl
- Upload date:
- Size: 77.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.27.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25e4585217cc0a0bd12bf23236f46787abb86fae5ec640c1fb8fa932148dd340 |
|
MD5 | fa3590416ab796fd97be4a52a9883a78 |
|
BLAKE2b-256 | 3819f1ba3ab74b5643278eb4957cad30c9d431027bedb26d285a5f35cdb58380 |