Note that we do not design MemoryBufferModuleWrapper as an nn.Module due to - It will change the checkpoint name
| 141 | |
| 142 | |
| 143 | class MemoryBufferModuleWrapper: |
| 144 | """ |
| 145 | Note that we do not design MemoryBufferModuleWrapper as an nn.Module due to |
| 146 | - It will change the checkpoint name |
| 147 | """ |
| 148 | |
| 149 | def __init__(self, module: nn.Module): |
| 150 | super().__init__() |
| 151 | self.module = module |
| 152 | self.weight_buffer_meta = get_weight_buffer_meta_from_module(self.module) |
| 153 | self.memory_buffers = build_memory_buffer(self.weight_buffer_meta) |
| 154 | build_memory_reference_from_module(self.module, self.memory_buffers) |
| 155 | |
| 156 | def get_memory_buffers(self): |
| 157 | return self.memory_buffers |
| 158 | |
| 159 | def get_weight_buffer_meta(self): |
| 160 | return self.weight_buffer_meta |
| 161 | |
| 162 | |
| 163 | class MegatronMemoryBufferForRollout(object): |
no outgoing calls