def get_state_dict_dtype(state_dict):
    """
    Returns the first found floating dtype in `state_dict` if there is one, otherwise returns the first dtype.
    """
    for t in state_dict.values():
        if t.is_floating_point():
            return t.dtype

    # if no floating dtype was found return whatever the first dtype is
    else:
        return next(state_dict.values()).dtype

    Returns the first found floating dtype in `state_dict` if there is one, otherwise returns the first dtype.
    
dpkd/transformers/src/transformers/modeling_utils.py