Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation extraction #173

Merged
merged 119 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
b20e7c8
Added files.
vladd-bit Aug 24, 2021
eec6c59
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Aug 31, 2021
56220aa
More additions to rel extraction.
vladd-bit Sep 1, 2021
7ad88f5
Rel base.
vladd-bit Sep 3, 2021
233ce36
Update.
vladd-bit Sep 6, 2021
85a7015
Updates.
vladd-bit Sep 10, 2021
5003548
Dependency parsing.
vladd-bit Oct 1, 2021
541b47d
Updates.
vladd-bit Oct 13, 2021
c042b0d
Added pre-training steps.
vladd-bit Oct 15, 2021
87d0c0c
Added training & model utils.
vladd-bit Oct 18, 2021
4f42696
Cleanup & fixes.
vladd-bit Oct 19, 2021
018d811
Update.
vladd-bit Oct 21, 2021
f3d3f44
Evaluation updates for pretraining.
vladd-bit Oct 27, 2021
e5f354e
Removed duplicate relation storage.
vladd-bit Nov 9, 2021
c69de67
Merged master.
vladd-bit Nov 9, 2021
031d256
Moved RE model file location.
vladd-bit Nov 12, 2021
2259a6b
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Nov 16, 2021
1c469e9
Structure revisions.
vladd-bit Nov 22, 2021
423b4e1
Added custom config for RE.
vladd-bit Dec 13, 2021
8ae9abb
Implemented custom dataset loader for RE.
vladd-bit Dec 13, 2021
186416c
More changes.
vladd-bit Dec 13, 2021
451e33f
Small fix.
vladd-bit Dec 13, 2021
8b36413
Latest additions to RelCAT (pipe + predictions)
vladd-bit Jan 19, 2022
2fb8fc9
Setup.py fix.
vladd-bit Jan 19, 2022
930dd11
RE utils update.
vladd-bit Jan 19, 2022
24b2841
rel model update.
vladd-bit Jan 19, 2022
193ecb1
rel dataset + tokenizer improvements.
vladd-bit Jan 19, 2022
03111a7
RelCAT updates.
vladd-bit Jan 19, 2022
7ab60f4
RelCAT saving/loading improvements.
vladd-bit Jan 21, 2022
40875f3
RelCAT saving/loading improvements.
vladd-bit Jan 21, 2022
810d1dc
RelCAT model fixes.
vladd-bit Jan 21, 2022
11dcb32
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Jan 21, 2022
72187f6
Attempted gpu learning fix. Dataset label generation fixes.
vladd-bit Jan 24, 2022
5f67a4c
Minor train dataset gen fix.
vladd-bit Jan 24, 2022
cfc0e91
Minor train dataset gen fix No.2.
vladd-bit Jan 24, 2022
9f4b220
Config updates.
vladd-bit Jan 25, 2022
19afa81
Gpu support fixes. Added label stats.
vladd-bit Jan 25, 2022
8eb1665
Evaluation stat fixes.
vladd-bit Jan 26, 2022
6e86fa2
Cleaned stat output mode during training.
vladd-bit Jan 26, 2022
5cee8cf
Build fix.
vladd-bit Jan 26, 2022
223ac9a
removed unused dependencies and fixed code formatting
vladd-bit Jan 26, 2022
ea7d68c
Mypy compliance.
vladd-bit Jan 26, 2022
1ea9738
Fixed linting.
vladd-bit Jan 27, 2022
9f6609e
More Gpu mode train fixes.
vladd-bit Jan 28, 2022
1782c0b
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Jan 28, 2022
fb86869
Fixed model saving/loading issues when using other baes models.
vladd-bit Jan 31, 2022
df21543
More fixes to stat evaluation. Added proper CAT integration of RelCAT.
vladd-bit Feb 3, 2022
92a5e08
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Feb 3, 2022
87d1a9c
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Mar 11, 2022
ced1627
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Mar 14, 2022
7b69710
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Mar 28, 2022
37fd212
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Apr 4, 2022
f0eda2b
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Apr 8, 2022
10269b9
Setup.py typo fix.
vladd-bit Apr 8, 2022
b8a45b2
Merge branch 'relation_extraction' of https://github.com/CogStack/Med…
vladd-bit Apr 8, 2022
20203ac
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit May 10, 2022
f057139
RelCAT loading fix.
vladd-bit May 10, 2022
197a27a
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Jul 21, 2022
86fd509
RelCAT Config changes.
vladd-bit Aug 1, 2022
79dc069
Type fix. Minor additions to RelCAT model.
vladd-bit Aug 1, 2022
323c895
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Aug 1, 2022
f1c56bf
Type fixes.
vladd-bit Aug 1, 2022
a78ff86
Type corrections.
vladd-bit Aug 2, 2022
f09ceb2
RelCAT update.
vladd-bit Mar 21, 2023
32574f2
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Mar 21, 2023
c081c3e
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit May 22, 2023
e2e48b5
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Dec 11, 2023
4ce5ba3
Type fixes.
vladd-bit Dec 12, 2023
21c09ff
Merge branch 'relation_extraction' of https://github.com/CogStack/Med…
vladd-bit Dec 13, 2023
8123689
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Dec 13, 2023
57ab0c5
Fixed type issue.
vladd-bit Dec 13, 2023
9da5aa6
RelCATConfig: added seed param.
vladd-bit Dec 13, 2023
009e832
Adaptations to the new codebase + type fixes..
vladd-bit Dec 15, 2023
1a7d130
Doc/type fixes.
vladd-bit Dec 19, 2023
53dba6a
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Dec 20, 2023
92613ed
Fixed input size issue for model.
vladd-bit Jan 8, 2024
a49a44a
Fixed issue(s) with model size and config.
vladd-bit Jan 16, 2024
6456e6e
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Jan 16, 2024
5aac9ab
RelCAT: updated configs to new style.
vladd-bit Jan 19, 2024
9c50b30
RelCAT: removed old refs to logging.
vladd-bit Jan 19, 2024
b071607
Merge branches 'relation_extraction' and 'master' of https://github.c…
vladd-bit Jan 29, 2024
89d9128
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Feb 7, 2024
e6e99cb
Fixed GPU training + added extra stat print for train set.
vladd-bit Feb 7, 2024
307d194
Type fixes.
vladd-bit Feb 7, 2024
fb7efe3
Updated dev requirements.
vladd-bit Feb 7, 2024
c235daf
Linting.
vladd-bit Feb 7, 2024
fcdf2e3
Merge branches 'relation_extraction' and 'master' of https://github.c…
vladd-bit Feb 9, 2024
aad0a73
Fixed pin_memory issue when training on CPU.
vladd-bit Feb 9, 2024
8a9026b
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Mar 8, 2024
f94e349
Updated RelCAT dataset get + default config.
vladd-bit Mar 21, 2024
0770356
Updated RelDS generator + default config
vladd-bit Mar 25, 2024
bdf20f5
Linting.
vladd-bit Mar 25, 2024
f7b5aaf
Updated RelDatset + config.
vladd-bit Apr 3, 2024
3e827cf
Merge branch 'relation_extraction' of https://github.com/CogStack/Med…
vladd-bit Apr 3, 2024
aaf6533
Pushing updates to model
shubham-s-agarwal Apr 8, 2024
18f9bb8
Fixing formatting
shubham-s-agarwal Apr 8, 2024
503513c
Update rel_dataset.py
shubham-s-agarwal Apr 8, 2024
040821b
Update rel_dataset.py
shubham-s-agarwal Apr 8, 2024
ed7c8d5
Update rel_dataset.py
shubham-s-agarwal Apr 8, 2024
8d0bfe4
RelCAT: added test resource files.
vladd-bit Apr 9, 2024
3f3a780
RelCAT: Fixed model load/checkpointing.
vladd-bit Apr 10, 2024
3f56824
RelCAT: updated to pipe spacy doc call.
vladd-bit Apr 12, 2024
b7a4987
RelCAT: added tests.
vladd-bit Apr 12, 2024
77d27b0
Merge branch 'relation_extraction' of https://github.com/CogStack/Med…
vladd-bit Apr 12, 2024
a9258a2
Fixed lint/type issues & added rel tag to test DS.
vladd-bit Apr 15, 2024
0ed70fb
Fixed ann id to token issue.
vladd-bit Apr 15, 2024
8db2e76
RelCAT: updated test dataset + tests.
vladd-bit Apr 18, 2024
6eea6b7
RelCAT: updates to requested changes + dataset improvements.
vladd-bit Apr 18, 2024
6972310
RelCAT: updated docs/logs according to commends.
vladd-bit Apr 18, 2024
d03316c
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Apr 18, 2024
8cb12a4
RelCAT: type fix.
vladd-bit Apr 18, 2024
d10318a
RelCAT: mct export dataset updates.
vladd-bit Apr 19, 2024
12acaeb
RelCAT: test updates + requested changes p2.
vladd-bit Apr 19, 2024
4c14a3a
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Apr 19, 2024
382cefc
RelCAT: log for MCT export train.
vladd-bit Apr 19, 2024
35b0913
Updated docs + split train_test & dataset for benchmarks.
vladd-bit Apr 26, 2024
d48bc41
type fixes.
vladd-bit Apr 26, 2024
3068516
Merge branch 'master' of https://github.com/CogStack/MedCAT into rela…
vladd-bit Apr 26, 2024
72643fc
Merge branch 'master' into relation_extraction
mart-r Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions medcat/config_re.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from typing import Dict, Any
from medcat.config import ConfigMixin


