-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_reg.py
31 lines (21 loc) · 838 Bytes
/
run_reg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import logging
import argparse
import transformers
from utils import load
from models import Reg_FT_Configer, Reg_Trainer
transformers.logging.set_verbosity_error()
def main():
parser = argparse.ArgumentParser(description="Reg-Argparser")
parser.add_argument('--params', type=str, required=True, help="JSON dict of parameters for model training.")
args = parser.parse_args()
params = load(args.params)
logging.basicConfig(filename=params['log_path'], filemode="w",
format="%(asctime)s %(name)s:%(levelname)s:%(message)s",
datefmt="%d-%m-%Y %H:%M:%S",
level=logging.DEBUG)
logging.info(f"Params:\n{params}")
config = Reg_FT_Configer(params)
trainer = Reg_Trainer(config)
trainer.run_finetune()
if __name__ == "__main__":
main()