Added verbosity level

This commit is contained in:
Christian Risi 2025-10-12 00:13:03 +02:00
parent acd978cbc5
commit f51ada866f

View File

@ -51,6 +51,7 @@ VALIDATION_STEPS = 50
CHECKPOINT_STEPS = VALIDATION_STEPS * 4
PATIENCE = 4
CURRENT_EPOCH = 0
VERBOSE = False
SOS_TOKEN = TOKENANO.encode("<SOS>")[0]
@ -125,7 +126,8 @@ while current_epoch < MAX_EPOCHS:
batch_counter = 0
print(f"EPOCH {current_epoch} STARTING")
if VERBOSE:
print(f"EPOCH {current_epoch} STARTING")
for batch in TRAIN_BATCHER.batch(MINI_BATCH_SIZE):
@ -146,7 +148,8 @@ while current_epoch < MAX_EPOCHS:
dec_x[:, 1:] = tgt[:, :-1]
dec_x_pad = dec_x.eq(PAD_TOKEN)
print(f"\tBATCH {batch_counter} Starting")
if VERBOSE:
print(f"\tBATCH {batch_counter} Starting")
# Task 1 and Task 2
if tasktype == Batch.TaskType.RDF2TXT or tasktype == Batch.TaskType.TEXT2RDF:
@ -173,7 +176,8 @@ while current_epoch < MAX_EPOCHS:
# Task 3
if tasktype == Batch.TaskType.MASKING:
print(f"\tExecuting TASK 3 - BATCH {batch_counter}")
if VERBOSE:
print(f"\tExecuting TASK 3 - BATCH {batch_counter}")
encoder_only_optim.zero_grad()
@ -192,7 +196,8 @@ while current_epoch < MAX_EPOCHS:
# Task 4
if tasktype == Batch.TaskType.COMPLETATION:
print(f"\tExecuting TASK 4 - BATCH {batch_counter}")
if VERBOSE:
print(f"\tExecuting TASK 4 - BATCH {batch_counter}")
decoder_only_optim.zero_grad()