class ConfigRE(ConfigMixin):
vladd-bit marked this conversation as resolved.
Show resolved Hide resolved

def __init__(self) -> None:

self.general: Dict[str, Any] = {
'device': 'cpu',
'seed': 13,
# these are the pairs of relations that are to be predicted , form of : [("Disease", "Symptom"), ("entity1_type", "entity2_type") ...]
'relation_type_filter_pairs': [],
'category_value2id': {}, # Map from category values to ID, if empty it will be autocalculated during training
'vocab_size': None, # Will be set automatically if the tokenizer is provided during meta_cat init
'lowercase': True, # If true all input text will be lowercased
'ent_context_left': 2, # Number of entities to take from the left of the concept
'ent_context_right': 2, # Number of entities to take from the right of the concept
'window_size' : 300, # max acceptable dinstance between entities (in characters)
'batch_size_eval': 5000, # Number of annotations to be meta-annotated at once in eval
'tokenizer_name': 'BERT', # Tokenizer name used with of MetaCAT
'pipe_batch_size_in_chars': 20000000, # How many characters are piped at once into the meta_cat class
}
self.model: Dict[str, Any] = {
'model_name': 'BERT',
'input_size': 300,
'hidden_size': 300,
'dropout': 0.5,
'nclasses': 2, # Number of classes that this model will output
'padding_idx': -1,
'emb_grad': True, # If True the embeddings will also be trained
}

self.train: Dict[str, Any] = {
'batch_size': 100,
'nepochs': 50,
'lr': 0.001,
'test_size': 0.1,
'shuffle_data': True, # Used only during training, if set the dataset will be shuffled before train/test split
'class_weights': None,
'score_average': 'weighted', # What to use for averaging F1/P/R across labels
'prerequisites': {},
'auto_save_model': True, # Should do model be saved during training for best results
}
Loading