def get_model_numel(model: torch.nn.Module) -> tuple[int, int]:
    """
    Get the number of parameters in a model.

    Args:
        model (torch.nn.Module): The model.

    Returns:
        tuple[int, int]: The total number of parameters and the number of trainable parameters.
    """
    num_params = 0
    num_params_trainable = 0
    for p in model.parameters():
        num_params += p.numel()
        if p.requires_grad:
            num_params_trainable += p.numel()
    return num_params, num_params_trainable

    Get the number of parameters in a model.

    Args:
        model (torch.nn.Module): The model.

    Returns:
        tuple[int, int]: The total number of parameters and the number of trainable parameters.
    
opensora/utils/misc.py