New Features
Engine
- Added Engine interrupt/continue feature (2699, 2682)
Example:
python
from ignite.engine import Engine, Events
data = range(10)
max_epochs = 3
def check_input_data(e, b):
print(f"Epoch {engine.state.epoch}, Iter {engine.state.iteration} | data={b}")
i = (e.state.iteration - 1) % len(data)
assert b == data[i]
engine = Engine(check_input_data)
engine.on(Events.ITERATION_COMPLETED(every=11))
def call_interrupt():
engine.interrupt()
print("Start engine run with interruptions:")
state = engine.run(data, max_epochs=max_epochs)
print("1 Engine run is interrupted at ", state.epoch, state.iteration)
state = engine.run(data, max_epochs=max_epochs)
print("2 Engine run is interrupted at ", state.epoch, state.iteration)
state = engine.run(data, max_epochs=max_epochs)
print("3 Engine ended the run at ", state.epoch, state.iteration)
<details>
<summary>
Output
</summary>
Start engine run with interruptions:
Epoch 1, Iter 1 | data=0
Epoch 1, Iter 2 | data=1
Epoch 1, Iter 3 | data=2
Epoch 1, Iter 4 | data=3
Epoch 1, Iter 5 | data=4
Epoch 1, Iter 6 | data=5
Epoch 1, Iter 7 | data=6
Epoch 1, Iter 8 | data=7
Epoch 1, Iter 9 | data=8
Epoch 1, Iter 10 | data=9
Epoch 2, Iter 11 | data=0
1 Engine run is interrupted at 2 11
Epoch 2, Iter 12 | data=1
Epoch 2, Iter 13 | data=2
Epoch 2, Iter 14 | data=3
Epoch 2, Iter 15 | data=4
Epoch 2, Iter 16 | data=5
Epoch 2, Iter 17 | data=6
Epoch 2, Iter 18 | data=7
Epoch 2, Iter 19 | data=8
Epoch 2, Iter 20 | data=9
Epoch 3, Iter 21 | data=0
Epoch 3, Iter 22 | data=1
2 Engine run is interrupted at 3 22
Epoch 3, Iter 23 | data=2
Epoch 3, Iter 24 | data=3
Epoch 3, Iter 25 | data=4
Epoch 3, Iter 26 | data=5
Epoch 3, Iter 27 | data=6
Epoch 3, Iter 28 | data=7
Epoch 3, Iter 29 | data=8
Epoch 3, Iter 30 | data=9
3 Engine ended the run at 3 30
</details>
- Deprecated and replaced `Events.default_event_filter` with None (2644)
- [**BC-breaking**] Rewritten Engine's `terminate` and `terminate_epoch` logic (2645)
- Improved logging time taken message showing milliseconds (2650)
Metrics and handlers
- Added ZeRO built-in support to `Checkpoint` in a distributed configuration (2658, 2642)
- Added `save_on_rank` argument to `DiskSaver` and `Checkpoint` (2641)
- Added a `handle_buffers` option for `EMAHandler` (2592)
- Improved Precision and Recall metrics (2573)
Bug fixes
- Median metrics (e.g median absolute error) are now using `np.median`-compatible torch median implementation (2681)
- Fixed issues when removing handlers on filtered events (2690)
- Few minor fixes in Engine and Event (2680)
- [**BC-breaking**] Fixed `Engine.terminate()` behaviour when resumed (2678)
Housekeeping (docs, CI, examples, tests, etc)
- 2700, 2698, 2696, 2695, 2694, 2691, 2688, 2679, 2676, 2675, 2673, 2671, 2670, 2668, 2667, 2666, 2665, 2664, 2662, 2660, 2659, 2657, 2656, 2655, 2653, 2652, 2651, 2647, 2646, 2640, 2639, 2637, 2630, 2629, 2628, 2625, 2624, 2620, 2618, 2617, 2616, 2613, 2611, 2609, 2606, 2605, 2604, 2601, 2597, 2584, 2581, 2542
- Metrics tests improvements in DDP configuration
Acknowledgments
🎉 Thanks to our community and all our contributors for the issues, PRs and 🌟 ⭐️ 🌟 !
💯 We really appreciate your implication into the project (in alphabetical order):
BowmanChow, daniellepintz, haochunchang, kamalojasv181, puhuk, sadra-barikbin, sandylaker, sdesrozis, vfdev-5