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

Ddp #24

Open
wants to merge 89 commits into
base: master
Choose a base branch
from
Open

Ddp #24

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
c4a3004
Modification
TCBpenta8 May 4, 2021
b7a2dde
Modification
TCBpenta8 May 4, 2021
4d926bf
Modification
TCBpenta8 May 4, 2021
2b71ae8
Modification
TCBpenta8 May 4, 2021
f5cea7f
Modification
TCBpenta8 May 5, 2021
bdeb030
Modification
TCBpenta8 May 5, 2021
00a70f5
modification
TCBpenta8 May 6, 2021
444c2eb
Modification
TCBpenta8 May 6, 2021
dc5a16d
Modification
TCBpenta8 May 6, 2021
edd1460
Modification
TCBpenta8 May 6, 2021
d2e5123
Add Experiments Folders
TCBpenta8 May 12, 2021
774d665
Update xtransformer.py
PLCarles May 20, 2021
7d311c6
Create mlclassifier.py
PLCarles May 20, 2021
c27247d
Update main.py
PLCarles May 20, 2021
6f35f7c
Update xtransformer.py
PLCarles May 20, 2021
df44a6c
Update main.py
PLCarles May 20, 2021
1620b5c
Update __init__.py
PLCarles May 20, 2021
adca4ca
Update xtransformer.py
PLCarles May 20, 2021
c3dcaba
Update xtransformer.py
PLCarles May 20, 2021
48a6798
Update main.py
PLCarles May 20, 2021
58e232d
Update xtransformer.py
PLCarles May 20, 2021
dcfc767
Update xtransformer.py
PLCarles May 20, 2021
f1dd5a6
Update main.py
PLCarles May 20, 2021
0fe77b3
Update __init__.py
PLCarles May 20, 2021
e72730f
Update xtransformer.py
PLCarles May 20, 2021
4f8154c
Update __init__.py
PLCarles May 20, 2021
029ac49
Update __init__.py
PLCarles May 20, 2021
1a8367c
Update xtransformer.py
PLCarles May 20, 2021
cf32da0
Update xtransformer.py
PLCarles May 20, 2021
be37676
Update main.py
PLCarles May 20, 2021
0d209dc
Update optimizer.py
PLCarles May 20, 2021
b6b5908
Update xtransformer.py
PLCarles May 20, 2021
6aff45e
Update xtransformer.py
PLCarles May 20, 2021
ce9a0a2
Update xtransformer.py
PLCarles May 20, 2021
ccaad24
Update xtransformer.py
PLCarles May 20, 2021
9d22cd5
Update data_loader.py
PLCarles May 22, 2021
80ca0f7
Update xtransformer.py
PLCarles May 22, 2021
495ce27
Update evaler.py
PLCarles May 22, 2021
8463497
Update main.py
PLCarles May 22, 2021
dc5c6ea
Update data_loader.py
PLCarles May 22, 2021
bad932d
Update xtransformer.py
PLCarles May 22, 2021
c31ba3e
Update config.yml
PLCarles May 23, 2021
972de73
Update radiology_dataset.py
PLCarles May 24, 2021
d5a91a7
Update radiology_dataset.py
PLCarles May 24, 2021
2dac043
Update radiology_dataset.py
PLCarles May 24, 2021
53e9be7
Update radiology_dataset.py
PLCarles May 24, 2021
10b3b2c
Update radiology_dataset.py
PLCarles May 24, 2021
676d379
Update main.py
PLCarles May 24, 2021
0d603f1
Update data_loader.py
PLCarles May 24, 2021
6b53e56
Update xtransformer.py
PLCarles May 25, 2021
d7b13cc
Merge pull request #1 from PLCarles/master
TCBpenta8 May 25, 2021
7f5f18b
Update main.py
PLCarles May 25, 2021
ab0246b
Update xtransformer.py
PLCarles May 25, 2021
c15fba3
Update mlclassifier.py
PLCarles May 25, 2021
4f5332b
Update xtransformer.py
PLCarles May 25, 2021
f010f47
Update main.py
PLCarles May 25, 2021
3007238
Update train.sh
PLCarles May 28, 2021
b05b9f6
Update train.sh
PLCarles May 28, 2021
9ad3020
Update config.yml
PLCarles May 29, 2021
5476d03
Update main.py
PLCarles Jun 1, 2021
c8f4a8d
Add files via upload
PLCarles Jun 1, 2021
97df977
Update train.sh
PLCarles Jun 1, 2021
e26dde9
Add files via upload
PLCarles Jun 1, 2021
9dd257e
Delete train.sh
PLCarles Jun 1, 2021
d86229c
Add files via upload
PLCarles Jun 1, 2021
c7aae9a
Update train.sh
PLCarles Jun 1, 2021
ccd38ed
Update main.py
PLCarles Jun 1, 2021
ecfe6bc
Update config.yml
PLCarles Jun 1, 2021
d870553
Update main.py
PLCarles Jun 1, 2021
fdbfa06
Update data_loader.py
PLCarles Jun 1, 2021
1db4bd4
Update data_loader.py
PLCarles Jun 1, 2021
a1e656d
Update train.sh
PLCarles Jun 1, 2021
82e8139
Update train.sh
PLCarles Jun 1, 2021
093712c
Update config.yml
PLCarles Jun 1, 2021
1e93c1d
Update train.sh
PLCarles Jun 2, 2021
84ff52b
Update config.yml
PLCarles Jun 2, 2021
529f986
Update config.yml
PLCarles Jun 2, 2021
8454938
Update xtransformer.py
PLCarles Jun 2, 2021
d69eeb5
Update train.sh
PLCarles Jun 5, 2021
e2ab239
Update train.sh
PLCarles Jun 5, 2021
0a47198
Update train.sh
PLCarles Jun 5, 2021
0e86131
Merge pull request #2 from PLCarles/master
TCBpenta8 Jun 5, 2021
9cc2496
Optimization. DWE
TCBpenta8 Jun 6, 2021
b3173b3
update
TCBpenta8 Jun 6, 2021
f418faa
training ratio
TCBpenta8 Jun 9, 2021
0778ec4
ddp
TCBpenta8 Jun 13, 2021
d70b8ac
update kg path loading method
TCBpenta8 Jun 13, 2021
120abcc
ddp update
TCBpenta8 Jun 13, 2021
14dbe0f
update ddp
TCBpenta8 Jun 13, 2021
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/image-captioning.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 87 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

