(
self,
net,
param_init_net,
iter_val=0,
)
| 184 | return lr, iteration |
| 185 | |
| 186 | def build_non_lr_iter( |
| 187 | self, |
| 188 | net, |
| 189 | param_init_net, |
| 190 | iter_val=0, |
| 191 | ): |
| 192 | assert ( |
| 193 | self._use_dedicated_lr_iteration_counter |
| 194 | ), "This method should be only called when dedicated learning rate iteration counter is used." |
| 195 | |
| 196 | iteration = utils.BuildUniqueMutexIter(param_init_net, net, iter_val=iter_val) |
| 197 | logger.info(f"Created iteration counter for non learning rate purposes: {iteration}") |
| 198 | |
| 199 | # We need to create a dummy learning rate operator to enforce that |
| 200 | # iteration counter blob being placed in the trainer nodes. Otherwise, |
| 201 | # the Automatic Device Placement (ADP) algorithm for Hierachical |
| 202 | # Training (HT) will encounter issues to distribute blobs across group |
| 203 | # parameter servers. Note that this learning rate operator will not be |
| 204 | # used for any other purpose. |
| 205 | learning_rate_blob = self.make_unique_blob_name("iter_placement_hint") |
| 206 | if not net.BlobIsDefined(learning_rate_blob): |
| 207 | net.LearningRate( |
| 208 | [iteration], |
| 209 | learning_rate_blob, |
| 210 | base_lr=1.0, |
| 211 | policy="fixed", |
| 212 | ) |
| 213 | |
| 214 | return iteration |
| 215 | |
| 216 | def add_lr_multiplier(self, lr_multiplier): |
| 217 | """ |
no test coverage detected