Diff Coverage

Diff: origin/master...HEAD, staged and unstaged changes

Source File Diff Coverage (%) Missing Lines
hyper_parallel/data/batching/build_collate_fn.py 97.5% 293
hyper_parallel/data/batching/get_batch.py 100%  
hyper_parallel/data/batching/runtime_input.py 75.0% 52,54
hyper_parallel/data/indexed/__init__.py 100%  
hyper_parallel/data/indexed/indexed_data_config.py 75.6% 217,228-229,231-232,234-236,325,329
hyper_parallel/data/indexed/indexed_data_reader.py 100%  
hyper_parallel/data/indexed/indexed_dataset.py 100%  
hyper_parallel/data/indexed/indexed_pretrain_dataset.py 98.1% 715
hyper_parallel/data/indexed/indexed_split_builder.py 80.0% 154
hyper_parallel/data/text/build_dataset.py 100%  
hyper_parallel/trainer/config/resolver.py 100%  
hyper_parallel/data/batching/build_collate_fn.py
289
290
291
292
293
294
295
296
297
    token_rows, label_rows, boundary_rows = [], [], []
    for sample in batch:
        tokens, labels = torch.as_tensor(sample[token_key]), torch.as_tensor(sample["labels"])
        if tokens.ndim not in (1, 2) or tokens.shape != labels.shape or not tokens.numel():
            raise ValueError("SFT tokens and labels must have matching nonempty [S] or [rows, S] shapes")
        boundaries = sample["cu_seq_lens"]
        if tokens.ndim == 1:
            tokens, labels, boundaries = tokens.unsqueeze(0), labels.unsqueeze(0), [boundaries]
        if len(boundaries) != len(tokens):
hyper_parallel/data/batching/runtime_input.py
48
49
50
51
52
53
54
55
56
57
58
        batch_size, seq_len = input_ids.shape
        if "cu_seq_lens" in canonical_batch:
            rows = canonical_batch["cu_seq_lens"]
            if isinstance(rows, torch.Tensor) and rows.ndim == 1:
                return rows.to(torch.int32)
            if len(rows) != batch_size:
                raise ValueError("cu_seq_lens must have one boundary array per batch row")
            # Only metadata is flattened; tokens and labels remain [B, S].
            ends = [end + row_idx * seq_len for row_idx, row in enumerate(rows) for end in row[1:]]
            return torch.tensor([0, *ends], dtype=torch.int32)
        token_indices = torch.arange(seq_len, dtype=input_ids.dtype, device=input_ids.device)
hyper_parallel/data/indexed/indexed_data_config.py
213
214
215
216
217
218
219
220

        file_paths.extend(_discover_indexed_paths(current_path, rank, world_size, use_distributed_walk, file_suffix))

    if not file_paths:
        raise ValueError(f"data_path {data_paths!r} has no data file ending with {file_suffix}")

    if len(file_paths) == 1:
        return file_paths
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
        file_paths.sort()
    else:
        # 4. Prefer the numeric shard order encoded by the corpus filenames.
        # Unknown naming schemes remain usable in their original walk order.
        try:
            def numeric_shard_key(path: str) -> tuple[int, int]:
                """Extract numeric corpus and shard identifiers from a path."""
                path_parts = os.path.basename(path).split("_")
                return int(path_parts[2]), int(path_parts[-1])

            file_paths.sort(key=numeric_shard_key)
        except (IndexError, TypeError, ValueError):
            logger.warning("Cannot sort indexed files with the numeric filename rule; keeping walk order")

    # 5. Automatically discovered sources use equal blend weights.
    weighted_paths = [value for path in file_paths for value in ("1", path)]
    return weighted_paths
321
322
323
324
325
326
327
328
329
330
    """Resolve an explicitly selected class without constructing a Dataset."""
    if isinstance(spec, type):
        return spec
    if not isinstance(spec, Mapping) or "_target_" not in spec:
        raise ValueError("low_level_dataset requires an explicit Dataset _target_")
    module, _, name = spec["_target_"].rpartition(".")
    dataset_type = getattr(import_module(module), name)
    if not isinstance(dataset_type, type):
        raise ValueError("low_level_dataset._target_ must identify a Dataset class")
    return dataset_type
hyper_parallel/data/indexed/indexed_pretrain_dataset.py
711
712
713
714
715
716
717
718
719
        self.num_samples = num_samples
        self.config = config
        self.unique_identifiers = self.build_unique_identifiers(dataset_path, num_samples, index_split, config)
        if self.config.simple_blend not in ("inter", "intra"):
            raise ValueError("Prepared Arrow datasets require simple_blend='inter' or 'intra'")
        if self.num_samples > len(self.indices):
            raise ValueError("Requested samples exceed prepared records in this split")

    @staticmethod
hyper_parallel/data/indexed/indexed_split_builder.py
150
151
152
153
154
155
156
157
158
            raise ValueError("train_valid_test_num_samples must be non-negative")
        if blend_mode not in {"no", "inter", "intra"}:
            raise ValueError(f"Unsupported blend mode: {blend_mode!r}")
        if config.mock != (dataset_type is MockGPTDataset):
            raise ValueError("mock_data must match the selected MockGPTDataset class")
        if not config.mock and (blend_mode == "no") != (dataset_type is GPTDataset):
            raise ValueError("simple_blend='no' is only for GPTDataset; other Datasets require inter/intra")

        logger.debug(