import pickle


def load_lens(len_file_list):
    """
    Loads the number of examples in len_file_list. This is needed for keras fit_generator
    :param len_file_list: a list of length filenames, recording number of examples in each chunk
    :return: int, total length across all files
    """
    total_len = 0
    for file_name in len_file_list:
        with open(file_name, 'rb') as f:
            len_data = pickle.load(f)
        total_len += len_data
    return total_len