mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-09 04:50:17 +00:00
[misc] update pre-commit and run all files (#4752)
* [misc] update pre-commit * [misc] run pre-commit * [misc] remove useless configuration files * [misc] ignore cuda for clang-format
This commit is contained in:
@@ -9,7 +9,6 @@ from .base_store import BaseStore
|
||||
|
||||
|
||||
class BucketStore(BaseStore):
|
||||
|
||||
def __init__(self, torch_pg: ProcessGroup):
|
||||
super().__init__(torch_pg)
|
||||
|
||||
@@ -38,8 +37,7 @@ class BucketStore(BaseStore):
|
||||
return self._num_elements_in_bucket
|
||||
|
||||
def reset_num_elements_in_bucket(self):
|
||||
"""Set the number of elements in bucket to zero.
|
||||
"""
|
||||
"""Set the number of elements in bucket to zero."""
|
||||
|
||||
self._num_elements_in_bucket = 0
|
||||
|
||||
@@ -54,7 +52,7 @@ class BucketStore(BaseStore):
|
||||
|
||||
self._param_list.append(param)
|
||||
self._padding_size.append(padding_size)
|
||||
self._num_elements_in_bucket += (param.numel() + padding_size)
|
||||
self._num_elements_in_bucket += param.numel() + padding_size
|
||||
self.current_group_id = group_id
|
||||
|
||||
# number of tensors in current bucket
|
||||
@@ -119,8 +117,7 @@ class BucketStore(BaseStore):
|
||||
return self.grad_to_param_mapping[id(grad)]
|
||||
|
||||
def reset(self):
|
||||
"""Reset the bucket storage after reduction, only release the tensors have been reduced
|
||||
"""
|
||||
"""Reset the bucket storage after reduction, only release the tensors have been reduced"""
|
||||
cur_offset = self.offset_list.pop(0)
|
||||
self._param_list = self._param_list[cur_offset:]
|
||||
self._padding_size = self._padding_size[cur_offset:]
|
||||
|
Reference in New Issue
Block a user