Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
irenedea committed May 2, 2024
1 parent 537a60c commit 33db8c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions composer/utils/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def _get_checkpoint_validation_function() -> Optional[Callable[[Union[Path, str]
return fn


def _ensure_valid_checkpoint(checkpoint_filepath: Union[Path, str], specs: Optional[List[Tuple[int,int]]]=None) -> Union[Path, str]:
def _ensure_valid_checkpoint(checkpoint_filepath: Union[Path, str],
specs: Optional[List[Tuple[int, int]]] = None) -> Union[Path, str]:
"""Ensures that the checkpoint at checkpoint_filepath is valid.
using the function specified by the CHECKPOINT_VALIDATION_FUNCTION environment variable.
Expand Down Expand Up @@ -170,9 +171,9 @@ def read_data(self, plan: LoadPlan, planner: LoadPlanner):
Raises:
ValueError if the data file is invalid.
"""
path_to_specs: Dict[str, List[Tuple[int, int]]] = dict()
path_to_specs: Dict[str, List[Tuple[int, int]]] = {}
for read_item in plan.items:
item_md = self.storage_data[read_item.storage_index]
item_md = self.storage_data[read_item.storage_index]
path = os.path.join(self.path, item_md.relative_path)
path_to_specs.setdefault(path, []).append((item_md.offset, item_md.length))
for path, spec in path_to_specs.items():
Expand Down

0 comments on commit 33db8c0

Please sign in to comment.