Diff Coverage

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

Source File Diff Coverage (%) Missing Lines
hyper_parallel/compile/passes/parallel/fsdp_pass.py 100%  
hyper_parallel/compile/tracer/graph_tracer.py 30.0% 263-269
hyper_parallel/compile/trainer.py 88.9% 356,387
hyper_parallel/compile/tracer/graph_tracer.py
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
    tensors' storage for the lifetime of training.
    """
    if isinstance(x, torch.Tensor):
        return {"shape": tuple(x.shape), "dtype": str(x.dtype)}
    if isinstance(x, tuple):
        return tuple(_input_meta(v) for v in x)
    if isinstance(x, list):
        return [_input_meta(v) for v in x]
    if isinstance(x, dict):
        return {k: _input_meta(v) for k, v in x.items()}
    return x


def trace_model_graph(
    model: torch.nn.Module,
hyper_parallel/compile/trainer.py
352
353
354
355
356
357
358
359
360
        trainable = self._trainable_params_in_state_order(
            self._joint_graph.state_fqns, state_is_param, fqn_to_param
        )
        if len(trainable) != len(grads):
            raise ValueError(
                f"Gradient count ({len(grads)}) does not match trainable "
                f"parameter count ({len(trainable)}). The traced graph and "
                f"the live model disagree on which parameters are trainable; "
                f"refusing to assign gradients to avoid silent misalignment."
383
384
385
386
387
388
389
390
391
        """
        trainable: List[torch.nn.Parameter] = []
        for idx, fqn in enumerate(state_fqns):
            if state_is_param is not None and not state_is_param[idx]:
                continue
            param = fqn_to_param.get(fqn)
            if param is not None and param.requires_grad:
                trainable.append(param)
        return trainable