Spaces:
No application file
No application file
Download example_semantic_gens.py from mrtroydev/audio-webui: direct link, hf CLI and curl.
- Browser
- Download file 780 Bytes
-
https://huggingface.co/spaces/mrtroydev/audio-webui/resolve/main/example_semantic_gens.py
- Command line
-
hf download hf://spaces/mrtroydev/audio-webui/example_semantic_gens.py
-
curl -L -o example_semantic_gens.py https://huggingface.co/spaces/mrtroydev/audio-webui/resolve/main/example_semantic_gens.py
780 Bytes
| 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)] | |