fp16_utils.rst 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .. role:: hidden
  2. :class: hidden-section
  3. apex.fp16_utils
  4. ===================================
  5. This submodule contains utilities designed to streamline the mixed precision training recipe
  6. presented by NVIDIA `on Parallel Forall`_ and in GTC 2018 Sessions
  7. `Training Neural Networks with Mixed Precision: Theory and Practice`_ and
  8. `Training Neural Networks with Mixed Precision: Real Examples`_.
  9. For Pytorch users, Real Examples in particular is recommended.
  10. Full runnable Python scripts demonstrating ``apex.fp16_utils``
  11. can be found on the Github page:
  12. | `Simple FP16_Optimizer demos`_
  13. |
  14. | `Distributed Mixed Precision Training with imagenet`_
  15. |
  16. | `Mixed Precision Training with word_language_model`_
  17. |
  18. |
  19. .. _`on Parallel Forall`:
  20. https://devblogs.nvidia.com/mixed-precision-training-deep-neural-networks/
  21. .. _`Training Neural Networks with Mixed Precision: Theory and Practice`:
  22. http://on-demand.gputechconf.com/gtc/2018/video/S8923/
  23. .. _`Training Neural Networks with Mixed Precision: Real Examples`:
  24. http://on-demand.gputechconf.com/gtc/2018/video/S81012/
  25. .. _`Simple FP16_Optimizer demos`:
  26. https://github.com/NVIDIA/apex/tree/master/examples/FP16_Optimizer_simple
  27. .. _`Distributed Mixed Precision Training with imagenet`:
  28. https://github.com/NVIDIA/apex/tree/master/examples/imagenet
  29. .. _`Mixed Precision Training with word_language_model`:
  30. https://github.com/NVIDIA/apex/tree/master/examples/word_language_model
  31. .. automodule:: apex.fp16_utils
  32. .. currentmodule:: apex.fp16_utils
  33. Automatic management of master params + loss scaling
  34. ----------------------------------------------------
  35. .. autoclass:: FP16_Optimizer
  36. :members:
  37. .. autoclass:: LossScaler
  38. :members:
  39. .. autoclass:: DynamicLossScaler
  40. :members:
  41. Manual master parameter management
  42. ----------------------------------
  43. .. autofunction:: prep_param_lists
  44. .. autofunction:: master_params_to_model_params
  45. .. autofunction:: model_grads_to_master_grads