MCPcopy Create free account
hub / github.com/tensorflow/datasets / _make_file_instructions

Function _make_file_instructions

tensorflow_datasets/core/splits.py:569–601  ·  view source on GitHub ↗

Returns file instructions by applying the given instruction on the given splits. Args: split_infos: Dataset splits information instruction: `ReadInstruction` or `str` Returns: List of FileInstruction instances

(
    split_infos: Sequence[SplitInfo],
    instruction: SplitArg,
)

Source from the content-addressed store, hash-verified

567
568
569def _make_file_instructions(
570 split_infos: Sequence[SplitInfo],
571 instruction: SplitArg,
572) -> list[shard_utils.FileInstruction]:
573 """Returns file instructions by applying the given instruction on the given splits.
574
575 Args:
576 split_infos: Dataset splits information
577 instruction: `ReadInstruction` or `str`
578
579 Returns:
580 List of FileInstruction instances
581 """
582
583 # TODO(epot): Should try to merge the instructions together as well as
584 # performing additional validation. For example, should raise an error
585 # if there is overlap between splits (`train[:50]+train[:25]`)
586 # If there is a single shard, `train[:25]+train[50:75]` could be optimized
587 # into a single `ds.take(25).skip(50-25).take(75-50)`
588
589 absolute_instructions = _make_absolute_instructions(
590 split_infos=split_infos, instruction=instruction
591 )
592 instructions = []
593 info_per_split = {split_info.name: split_info for split_info in split_infos}
594 for abs_instr in absolute_instructions:
595 split_info = info_per_split[str(abs_instr.splitname)]
596 instructions.extend(
597 _file_instructions_for_split(
598 instruction=abs_instr, split_info=split_info
599 )
600 )
601 return instructions
602
603
604class AbstractSplit(abc.ABC):

Callers 2

file_instructionsMethod · 0.85
__getitem__Method · 0.85

Calls 2

Tested by

no test coverage detected