Skip to content

Commit

Permalink
remove intent req slot loss
Browse files Browse the repository at this point in the history
  • Loading branch information
Jie.Cao committed Nov 4, 2020
1 parent 09aa539 commit 61802dd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PER_GPU_TRAIN_BATCH_SIZE=16
# num_train_epochs
NUM_TRAIN_EPOCHS=10
# learning_rate
LEARNING_RATE=2e-5
LEARNING_RATE=5e-5
# gradient_accumulation_steps
GRADIENT_ACCUMULATION_STEPS=8
# logging_steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PER_GPU_TRAIN_BATCH_SIZE=16
# num_train_epochs
NUM_TRAIN_EPOCHS=10
# learning_rate
LEARNING_RATE=2e-5
LEARNING_RATE=5e-5
# gradient_accumulation_steps
GRADIENT_ACCUMULATION_STEPS=8
# logging_steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PER_GPU_TRAIN_BATCH_SIZE=16
# num_train_epochs
NUM_TRAIN_EPOCHS=10
# learning_rate
LEARNING_RATE=2e-5
LEARNING_RATE=5e-5
# gradient_accumulation_steps
GRADIENT_ACCUMULATION_STEPS=8
# logging_steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PER_GPU_TRAIN_BATCH_SIZE=16
# num_train_epochs
NUM_TRAIN_EPOCHS=10
# learning_rate
LEARNING_RATE=2e-5
LEARNING_RATE=5e-5
# gradient_accumulation_steps
GRADIENT_ACCUMULATION_STEPS=8
# logging_steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PER_GPU_TRAIN_BATCH_SIZE=16
# num_train_epochs
NUM_TRAIN_EPOCHS=10
# learning_rate
LEARNING_RATE=2e-5
LEARNING_RATE=5e-5
# gradient_accumulation_steps
GRADIENT_ACCUMULATION_STEPS=8
# logging_steps
Expand Down
11 changes: 10 additions & 1 deletion src/run_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ def train(args, config, train_dataset, model, processor):
losses = outputs[1]
tmp_loss_dict = {}
for loss_name, loss in losses.items():
if "multiwoz" in args.dataset_config.name and ("intent" in loss_name or "requested_slot" in loss_name):
continue
if isinstance(loss, torch.Tensor):
loss = loss.sum()
tb_writer.add_scalar(loss_name, loss, global_step)
Expand All @@ -347,7 +349,14 @@ def train(args, config, train_dataset, model, processor):
# )
# )

loss = sum(losses.values())
if "multiwoz" in args.dataset_config.name:
loss = 0.0
for loss_name, value in losses.items():
if "intent" in loss_name or "requested_slot" in loss_name:
continue
loss = loss + value
else:
loss = sum(losses.values())
# loss = losses["span_start_loss"] + losses["span_end_loss"] + losses["noncat_slot_status_loss"]

if args.n_gpu > 1:
Expand Down

0 comments on commit 61802dd

Please sign in to comment.