80 lines
1.9 KiB
Python
80 lines
1.9 KiB
Python
|
# GLOBAL VARS
|
||
|
DEVICE = "cuda:0"
|
||
|
IGNORE_KIE_LABEL = "others"
|
||
|
KIE_LABELS = [
|
||
|
"id",
|
||
|
"name",
|
||
|
"dob",
|
||
|
"home",
|
||
|
"add",
|
||
|
"sex",
|
||
|
"nat",
|
||
|
"exp",
|
||
|
"eth",
|
||
|
"rel",
|
||
|
"date",
|
||
|
"org",
|
||
|
IGNORE_KIE_LABEL,
|
||
|
]
|
||
|
|
||
|
SEED = 42
|
||
|
NAME_LABEL = "microsoft/layoutxlm-base"
|
||
|
|
||
|
##########################################
|
||
|
BASE_CONFIG = {
|
||
|
"global": {
|
||
|
"device": DEVICE,
|
||
|
"kie_labels": KIE_LABELS,
|
||
|
},
|
||
|
"data": {
|
||
|
"custom": True,
|
||
|
"path": "src/custom/load_data.py",
|
||
|
"method": "load_data",
|
||
|
"train_path": "/home/sds/hoangmd/TokenClassification_copy/giaykhaisinh/synthesis_for_train/",
|
||
|
"val_path": "/home/sds/hoangmd/TokenClassification_copy/giaykhaisinh/SDV_Meddoc_BirthCert/",
|
||
|
"max_seq_len": 512,
|
||
|
"batch_size": 8,
|
||
|
"pretrained_processor": NAME_LABEL ,
|
||
|
"kie_labels": KIE_LABELS,
|
||
|
"device": DEVICE,
|
||
|
},
|
||
|
"model": {
|
||
|
"custom": True,
|
||
|
"path": "src/custom/load_model.py",
|
||
|
"method": "load_model",
|
||
|
"pretrained_model": NAME_LABEL,
|
||
|
"kie_labels": KIE_LABELS,
|
||
|
"device": DEVICE,
|
||
|
},
|
||
|
"optimizer": {
|
||
|
"custom": True,
|
||
|
"path": "src/custom/load_optimizer.py",
|
||
|
"method": "load_optimizer",
|
||
|
"lr": 5e-6,
|
||
|
"weight_decay": 0,
|
||
|
"betas": (0.9, 0.999),
|
||
|
},
|
||
|
"trainer": {
|
||
|
"custom": True,
|
||
|
"path": "src/custom/load_trainer.py",
|
||
|
"method": "load_trainer",
|
||
|
"kie_labels": KIE_LABELS,
|
||
|
"save_dir": "weights",
|
||
|
"n_epoches": 100,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
ID_CARD = BASE_CONFIG
|
||
|
ID_CARD["data"] = {
|
||
|
"custom": True,
|
||
|
"path": "src/custom/load_data_id_card.py",
|
||
|
"method": "load_data",
|
||
|
"train_path": "/home/sds/hungbnt/KIE_pretrained/data/207/idcard_cmnd_8-9-2022",
|
||
|
"label_path": "/home/sds/hungbnt/KIE_pretrained/data/207/label/",
|
||
|
"max_seq_len": 512,
|
||
|
"batch_size": 8,
|
||
|
"pretrained_processor": NAME_LABEL,
|
||
|
"kie_labels": KIE_LABELS,
|
||
|
"device": DEVICE,
|
||
|
}
|