mirror of https://github.com/hpcaitech/ColossalAI
Browse Source
* add cpu adam counter for all cpu adam * fixed updating error in adam kernelpull/657/head
HELSON
3 years ago
committed by
GitHub
6 changed files with 25 additions and 13 deletions
@ -0,0 +1,14 @@
|
||||
class CpuAdamCounter(object): |
||||
"""Used to record the total number of CPU Adam. |
||||
We must use it to avoid hybrid cpu adam and cpu adam using the same id. |
||||
""" |
||||
|
||||
def __init__(self): |
||||
self.number = 0 |
||||
|
||||
def __call__(self): |
||||
self.number += 1 |
||||
return self.number - 1 |
||||
|
||||
|
||||
CPU_ADAM_CNT = CpuAdamCounter() |
Loading…
Reference in new issue