Skip to content

Commit

Permalink
Apply isort and black reformatting
Browse files Browse the repository at this point in the history
Signed-off-by: ananthsub <[email protected]>
  • Loading branch information
ananthsub committed Nov 25, 2024
1 parent 40a00a0 commit 426ad90
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nemo/lightning/io/pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ def save_checkpoint(self, checkpoint: Dict[str, Any], path: _PATH, storage_optio
validate_sharding_integrity = not (self.validated_consistency and self.assume_constant_structure)
self.validated_consistency = True

consistency_check = _skip_optimizer_states_before_consistancy_check if validate_sharding_integrity else _noop_preprocess_common_before_consistancy_check
consistency_check = (
_skip_optimizer_states_before_consistancy_check
if validate_sharding_integrity

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable Error

Local variable 'validate_sharding_integrity' may be used before it is initialized.
else _noop_preprocess_common_before_consistancy_check
)

return dist_checkpointing.save(
sharded_state_dict=checkpoint,
Expand Down Expand Up @@ -337,5 +341,6 @@ def _skip_optimizer_states_before_consistancy_check(state_dict: Dict[str, Any])
sd.pop("optimizer_states", None)
return sd


def _noop_preprocess_common_before_consistancy_check(state_dict: Dict[str, Any]) -> Dict[str, Any]:
return state_dict
return state_dict

0 comments on commit 426ad90

Please sign in to comment.