144 changes: 144 additions & 0 deletions artimes_experiments/iuxray_rgmg/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
LOGGER_NAME: 'log'
SEED: 1546884941.160048

############################ TRAIN ############################
TRAIN:
BATCH_SIZE: 16
#################### REINFORCEMENT ####################
REINFORCEMENT:
START: 9999

############################ TEST ############################
TEST:
BATCH_SIZE: 16

############################ DATA_LOADER ############################
DATA_LOADER:
NUM_WORKERS: 4
SHUFFLE: True
TRAIN_GV_FEAT: ''
TRAIN_ATT_FEATS: './mscoco/feature/up_down_100'
VAL_GV_FEAT: ''
VAL_ATT_FEATS: './mscoco/feature/up_down_100'
TEST_GV_FEAT: ''
TEST_ATT_FEATS: './mscoco/feature/up_down_100'
TRAIN_ID: './mscoco/txt/coco_train_image_id.txt'
VAL_ID: './mscoco/txt/coco_val_image_id.txt'
TEST_ID: './mscoco/txt/coco_test_image_id.txt'
INPUT_SEQ_PATH: './mscoco/sent/coco_train_input.pkl'
TARGET_SEQ_PATH: './mscoco/sent/coco_train_target.pkl'
SEQ_PER_IMG: 1
MAX_FEAT: 50

############################ MODEL ############################
MODEL:
TYPE: 'XTransformer'
SEQ_LEN: 60 # Modified # include <EOS>/<BOS>
VOCAB_SIZE: 760 # TODO # exclude <EOS>/<BOS> IUXRAY: 760
########## word embedding ##########
WORD_EMBED_DIM: 768
WORD_EMBED_ACT: 'CELU'
WORD_EMBED_NORM: False
DROPOUT_WORD_EMBED: 0.1
########## global features ##########
GVFEAT_DIM: 2048
GVFEAT_EMBED_DIM: -1
GVFEAT_EMBED_ACT: 'NONE'
DROPOUT_GV_EMBED: 0.0
########## attention features ##########
ATT_FEATS_DIM: 1024 # Modified
ATT_FEATS_EMBED_DIM: 768
ATT_FEATS_EMBED_ACT: 'CELU'
DROPOUT_ATT_EMBED: 0.5
ATT_FEATS_NORM: True
########## attention param ##########
ATT_HIDDEN_SIZE: -1
ATT_HIDDEN_DROP: 0.0
ATT_ACT: 'TANH'
########## rnn param ##########
RNN_SIZE: 1024
DROPOUT_LM: 0.5

########## BOTTOM_UP ##########
BOTTOM_UP:
DROPOUT_FIRST_INPUT: 0.0
DROPOUT_SEC_INPUT: 0.0

