File size: 780 Bytes
3883c60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
max_token = 10000  # Only change this for custom bark models with different vocab sizes


def chunks(lst, n):
    """Yield successive n-sized chunks from lst."""
    for i in range(0, len(lst), n):
        yield lst[i:i + n]


def split(lst, size):
    return list(chunks(lst, size))


def linear_full():
    return list(range(0, max_token))


def linear_split(size):
    return split(linear_full(), size)


def shuffle_full():
    import random
    _list = list(range(0, max_token))
    random.shuffle(_list)
    return _list


def shuffle_split(size):
    return split(shuffle_full(), size)


def random(count):
    import random
    return [random.randint(0, max_token-1) for i in range(count)]


def random_chunks(count, size):
    return [random(size) for i in range(count)]