def get_bucket_boundaries(inflation_rate: float = 1.1, inflation_offset: int = 0, min_length: int = 8,
                          max_length: int = 256, min_offset: int = 3):
    """
    Generate bucket boundaries to be used in BucketIterator. The value of inflation_rate and inflation_offset should
     be carefully picked to match the distribution of dataset. Greater value of inflation_rate or inflation_offset
     leads to sparse boundaries, which increases the chance of padding and thus reduces training efficiency;
     however, it also increases the diversity of samples in a batch and generate more diverse consecutive batches
     in terms of sample lengths. Sparse boundaries can avoid similar consecutive batches to some extent, which is
     bad for training.
    Args:
        inflation_rate:
        inflation_offset:
        min_length:
        max_length:
        min_offset:
    Returns:

    """
    if not (inflation_rate >= 1.0):
        raise ValueError(f'inflation_rate ({inflation_rate})  must be greater than 1.0.')
    if not (inflation_offset >= 0):
        raise ValueError(f'inflation_offset ({inflation_offset}) must be greater than 1.0.')

    x = min_length
    boundaries = []
    while x <= max_length:
        boundaries.append(x)
        x = max(x + min_offset, int(inflation_rate * x + inflation_offset))
    return boundaries