I still have to read this through, but can't this "sharding" be reduced to `SequenceKFold` somehow? It looks awfully similar.