def slice_into_ngrams(tokenized_dataset, ngram_order=5):
    """This function slices the input sequence into ngrams, e.g:
            [0,1,2,3,4,5] with `ngram_order=2` will be sliced into bigrams:
            [0,1], [1,2], [2,3], [3,4], [4,5]."""
    sliced_datasets = {}
    for split, dataset in tokenized_dataset.items():
        _list_of_sliced_ngrams = []
        for seq in dataset:
            ngrams = [seq[i:i+ngram_order] for i in range(len(seq)-ngram_order+1)]
            _list_of_sliced_ngrams.extend(ngrams)
        sliced_datasets[split] = _list_of_sliced_ngrams
    return sliced_datasets