########## BILINEAR ##########
BILINEAR:
DIM: 768
ENCODE_ATT_MID_DIM: [96, 48, 96]
DECODE_ATT_MID_DIM: [96, 48, 96]
ENCODE_ATT_MID_DROPOUT: 0.1
DECODE_ATT_MID_DROPOUT: 0.1
ATT_DIM: 768
ACT: 'CELU'
ENCODE_DROPOUT: 0.5
DECODE_DROPOUT: 0.5
ENCODE_LAYERS: 6
DECODE_LAYERS: 6
TYPE: 'LowRank'
ATTTYPE: 'SCAtt' # SCAtt, BasicAtt
HEAD: 8
ENCODE_FF_DROPOUT: 0.5
DECODE_FF_DROPOUT: 0.5
ELU_ALPHA: 1.3
BIFEAT_EMB_ACT: 'RELU'
ENCODE_BIFEAT_EMB_DROPOUT: 0.3
DECODE_BIFEAT_EMB_DROPOUT: 0.3

############################ SOLVER ############################
SOLVER:
BASE_LR: 0.000001
TYPE: 'RADAM' # 'ADAM', 'SGD', 'RADAM'
MAX_EPOCH: 20
MAX_ITER: -1
GRAD_CLIP: 0.1 # Norm:0.5 , Clamp:0.1
GRAD_CLIP_TYPE: 'Clamp' # 'Clamp' , 'Norm'
WEIGHT_DECAY: 0.0000
WEIGHT_DECAY_BIAS: 0.0
BIAS_LR_FACTOR: 1
DISPLAY: 100
TEST_INTERVAL: 1
SNAPSHOT_ITERS: 1

########## SGD ##########
SGD:
MOMENTUM: 0.9
########## ADAM ##########
ADAM:
BETAS: [0.9, 0.98]
EPS: 1.0e-9
########## LR_POLICY ##########
LR_POLICY:
TYPE: 'Noam' # 'Fix', 'Step', 'Noam', 'Plateau'
GAMMA: 0.8
STEP_SIZE: 3
SETP_TYPE: 'Iter' # 'Epoch', 'Iter'
WARMUP: 10000 # For Noam only
FACTOR: 1.0 # For Noam only
MODEL_SIZE: 768 # For Noam only

############################ LOSSES ############################
LOSSES:
XE_TYPE: 'LabelSmoothing' # 'CrossEntropy', 'LabelSmoothing'
LABELSMOOTHING: 0.1
RL_TYPE: 'RewardCriterion'

############################ SCORER ############################
SCORER:
TYPES: ['CIDEr']
WEIGHTS: [1.0]
GT_PATH: './mscoco/misc/coco_train_gts.pkl'
CIDER_CACHED: './mscoco/misc/coco_train_cider.pkl'

############################ INFERENCE ############################
INFERENCE:
VOCAB: './mscoco/txt/coco_vocabulary.txt'
ID_KEY: 'image_id'
CAP_KEY: 'caption'
EVAL: 'COCO'
VAL_ANNFILE: './mscoco/misc/captions_val5k.json'
TEST_ANNFILE: './mscoco/misc/captions_test5k.json'
BEAM_SIZE: 2
GREEDY_DECODE: True
7 changes: 7 additions & 0 deletions artimes_experiments/iuxray_rgmg/train.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#CUDA_VISIBLE_DEVICES=0 -m torch.distributed.launch --nproc_per_node=1
python3 main.py --folder ./artimes_experiments/iuxray_rgmg --resume 0 --submodel rgmg --KG_path /project/CVML/pretrained_kg/rgmg_iuxray_pretrain.pth --dataset_name IUXRAY --image_dir /project/CVML/Parallel-R2Gen-KG/data/iu_xray/images/ --ann_path /project/CVML/Parallel-R2Gen-KG/data/iuxray/annotation.json




###if you want to use checkpoint, download your model in experiments_mimiccxr/xtransformer/snapshot and change 0 to your model's number
19 changes: 19 additions & 0 deletions datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from datasets.coco_dataset import CocoDataset
from datasets.radiology_dataset import IUXRAY
from datasets.radiology_dataset import MIMICCXR
from datasets.radiology_dataset import MimiccxrMultiImage

__factory = {
'IUXRAY': IUXRAY,
'MIMICCXR': MIMICCXR,
'MIMICCXR_MultiImages': MimiccxrMultiImage,
'COCO': CocoDataset,
}

def names():
return sorted(__factory.keys())

def create(name, *args, **kwargs):
if name not in __factory:
raise KeyError("Unknown Dataset:", name)
return __factory[name](*args, **kwargs)
Loading