microsoft / binder

MIT License
88 stars 20 forks source link

Fix bug with EarlyStoppingCallback when do_eval is set to False, minor refactoring #13

Open poteminr opened 8 months ago

poteminr commented 8 months ago

Fix bug with EarlyStoppingCallback when do_eval is set to False

EarlyStoppingCallback can be used if validation_file, save_strategy policy were provided, load_best_model_at_end was set to True, and so on.

AssertionError: EarlyStoppingCallback requires IntervalStrategy of steps or epoch

Otherwise, we should set callbacks in BinderTrainer to None.

HF DefaultFlowCallback will be use by default (source).

Minor refactoring

  1. Remove repeated lines, add spaces (src/config.py)
  2. initialize batch dict at once with the values (src/trainer.py)
  3. Remove unusedstart_negative_mask, end_negative_mask, span_negative_mask = [], [], []. This variables initialized below with a tensors (src/trainer.py)
poteminr commented 8 months ago

@microsoft-github-policy-service agree

poteminr commented 7 months ago

@sheng-z Hi! Can you review my PR?