Vansh Chugh commited on
Commit
ff7b988
·
1 Parent(s): 90d804a

vendor jukebox+sheetsage source and recovered weights, use_jukebox=True

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +66 -12
  2. constraints.txt +0 -1
  3. jukebox/__init__.py +0 -0
  4. jukebox/align.py +115 -0
  5. jukebox/data/__init__.py +0 -0
  6. jukebox/data/artist_genre_processor.py +93 -0
  7. jukebox/data/data_processor.py +69 -0
  8. jukebox/data/files_dataset.py +99 -0
  9. jukebox/data/ids/v2_artist_ids.txt +4111 -0
  10. jukebox/data/ids/v2_genre_ids.txt +120 -0
  11. jukebox/data/ids/v3_artist_ids.txt +0 -0
  12. jukebox/data/ids/v3_genre_ids.txt +604 -0
  13. jukebox/data/labels.py +130 -0
  14. jukebox/data/text_processor.py +32 -0
  15. jukebox/hparams.py +567 -0
  16. jukebox/lyricdict.py +721 -0
  17. jukebox/make_models.py +389 -0
  18. jukebox/prior/__init__.py +0 -0
  19. jukebox/prior/autoregressive.py +421 -0
  20. jukebox/prior/conditioners.py +157 -0
  21. jukebox/prior/prior.py +354 -0
  22. jukebox/sample.py +279 -0
  23. jukebox/save_html.py +130 -0
  24. jukebox/train.py +345 -0
  25. jukebox/transformer/__init__.py +0 -0
  26. jukebox/transformer/factored_attention.py +510 -0
  27. jukebox/transformer/ops.py +142 -0
  28. jukebox/transformer/transformer.py +239 -0
  29. jukebox/utils/__init__.py +0 -0
  30. jukebox/utils/audio_utils.py +148 -0
  31. jukebox/utils/checkpoint.py +32 -0
  32. jukebox/utils/dist_adapter.py +86 -0
  33. jukebox/utils/dist_utils.py +101 -0
  34. jukebox/utils/ema.py +94 -0
  35. jukebox/utils/fp16.py +303 -0
  36. jukebox/utils/io.py +136 -0
  37. jukebox/utils/logger.py +147 -0
  38. jukebox/utils/remote_utils.py +42 -0
  39. jukebox/utils/sample_utils.py +22 -0
  40. jukebox/utils/torch_utils.py +32 -0
  41. jukebox/vqvae/__init__.py +0 -0
  42. jukebox/vqvae/bottleneck.py +248 -0
  43. jukebox/vqvae/encdec.py +131 -0
  44. jukebox/vqvae/resnet.py +75 -0
  45. jukebox/vqvae/vqvae.py +228 -0
  46. requirements.txt +14 -2
  47. sheetsage/__init__.py +17 -0
  48. sheetsage/align.py +29 -0
  49. sheetsage/assets.py +165 -0
  50. sheetsage/assets/hooktheory.json +42 -0
app.py CHANGED
@@ -17,8 +17,13 @@ except ImportError:
17
  func = args[0]
18
  return func
19
 
 
 
20
  import tempfile
21
  import threading
 
 
 
22
 
23
  import gradio as gr
24
  import soundfile as sf
@@ -29,6 +34,31 @@ import picogen2
29
  from picogen2.mirtoolkit.beat_this import BeatThis
30
  from picogen2.mirtoolkit.sheetsage import SheetSage
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  # SheetSage (this model's audio feature extractor) was trained on ~24s segments and is
33
  # most accurate on short clips; longer songs also risk exceeding the GPU time budget below.
34
  MAX_INPUT_SECONDS = 30.0
@@ -46,25 +76,49 @@ model_error = None
46
 
47
 
48
  def load_assets():
49
- """Downloads PiCoGen2's checkpoint, pre-fetches SheetSage's (large) asset cache, and
50
- builds the beat tracker, all on CPU so the app can start serving while this runs."""
 
51
  global decoder, tokenizer, beat_detector, model_loading, model_error
52
  try:
53
  tokenizer = picogen2.Tokenizer()
54
  decoder = picogen2.PiCoGenDecoder.from_pretrained(device="cpu")
55
 
56
- try:
57
- import sheetsage.assets as sheetsage_assets
58
-
59
- for tag in sheetsage_assets.get_asset_tags():
60
- sheetsage_assets.retrieve_asset(tag)
61
- except Exception as e:
62
- # SheetSage lazily re-downloads whatever's missing on first use, so this is
63
- # a warm-up, not a hard requirement.
64
- print(f"SheetSage asset pre-fetch incomplete, will retry on first request: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  beat_detector = BeatThis(cuda=False)
67
- print("Models loaded (CPU).")
68
  except Exception as e:
69
  model_error = str(e)
70
  print(f"Load error: {e}")
 
17
  func = args[0]
18
  return func
19
 
20
+ import os
21
+ import shutil
22
  import tempfile
23
  import threading
24
+ import time
25
+ import urllib.request
26
+ from pathlib import Path
27
 
28
  import gradio as gr
29
  import soundfile as sf
 
34
  from picogen2.mirtoolkit.beat_this import BeatThis
35
  from picogen2.mirtoolkit.sheetsage import SheetSage
36
 
37
+ REPO_ROOT = Path(__file__).parent
38
+
39
+
40
+ def _download_with_progress(url: str, dest: Path, label: str, interval_s: float = 20.0):
41
+ """Downloads url to dest, logging progress at most once per interval_s."""
42
+ if dest.exists():
43
+ return
44
+ dest.parent.mkdir(parents=True, exist_ok=True)
45
+ tmp_path = dest.with_name(dest.name + ".part")
46
+ with urllib.request.urlopen(url) as response, open(tmp_path, "wb") as f:
47
+ total = int(response.headers.get("Content-Length", 0))
48
+ downloaded = 0
49
+ last_log = time.monotonic()
50
+ while chunk := response.read(1024 * 1024):
51
+ f.write(chunk)
52
+ downloaded += len(chunk)
53
+ now = time.monotonic()
54
+ if now - last_log >= interval_s:
55
+ pct = 100 * downloaded / total if total else 0
56
+ print(f"{label}: {downloaded / 1e9:.2f}/{total / 1e9:.2f}GB ({pct:.0f}%)")
57
+ last_log = now
58
+ tmp_path.rename(dest)
59
+ print(f"{label}: done ({dest.stat().st_size / 1e9:.2f}GB)")
60
+
61
+
62
  # SheetSage (this model's audio feature extractor) was trained on ~24s segments and is
63
  # most accurate on short clips; longer songs also risk exceeding the GPU time budget below.
64
  MAX_INPUT_SECONDS = 30.0
 
76
 
77
 
78
  def load_assets():
79
+ """Downloads PiCoGen2's checkpoint and Jukebox's weights, stages SheetSage's vendored
80
+ checkpoints, and builds the beat tracker -- all on CPU so the app can start serving
81
+ while this runs."""
82
  global decoder, tokenizer, beat_detector, model_loading, model_error
83
  try:
84
  tokenizer = picogen2.Tokenizer()
85
  decoder = picogen2.PiCoGenDecoder.from_pretrained(device="cpu")
86
 
87
+ # SheetSage's upstream S3 bucket (its own retrieve_asset download source) has
88
+ # been dead for a while (see https://github.com/chrisdonahue/sheetsage/issues/44,
89
+ # 45, 46). Its checkpoints are small (245MB total) and vendored directly in this
90
+ # repo instead; stage them where sheetsage.assets.retrieve_asset expects to find
91
+ # them so it treats them as already downloaded.
92
+ sheetsage_cache = Path.home() / ".sheetsage" / "sheetsage" / "v0.2"
93
+ sheetsage_cache.mkdir(parents=True, exist_ok=True)
94
+ for item in (REPO_ROOT / "sheetsage" / "weights").iterdir():
95
+ dest = sheetsage_cache / item.name
96
+ if item.name.startswith(".") or dest.exists():
97
+ continue
98
+ if item.is_dir():
99
+ shutil.copytree(item, dest)
100
+ else:
101
+ shutil.copy(item, dest)
102
+
103
+ # Jukebox's own weights are hosted on OpenAI's CDN, unrelated to (and unaffected
104
+ # by) SheetSage's dead bucket. Same default cache path jukebox's own downloader
105
+ # uses (see jukebox/make_models.py:load_checkpoint), pre-fetched here so the
106
+ # first real request doesn't have to wait on a 10GB download inside its GPU
107
+ # time budget.
108
+ jukebox_cache = Path(os.environ.get("JUKEBOX_CACHE_DIR", "~/.cache")).expanduser()
109
+ _download_with_progress(
110
+ "https://openaipublic.azureedge.net/jukebox/models/5b/vqvae.pth.tar",
111
+ jukebox_cache / "jukebox" / "models" / "5b" / "vqvae.pth.tar",
112
+ "jukebox vqvae",
113
+ )
114
+ _download_with_progress(
115
+ "https://openaipublic.azureedge.net/jukebox/models/5b/prior_level_2.pth.tar",
116
+ jukebox_cache / "jukebox" / "models" / "5b" / "prior_level_2.pth.tar",
117
+ "jukebox prior_level_2",
118
+ )
119
 
120
  beat_detector = BeatThis(cuda=False)
121
+ print("Models loaded (CPU); Jukebox weights ready.")
122
  except Exception as e:
123
  model_error = str(e)
124
  print(f"Load error: {e}")
constraints.txt DELETED
@@ -1 +0,0 @@
1
- setuptools<82
 
 
jukebox/__init__.py ADDED
File without changes
jukebox/align.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Get alignment from attn values
3
+ 1. run a forward pass on each hop, get attn values
4
+ 2. concat for all hops
5
+ """
6
+ import numpy as np
7
+ import torch as t
8
+ from jukebox.utils.torch_utils import assert_shape, empty_cache
9
+ from jukebox.hparams import Hyperparams
10
+ from jukebox.make_models import make_model
11
+ from jukebox.save_html import save_html
12
+ from jukebox.utils.sample_utils import get_starts
13
+ import fire
14
+
15
+ def get_alignment(x, zs, labels, prior, fp16, hps):
16
+ level = hps.levels - 1 # Top level used
17
+ n_ctx, n_tokens = prior.n_ctx, prior.n_tokens
18
+ z = zs[level]
19
+ bs, total_length = z.shape[0], z.shape[1]
20
+ if total_length < n_ctx:
21
+ padding_length = n_ctx - total_length
22
+ z = t.cat([z, t.zeros(bs, n_ctx - total_length, dtype=z.dtype, device=z.device)], dim=1)
23
+ total_length = z.shape[1]
24
+ else:
25
+ padding_length = 0
26
+
27
+ hop_length = int(hps.hop_fraction[level]*prior.n_ctx)
28
+ n_head = prior.prior.transformer.n_head
29
+ alignment_head, alignment_layer = prior.alignment_head, prior.alignment_layer
30
+ attn_layers = set([alignment_layer])
31
+ alignment_hops = {}
32
+ indices_hops = {}
33
+
34
+ prior.cuda()
35
+ empty_cache()
36
+ for start in get_starts(total_length, n_ctx, hop_length):
37
+ end = start + n_ctx
38
+
39
+ # set y offset, sample_length and lyrics tokens
40
+ y, indices_hop = prior.get_y(labels, start, get_indices=True)
41
+ assert len(indices_hop) == bs
42
+ for indices in indices_hop:
43
+ assert len(indices) == n_tokens
44
+
45
+ z_bs = t.chunk(z, bs, dim=0)
46
+ y_bs = t.chunk(y, bs, dim=0)
47
+ w_hops = []
48
+ for z_i, y_i in zip(z_bs, y_bs):
49
+ w_hop = prior.z_forward(z_i[:,start:end], [], y_i, fp16=fp16, get_attn_weights=attn_layers)
50
+ assert len(w_hop) == 1
51
+ w_hops.append(w_hop[0][:, alignment_head])
52
+ del w_hop
53
+ w = t.cat(w_hops, dim=0)
54
+ del w_hops
55
+ assert_shape(w, (bs, n_ctx, n_tokens))
56
+ alignment_hop = w.float().cpu().numpy()
57
+ assert_shape(alignment_hop, (bs, n_ctx, n_tokens))
58
+ del w
59
+
60
+ # alignment_hop has shape (bs, n_ctx, n_tokens)
61
+ # indices_hop is a list of len=bs, each entry of len hps.n_tokens
62
+ indices_hops[start] = indices_hop
63
+ alignment_hops[start] = alignment_hop
64
+ prior.cpu()
65
+ empty_cache()
66
+
67
+ # Combine attn for each hop into attn for full range
68
+ # Use indices to place them into correct place for corresponding source tokens
69
+ alignments = []
70
+ for item in range(bs):
71
+ # Note each item has different length lyrics
72
+ full_tokens = labels['info'][item]['full_tokens']
73
+ alignment = np.zeros((total_length, len(full_tokens) + 1))
74
+ for start in reversed(get_starts(total_length, n_ctx, hop_length)):
75
+ end = start + n_ctx
76
+ alignment_hop = alignment_hops[start][item]
77
+ indices = indices_hops[start][item]
78
+ assert len(indices) == n_tokens
79
+ assert alignment_hop.shape == (n_ctx, n_tokens)
80
+ alignment[start:end,indices] = alignment_hop
81
+ alignment = alignment[:total_length - padding_length,:-1] # remove token padding, and last lyric index
82
+ alignments.append(alignment)
83
+ return alignments
84
+
85
+ def save_alignment(model, device, hps):
86
+ print(hps)
87
+ vqvae, priors = make_model(model, device, hps, levels=[-1])
88
+
89
+ logdir = f"{hps.logdir}/level_{0}"
90
+ data = t.load(f"{logdir}/data.pth.tar")
91
+ if model == '1b_lyrics':
92
+ fp16 = False
93
+ else:
94
+ fp16 = True
95
+
96
+ data['alignments'] = get_alignment(data['x'], data['zs'], data['labels'][-1], priors[-1], fp16, hps)
97
+ t.save(data, f"{logdir}/data_align.pth.tar")
98
+ save_html(logdir, data['x'], data['zs'], data['labels'][-1], data['alignments'], hps)
99
+
100
+ def run(model, port=29500, **kwargs):
101
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
102
+ rank, local_rank, device = setup_dist_from_mpi(port=port)
103
+ hps = Hyperparams(**kwargs)
104
+
105
+ with t.no_grad():
106
+ save_alignment(model, device, hps)
107
+
108
+ if __name__ == '__main__':
109
+ fire.Fire(run)
110
+
111
+
112
+
113
+
114
+
115
+
jukebox/data/__init__.py ADDED
File without changes
jukebox/data/artist_genre_processor.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+
4
+ accepted = frozenset([chr(i) for i in range(ord('a'), ord('z') + 1)] +
5
+ [chr(i) for i in range(ord('A'), ord('Z') + 1)] +
6
+ [chr(i) for i in range(ord('0'), ord('9') + 1)])
7
+
8
+ rex = re.compile(r'_+')
9
+
10
+ def norm(s):
11
+ s = ''.join([c if c in accepted else '_' for c in s.lower()])
12
+ s = rex.sub('_', s).strip('_')
13
+ return s
14
+
15
+ def create_reverse_lookup(atoi):
16
+ # Multiple entries could go to the same artist_id/genre_id
17
+ itoa = {}
18
+ for a, i in atoi.items():
19
+ if i not in itoa:
20
+ itoa[i] = []
21
+ itoa[i].append(a)
22
+ indices = sorted(list(itoa.keys()))
23
+ for i in indices:
24
+ itoa[i] = '_'.join(sorted(itoa[i]))
25
+ return itoa
26
+
27
+ class ArtistGenreProcessor():
28
+ def __init__(self, v3=False):
29
+ self.v3 = v3
30
+ dirname = os.path.dirname(__file__)
31
+ if self.v3:
32
+ self.artist_id_file = f"{dirname}/ids/v3_artist_ids.txt"
33
+ self.genre_id_file = f"{dirname}/ids/v3_genre_ids.txt"
34
+ else:
35
+ self.artist_id_file = f"{dirname}/ids/v2_artist_ids.txt"
36
+ self.genre_id_file = f"{dirname}/ids/v2_genre_ids.txt"
37
+ self.load_artists()
38
+ self.load_genres()
39
+
40
+ def get_artist_id(self, artist):
41
+ input_artist = artist
42
+ if self.v3:
43
+ artist = artist.lower()
44
+ else:
45
+ artist = norm(artist)
46
+ if artist not in self.artist_ids:
47
+ print(f"Input artist {input_artist} maps to {artist}, which is not present in {self.artist_id_file}. "
48
+ f"Defaulting to (artist_id, artist) = (0, unknown), if that seems wrong please format artist correctly")
49
+ return self.artist_ids.get(artist, 0)
50
+
51
+ def get_genre_ids(self, genre):
52
+ if self.v3:
53
+ genres = [genre.lower()]
54
+ else:
55
+ # In v2, we convert genre into a bag of words
56
+ genres = norm(genre).split("_")
57
+ for word in genres:
58
+ if word not in self.genre_ids:
59
+ print(f"Input genre {genre} maps to the list {genres}. {word} is not present in {self.genre_id_file}. "
60
+ f"Defaulting to (word_id, word) = (0, unknown), if that seems wrong please format genre correctly")
61
+ return [self.genre_ids.get(word, 0) for word in genres]
62
+
63
+ # get_artist/genre throw error if we ask for non-present values
64
+ def get_artist(self, artist_id):
65
+ return self.artists[artist_id]
66
+
67
+ def get_genre(self, genre_ids):
68
+ if self.v3:
69
+ assert len(genre_ids) == 1
70
+ genre = self.genres[genre_ids[0]]
71
+ else:
72
+ genre = '_'.join([self.genres[genre_id] for genre_id in genre_ids if genre_id >= 0])
73
+ return genre
74
+
75
+ def load_artists(self):
76
+ print(f'Loading artist IDs from {self.artist_id_file}')
77
+ self.artist_ids = {}
78
+ with open(self.artist_id_file, 'r', encoding="utf-8") as f:
79
+ for line in f:
80
+ artist, artist_id = line.strip().split(';')
81
+ self.artist_ids[artist.lower()] = int(artist_id)
82
+ self.artists = create_reverse_lookup(self.artist_ids)
83
+
84
+ def load_genres(self):
85
+ print(f'Loading artist IDs from {self.genre_id_file}')
86
+ self.genre_ids = {}
87
+ with open(self.genre_id_file, 'r', encoding="utf-8") as f:
88
+ for line in f:
89
+ genre, genre_id = line.strip().split(';')
90
+ self.genre_ids[genre.lower()] = int(genre_id)
91
+ self.genres = create_reverse_lookup(self.genre_ids)
92
+
93
+
jukebox/data/data_processor.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch as t
2
+ import jukebox.utils.dist_adapter as dist
3
+ from torch.utils.data.distributed import DistributedSampler
4
+ from torch.utils.data import DataLoader, Dataset, BatchSampler, RandomSampler
5
+ from jukebox.utils.dist_utils import print_all
6
+ from jukebox.utils.audio_utils import calculate_bandwidth
7
+ from jukebox.data.files_dataset import FilesAudioDataset
8
+
9
+ class OffsetDataset(Dataset):
10
+ def __init__(self, dataset, start, end, test=False):
11
+ super().__init__()
12
+ self.dataset = dataset
13
+ self.start = start
14
+ self.end = end
15
+ self.test = test
16
+ assert 0 <= self.start < self.end <= len(self.dataset)
17
+
18
+ def __len__(self):
19
+ return self.end - self.start
20
+
21
+ def __getitem__(self, item):
22
+ return self.dataset.get_item(self.start + item, test=self.test)
23
+
24
+ class DataProcessor():
25
+ def __init__(self, hps):
26
+ self.dataset = FilesAudioDataset(hps)
27
+ duration = 1 if hps.prior else 600
28
+ hps.bandwidth = calculate_bandwidth(self.dataset, hps, duration=duration)
29
+ self.create_datasets(hps)
30
+ self.create_samplers(hps)
31
+ self.create_data_loaders(hps)
32
+ self.print_stats(hps)
33
+
34
+ def set_epoch(self, epoch):
35
+ self.train_sampler.set_epoch(epoch)
36
+ self.test_sampler.set_epoch(epoch)
37
+
38
+ def create_datasets(self, hps):
39
+ train_len = int(len(self.dataset) * hps.train_test_split)
40
+ self.train_dataset = OffsetDataset(self.dataset, 0, train_len, test=False)
41
+ self.test_dataset = OffsetDataset(self.dataset, train_len, len(self.dataset), test=True)
42
+
43
+ def create_samplers(self, hps):
44
+ if not dist.is_available():
45
+ self.train_sampler = BatchSampler(RandomSampler(self.train_dataset), batch_size=hps.bs, drop_last=True)
46
+ self.test_sampler = BatchSampler(RandomSampler(self.test_dataset), batch_size=hps.bs, drop_last=True)
47
+ else:
48
+ self.train_sampler = DistributedSampler(self.train_dataset)
49
+ self.test_sampler = DistributedSampler(self.test_dataset)
50
+
51
+ def create_data_loaders(self, hps):
52
+ # Loader to load mini-batches
53
+ if hps.labels:
54
+ collate_fn = lambda batch: tuple(t.stack([t.from_numpy(b[i]) for b in batch], 0) for i in range(2))
55
+ else:
56
+ collate_fn = lambda batch: t.stack([t.from_numpy(b) for b in batch], 0)
57
+
58
+ print('Creating Data Loader')
59
+ self.train_loader = DataLoader(self.train_dataset, batch_size=hps.bs, num_workers=hps.nworkers,
60
+ sampler=self.train_sampler, pin_memory=False,
61
+ drop_last=True, collate_fn=collate_fn)
62
+ self.test_loader = DataLoader(self.test_dataset, batch_size=hps.bs, num_workers=hps.nworkers,
63
+ sampler=self.test_sampler, pin_memory=False,
64
+ drop_last=False, collate_fn=collate_fn)
65
+
66
+ def print_stats(self, hps):
67
+ print_all(f"Train {len(self.train_dataset)} samples. Test {len(self.test_dataset)} samples")
68
+ print_all(f'Train sampler: {self.train_sampler}')
69
+ print_all(f'Train loader: {len(self.train_loader)}')
jukebox/data/files_dataset.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import librosa
2
+ import math
3
+ import numpy as np
4
+ import jukebox.utils.dist_adapter as dist
5
+ from torch.utils.data import Dataset
6
+ from jukebox.utils.dist_utils import print_all
7
+ from jukebox.utils.io import get_duration_sec, load_audio
8
+ from jukebox.data.labels import Labeller
9
+
10
+ class FilesAudioDataset(Dataset):
11
+ def __init__(self, hps):
12
+ super().__init__()
13
+ self.sr = hps.sr
14
+ self.channels = hps.channels
15
+ self.min_duration = hps.min_duration or math.ceil(hps.sample_length / hps.sr)
16
+ self.max_duration = hps.max_duration or math.inf
17
+ self.sample_length = hps.sample_length
18
+ assert hps.sample_length / hps.sr < self.min_duration, f'Sample length {hps.sample_length} per sr {hps.sr} ({hps.sample_length / hps.sr:.2f}) should be shorter than min duration {self.min_duration}'
19
+ self.aug_shift = hps.aug_shift
20
+ self.labels = hps.labels
21
+ self.init_dataset(hps)
22
+
23
+ def filter(self, files, durations):
24
+ # Remove files too short or too long
25
+ keep = []
26
+ for i in range(len(files)):
27
+ if durations[i] / self.sr < self.min_duration:
28
+ continue
29
+ if durations[i] / self.sr >= self.max_duration:
30
+ continue
31
+ keep.append(i)
32
+ print_all(f'self.sr={self.sr}, min: {self.min_duration}, max: {self.max_duration}')
33
+ print_all(f"Keeping {len(keep)} of {len(files)} files")
34
+ self.files = [files[i] for i in keep]
35
+ self.durations = [int(durations[i]) for i in keep]
36
+ self.cumsum = np.cumsum(self.durations)
37
+
38
+ def init_dataset(self, hps):
39
+ # Load list of files and starts/durations
40
+ files = librosa.util.find_files(f'{hps.audio_files_dir}', ['mp3', 'opus', 'm4a', 'aac', 'wav'])
41
+ print_all(f"Found {len(files)} files. Getting durations")
42
+ cache = dist.get_rank() % 8 == 0 if dist.is_available() else True
43
+ durations = np.array([get_duration_sec(file, cache=cache) * self.sr for file in files]) # Could be approximate
44
+ self.filter(files, durations)
45
+
46
+ if self.labels:
47
+ self.labeller = Labeller(hps.max_bow_genre_size, hps.n_tokens, self.sample_length, v3=hps.labels_v3)
48
+
49
+ def get_index_offset(self, item):
50
+ # For a given dataset item and shift, return song index and offset within song
51
+ half_interval = self.sample_length//2
52
+ shift = np.random.randint(-half_interval, half_interval) if self.aug_shift else 0
53
+ offset = item * self.sample_length + shift # Note we centred shifts, so adding now
54
+ midpoint = offset + half_interval
55
+ assert 0 <= midpoint < self.cumsum[-1], f'Midpoint {midpoint} of item beyond total length {self.cumsum[-1]}'
56
+ index = np.searchsorted(self.cumsum, midpoint) # index <-> midpoint of interval lies in this song
57
+ start, end = self.cumsum[index - 1] if index > 0 else 0.0, self.cumsum[index] # start and end of current song
58
+ assert start <= midpoint <= end, f"Midpoint {midpoint} not inside interval [{start}, {end}] for index {index}"
59
+ if offset > end - self.sample_length: # Going over song
60
+ offset = max(start, offset - half_interval) # Now should fit
61
+ elif offset < start: # Going under song
62
+ offset = min(end - self.sample_length, offset + half_interval) # Now should fit
63
+ assert start <= offset <= end - self.sample_length, f"Offset {offset} not in [{start}, {end - self.sample_length}]. End: {end}, SL: {self.sample_length}, Index: {index}"
64
+ offset = offset - start
65
+ return index, offset
66
+
67
+ def get_metadata(self, filename, test):
68
+ """
69
+ Insert metadata loading code for your dataset here.
70
+ If artist/genre labels are different from provided artist/genre lists,
71
+ update labeller accordingly.
72
+
73
+ Returns:
74
+ (artist, genre, full_lyrics) of type (str, str, str). For
75
+ example, ("unknown", "classical", "") could be a metadata for a
76
+ piano piece.
77
+ """
78
+ return None, None, None
79
+
80
+ def get_song_chunk(self, index, offset, test=False):
81
+ filename, total_length = self.files[index], self.durations[index]
82
+ data, sr = load_audio(filename, sr=self.sr, offset=offset, duration=self.sample_length)
83
+ assert data.shape == (self.channels, self.sample_length), f'Expected {(self.channels, self.sample_length)}, got {data.shape}'
84
+ if self.labels:
85
+ artist, genre, lyrics = self.get_metadata(filename, test)
86
+ labels = self.labeller.get_label(artist, genre, lyrics, total_length, offset)
87
+ return data.T, labels['y']
88
+ else:
89
+ return data.T
90
+
91
+ def get_item(self, item, test=False):
92
+ index, offset = self.get_index_offset(item)
93
+ return self.get_song_chunk(index, offset, test)
94
+
95
+ def __len__(self):
96
+ return int(np.floor(self.cumsum[-1] / self.sample_length))
97
+
98
+ def __getitem__(self, item):
99
+ return self.get_item(item)
jukebox/data/ids/v2_artist_ids.txt ADDED
@@ -0,0 +1,4111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ unknown;0
2
+ various;0
3
+ ;0
4
+ andr_s_schiff;1
5
+ sonny_terry;2
6
+ nelly;3
7
+ markus_schulz;4
8
+ modest_petrovich_mussorgsky;5
9
+ otis_redding;6
10
+ aerosmith;7
11
+ kenny_g;8
12
+ james_taylor;9
13
+ bobby_bland;10
14
+ burning_spear;11
15
+ skip_james;12
16
+ heart;13
17
+ tammy_wynette;14
18
+ muse;15
19
+ beres_hammond;16
20
+ james_newton_howard;17
21
+ nelson_freire;18
22
+ benny_goodman;19
23
+ hank_williams;20
24
+ they_might_be_giants;21
25
+ the_brian_jonestown_massacre;22
26
+ lady_gaga;23
27
+ chris_young;24
28
+ alison_krauss_union_station;25
29
+ seal;26
30
+ the_hollies;27
31
+ shabba_ranks;28
32
+ paul_young;29
33
+ iration;30
34
+ buck_owens;31
35
+ the_weeknd;32
36
+ elton_john;33
37
+ smokey_robinson;34
38
+ roy_orbison;35
39
+ headhunterz;36
40
+ blondie;37
41
+ the_temptations;38
42
+ ray_stevens;39
43
+ foo_fighters;40
44
+ christoph_eschenbach;41
45
+ blind_willie_mctell;42
46
+ al_martino;43
47
+ edwin_fischer;44
48
+ victor_young;45
49
+ justin_bieber;46
50
+ styx;47
51
+ doris_day;48
52
+ tex_beneke;49
53
+ the_monkees;50
54
+ richard_wagner;51
55
+ bryan_adams;52
56
+ alessandro_scarlatti;53
57
+ rebelution;54
58
+ pitbull;55
59
+ nat_king_cole;56
60
+ wiz_khalifa;57
61
+ roger_miller;58
62
+ andy_williams;59
63
+ peggy_lee;60
64
+ pyotr_ilyich_tchaikovsky;61
65
+ booker_t_the_mg_s;62
66
+ cilla_black;63
67
+ billy_fury;64
68
+ vera_lynn;65
69
+ enrico_caruso;66
70
+ sly_and_robbie;67
71
+ the_pretenders;68
72
+ the_sweet;69
73
+ kylie_minogue;70
74
+ kay_kyser;71
75
+ san_francisco_symphony;72
76
+ prince;73
77
+ queen;74
78
+ kool_the_gang;75
79
+ horace_andy;76
80
+ midnite;77
81
+ gentleman;78
82
+ wilhelm_kempff;79
83
+ busta_rhymes;80
84
+ the_pogues;81
85
+ def_leppard;82
86
+ al_jolson;83
87
+ king_tubby;84
88
+ hot_chocolate;85
89
+ delroy_wilson;86
90
+ jody_watley;87
91
+ bobby_vee;88
92
+ johnny_mathis;89
93
+ the_rascals;90
94
+ sviatoslav_richter;91
95
+ fred_astaire;92
96
+ john_holt;93
97
+ amy_grant;94
98
+ b_b_king;95
99
+ paul_weston;96
100
+ four_tops;97
101
+ jay_sean;98
102
+ pat_boone;99
103
+ george_frideric_handel;100
104
+ bing_crosby;101
105
+ shalamar;102
106
+ tommy_dorsey;103
107
+ ludacris;104
108
+ kenny_chesney;105
109
+ murray_perahia;106
110
+ lightnin_hopkins;107
111
+ ricky_nelson;108
112
+ clint_mansell;109
113
+ tom_petty_and_the_heartbreakers;110
114
+ gary_glitter;111
115
+ ringo_starr;112
116
+ phil_collins;113
117
+ leo_reisman;114
118
+ al_green;115
119
+ jim_reeves;116
120
+ chris_brown;117
121
+ cliff_edwards;118
122
+ buddy_guy;119
123
+ angelo_badalamenti;120
124
+ frank_sinatra;121
125
+ santana;122
126
+ the_pussycat_dolls;123
127
+ peaches_herb;124
128
+ radu_lupu;125
129
+ the_whispers;126
130
+ eddy_howard;127
131
+ memphis_slim;128
132
+ henry_mancini;129
133
+ giuseppe_verdi;130
134
+ the_dream;131
135
+ vladimir_sofronitsky;132
136
+ u_roy;133
137
+ ken_boothe;134
138
+ the_kinks;135
139
+ howard_shore;136
140
+ hardwell;137
141
+ lou_reed;138
142
+ calvin_harris;139
143
+ eddy_chen;140
144
+ anne_murray;141
145
+ juice_newton;142
146
+ bee_gees;143
147
+ wilson_pickett;144
148
+ alan_jackson;145
149
+ shirley_bassey;146
150
+ waylon_jennings;147
151
+ destiny_s_child;148
152
+ cab_calloway;149
153
+ johnny_copeland;150
154
+ bright_eyes;151
155
+ trey_songz;152
156
+ neil_sedaka;153
157
+ justin_timberlake;154
158
+ arthur_grumiaux;155
159
+ the_who;156
160
+ the_yardbirds;157
161
+ big_joe_turner;158
162
+ duke_ellington;159
163
+ herb_alpert;160
164
+ laura_branigan;161
165
+ michael_jackson;162
166
+ john_denver;163
167
+ peter_gordon;164
168
+ solomon_cutner;165
169
+ steve_miller_band;166
170
+ don_williams;167
171
+ the_pointer_sisters;168
172
+ metallica;169
173
+ the_ink_spots;170
174
+ kenny_rogers;171
175
+ the_game;172
176
+ gene_krupa;173
177
+ snoop_dogg;174
178
+ j_cole;175
179
+ taylor_dayne;176
180
+ r3hab;177
181
+ guy_lombardo_and_his_royal_canadians;178
182
+ shakin_stevens;179
183
+ tim_mcgraw;180
184
+ olivia_newton_john_john_travolta;181
185
+ the_replacements;182
186
+ beenie_man;183
187
+ diplo;184
188
+ sammy_kaye;185
189
+ don_gibson;186
190
+ shaggy;187
191
+ nina_simone;188
192
+ stone_temple_pilots;189
193
+ ne_yo;190
194
+ huddie_william_ledbetter;191
195
+ jerry_goldsmith;192
196
+ the_bellamy_brothers;193
197
+ winifred_atwell;194
198
+ georg_philipp_telemann;195
199
+ timbaland;196
200
+ the_5th_dimension;197
201
+ dionne_warwick;198
202
+ r_kelly;199
203
+ enrique_iglesias;200
204
+ sting;201
205
+ mikey_dread;202
206
+ yellowman;203
207
+ eddie_kendricks;204
208
+ blur;205
209
+ twista;206
210
+ paul_anka;207
211
+ chris_cornell;208
212
+ a_ha;209
213
+ pet_shop_boys;210
214
+ yo_yo_ma;211
215
+ tom_jones;212
216
+ neil_diamond;213
217
+ vic_damone;214
218
+ paul_oakenfold;215
219
+ jascha_heifetz;216
220
+ t_i_;217
221
+ dinah_washington;218
222
+ vladimir_ashkenazy;219
223
+ leif_ove_andsnes;220
224
+ johnny_cash;221
225
+ basement_jaxx;222
226
+ sonic_youth;223
227
+ the_isley_brothers;224
228
+ jason_aldean;225
229
+ henryk_szeryng;226
230
+ lloyd_price;227
231
+ reba_mcentire;228
232
+ bon_jovi;229
233
+ bed_ich_smetana;230
234
+ donny_osmond;231
235
+ chuck_berry;232
236
+ the_smashing_pumpkins;233
237
+ israel_vibration;234
238
+ stan_kenton;235
239
+ conway_twitty_loretta_lynn;236
240
+ mcfly;237
241
+ r_e_m;238
242
+ morgan_heritage;239
243
+ lil_wayne;240
244
+ garnett_silk;241
245
+ lee_scratch_perry;242
246
+ howlin_wolf;243
247
+ jon_secada;244
248
+ goo_goo_dolls;245
249
+ brian_hyland;246
250
+ abc;247
251
+ clarence_gatemouth_brown;248
252
+ wilson_phillips;249
253
+ atlantic_starr;250
254
+ david_guetta;251
255
+ s_rgio_mendes;252
256
+ fr_d_ric_chopin;253
257
+ robert_palmer;254
258
+ charlie_musselwhite;255
259
+ level_42;256
260
+ peter_andre;257
261
+ the_spinners;258
262
+ erasure;259
263
+ philippe_entremont;260
264
+ leo_jan_ek;261
265
+ the_kingston_trio;262
266
+ ronnie_milsap;263
267
+ pat_benatar;264
268
+ robert_casadesus;265
269
+ t_bone_walker;266
270
+ duran_duran;267
271
+ jerry_reed;268
272
+ franz_liszt;269
273
+ journey;270
274
+ steve_angello;271
275
+ showaddywaddy;272
276
+ tears_for_fears;273
277
+ john_williams;274
278
+ daniel_m_ller_schott;275
279
+ tampa_red;276
280
+ tina_turner;277
281
+ the_beatles;278
282
+ miranda_lambert;279
283
+ howard_jones;280
284
+ reo_speedwagon;281
285
+ lady_antebellum;282
286
+ no_doubt;283
287
+ status_quo;284
288
+ tiffany;285
289
+ billy_eckstine;286
290
+ danny_elfman;287
291
+ jimmy_wakely;288
292
+ ike_tina_turner;289
293
+ george_gershwin;290
294
+ dinah_shore;291
295
+ armin_van_buuren;292
296
+ keith_sweat;293
297
+ beaux_arts_trio;294
298
+ arcangelo_corelli;295
299
+ air_supply;296
300
+ w_w;297
301
+ the_mighty_diamonds;298
302
+ harry_gregson_williams;299
303
+ blind_lemon_jefferson;300
304
+ brook_benton;301
305
+ sizzla;302
306
+ bobby_darin;303
307
+ steely_dan;304
308
+ the_skatalites;305
309
+ dwight_yoakam;306
310
+ clara_haskil;307
311
+ jah_cure;308
312
+ cliff_richard;309
313
+ fabolous;310
314
+ sonny_boy_williamson_ii;311
315
+ tinie_tempah;312
316
+ claude_debussy;313
317
+ jewel;314
318
+ bob_seger;315
319
+ otis_rush;316
320
+ mikhail_pletnev;317
321
+ gene_autry;318
322
+ blind_blake;319
323
+ ethel_waters;320
324
+ jackie_wilson;321
325
+ big_mama_thornton;322
326
+ mary_wells;323
327
+ the_mills_brothers;324
328
+ rage_against_the_machine;325
329
+ barbra_streisand;326
330
+ frank_crumit;327
331
+ the_clash;328
332
+ dion;329
333
+ all_4_one;330
334
+ t_i;331
335
+ orchestral_manoeuvres_in_the_dark;332
336
+ culture;333
337
+ josh_turner;334
338
+ one_direction;335
339
+ the_rolling_stones;336
340
+ half_pint;337
341
+ the_searchers;338
342
+ vangelis;339
343
+ jackson_browne;340
344
+ the_beach_boys;341
345
+ train;342
346
+ prince_buster;343
347
+ tavares;344
348
+ eve;345
349
+ bessie_smith;346
350
+ trace_adkins;347
351
+ bay_city_rollers;348
352
+ david_allan_coe;349
353
+ rascal_flatts;350
354
+ petula_clark;351
355
+ 10cc;352
356
+ 50_cent;353
357
+ the_oak_ridge_boys;354
358
+ barry_manilow;355
359
+ truls_m_rk;356
360
+ morrissey;357
361
+ gerry_the_pacemakers;358
362
+ kay_starr;359
363
+ alborosie;360
364
+ engelbert_humperdinck;361
365
+ new_order;362
366
+ tony_bennett;363
367
+ stereophonics;364
368
+ jimmy_reed;365
369
+ akon;366
370
+ echo_the_bunnymen;367
371
+ jamiroquai;368
372
+ stevie_ray_vaughan;369
373
+ ben_e_king;370
374
+ cheap_trick;371
375
+ dusty_springfield;372
376
+ mel_tillis;373
377
+ damian_marley;374
378
+ ruth_etting;375
379
+ westlife;376
380
+ diana_ross;377
381
+ the_shirelles;378
382
+ frankie_laine;379
383
+ sarah_vaughan;380
384
+ ray_price;381
385
+ gordon_lightfoot;382
386
+ eddie_cantor;383
387
+ the_byrds;384
388
+ gary_numan;385
389
+ bonnie_tyler;386
390
+ aswad;387
391
+ brownie_mcghee;388
392
+ joshua_bell;389
393
+ manic_street_preachers;390
394
+ mr_vegas;391
395
+ tanya_tucker;392
396
+ marvin_gaye_tammi_terrell;393
397
+ the_staple_singers;394
398
+ ry_cooder;395
399
+ john_mayall;396
400
+ martina_mcbride;397
401
+ anner_bylsma;398
402
+ magic_sam;399
403
+ avril_lavigne;400
404
+ robert_nighthawk;401
405
+ the_coasters;402
406
+ ace_of_base;403
407
+ joseph_szigeti;404
408
+ artie_shaw;405
409
+ big_bill_broonzy;406
410
+ the_ventures;407
411
+ rick_astley;408
412
+ les_paul;409
413
+ leonid_kogan;410
414
+ hall_oates;411
415
+ three_dog_night;412
416
+ charley_pride;413
417
+ paul_mccartney;414
418
+ alfred_cortot;415
419
+ crystal_gayle;416
420
+ taj_mahal;417
421
+ mary_j_blige;418
422
+ leann_rimes;419
423
+ mildred_bailey;420
424
+ ll_cool_j;421
425
+ lobo;422
426
+ blake_shelton;423
427
+ matt_haimovitz;424
428
+ beastie_boys;425
429
+ johannes_brahms;426
430
+ martha_and_the_vandellas;427
431
+ lou_rawls;428
432
+ the_righteous_brothers;429
433
+ rosalyn_tureck;430
434
+ vince_gill;431
435
+ gary_moore;432
436
+ bad_company;433
437
+ marty_robbins;434
438
+ russ_morgan;435
439
+ david_cassidy;436
440
+ dj_khaled;437
441
+ leonard_pennario;438
442
+ glenn_miller;439
443
+ kings_of_leon;440
444
+ afrojack;441
445
+ cyndi_lauper;442
446
+ trisha_yearwood;443
447
+ diamond_rio;444
448
+ patty_loveless;445
449
+ sugar_minott;446
450
+ willie_nelson;447
451
+ thomas_newman;448
452
+ georgia_gibbs;449
453
+ eric_carmen;450
454
+ ricky_skaggs;451
455
+ earth_wind_fire;452
456
+ peter_tosh;453
457
+ joe_bonamassa;454
458
+ lonnie_johnson;455
459
+ missy_elliott;456
460
+ nicki_minaj;457
461
+ luther_allison;458
462
+ grigory_sokolov;459
463
+ luke_bryan;460
464
+ alanis_morissette;461
465
+ tracy_lawrence;462
466
+ sonny_james;463
467
+ brandy;464
468
+ michael_bolton;465
469
+ boswell_sisters;466
470
+ antonio_vivaldi;467
471
+ fritz_kreisler;468
472
+ elvis_costello_the_attractions;469
473
+ woody_herman;470
474
+ korn;471
475
+ hans_zimmer;472
476
+ the_osmonds;473
477
+ electric_light_orchestra;474
478
+ t_rex;475
479
+ van_cliburn;476
480
+ harry_james;477
481
+ glee_cast;478
482
+ simple_minds;479
483
+ abba;480
484
+ the_jam;481
485
+ tanya_stephens;482
486
+ the_statler_brothers;483
487
+ craig_david;484
488
+ moby;485
489
+ xxxtentacion;486
490
+ paul_simon;487
491
+ magic_slim;488
492
+ natasha_bedingfield;489
493
+ ennio_morricone;490
494
+ carpenters;491
495
+ joe_tex;492
496
+ cocoa_tea;493
497
+ the_glee_cast;494
498
+ martha_argerich;495
499
+ charlie_rich;496
500
+ memphis_minnie;497
501
+ sheryl_crow;498
502
+ jan_dean;499
503
+ nick_cave_and_the_bad_seeds;500
504
+ del_shannon;501
505
+ lee_greenwood;502
506
+ gary_lewis_the_playboys;503
507
+ marcelle_meyer;504
508
+ count_basie;505
509
+ harold_melvin_the_blue_notes;506
510
+ the_fray;507
511
+ the_prodigy;508
512
+ alicia_keys;509
513
+ conway_twitty;510
514
+ barrington_levy;511
515
+ b_o_b;512
516
+ tritonal;513
517
+ mario_lanza;514
518
+ mac_davis;515
519
+ billy_murray;516
520
+ igor_stravinsky;517
521
+ pretenders;518
522
+ jordin_sparks;519
523
+ alice_in_chains;520
524
+ ohio_players;521
525
+ rick_springfield;522
526
+ jimmie_rodgers;523
527
+ buju_banton;524
528
+ linda_ronstadt;525
529
+ george_benson;526
530
+ 2pac;527
531
+ soulja_boy;528
532
+ the_flaming_lips;529
533
+ ignacy_jan_paderewski;530
534
+ gloria_estefan;531
535
+ ariana_grande;532
536
+ black_uhuru;533
537
+ tony_pastor;534
538
+ sublime;535
539
+ snow_patrol;536
540
+ daft_punk;537
541
+ johnny_winter;538
542
+ robbie_williams;539
543
+ eddie_rabbitt;540
544
+ james_cotton;541
545
+ brad_paisley;542
546
+ manfred_mann;543
547
+ bassnectar;544
548
+ margaret_whiting;545
549
+ sam_cooke;546
550
+ robert_cray;547
551
+ the_beautiful_south;548
552
+ barbara_mandrell;549
553
+ dick_haymes;550
554
+ creedence_clearwater_revival;551
555
+ chic;552
556
+ ray_charles;553
557
+ carter_family;554
558
+ ti_sto;555
559
+ survivor;556
560
+ c_line_dion;557
561
+ sergei_prokofiev;558
562
+ b_la_bart_k;559
563
+ the_congos;560
564
+ yefim_bronfman;561
565
+ laidback_luke;562
566
+ darius_rucker;563
567
+ ray_anthony;564
568
+ incubus;565
569
+ carole_king;566
570
+ james_brown;567
571
+ swv;568
572
+ bruno_mars;569
573
+ aphex_twin;570
574
+ nitty_gritty_dirt_band;571
575
+ gustav_mahler;572
576
+ the_shadows;573
577
+ the_moody_blues;574
578
+ reverend_gary_davis;575
579
+ sia;576
580
+ gaetano_donizetti;577
581
+ earl_hooker;578
582
+ the_commodores;579
583
+ maria_jo_o_pires;580
584
+ eric_donaldson;581
585
+ elmore_james;582
586
+ sean_kingston;583
587
+ don_carlos;584
588
+ linkin_park;585
589
+ jay_the_americans;586
590
+ grand_funk_railroad;587
591
+ jls;588
592
+ frankie_valli;589
593
+ lefty_frizzell;590
594
+ en_vogue;591
595
+ the_cure;592
596
+ perry_como;593
597
+ johnny_mercer;594
598
+ stevie_wonder;595
599
+ ernest_tubb;596
600
+ ramin_djawadi;597
601
+ ashanti;598
602
+ rosemary_clooney;599
603
+ anne_sophie_mutter;600
604
+ helen_forrest;601
605
+ augustus_pablo;602
606
+ the_carpenters;603
607
+ claudio_arrau;604
608
+ bob_dylan;605
609
+ joe_simon;606
610
+ culture_club;607
611
+ the_ipana_troubadors;608
612
+ jennifer_lopez;609
613
+ karyn_white;610
614
+ joe;611
615
+ sarah_mclachlan;612
616
+ j_geils_band;613
617
+ dean_martin;614
618
+ hank_snow;615
619
+ clyde_mcphatter;616
620
+ tlc;617
621
+ beck;618
622
+ jimmy_dean;619
623
+ roy_acuff;620
624
+ outkast;621
625
+ freddie_mcgregor;622
626
+ gus_arnheim;623
627
+ gramatik;624
628
+ merle_haggard;625
629
+ steve_lawrence;626
630
+ ma_rainey;627
631
+ jimmy_dorsey;628
632
+ johnny_paycheck;629
633
+ arthur_rubinstein;630
634
+ talking_heads;631
635
+ capleton;632
636
+ les_brown;633
637
+ leonard_bernstein;634
638
+ bobby_goldsboro;635
639
+ kendrick_lamar;636
640
+ lenny_kravitz;637
641
+ nat_shilkret;638
642
+ toby_keith;639
643
+ junior_wells;640
644
+ billy_j_kramer_the_dakotas;641
645
+ peter_paul_mary;642
646
+ armand_van_helden;643
647
+ h_sker_d_;644
648
+ alabama;645
649
+ eminem;646
650
+ felix_mendelssohn_bartholdy;647
651
+ richard_goode;648
652
+ pink_floyd;649
653
+ sara_evans;650
654
+ lonnie_donegan;651
655
+ boney_m;652
656
+ deadmau5;653
657
+ lee_ann_womack;654
658
+ eric_clapton;655
659
+ ray_parker_jr;656
660
+ etta_james;657
661
+ the_white_stripes;658
662
+ gary_u_s_bonds;659
663
+ glen_gray_and_the_casa_loma_orchestra;660
664
+ bonnie_raitt;661
665
+ soulja_boy_tell_em;662
666
+ bobby_rydell;663
667
+ carly_simon;664
668
+ koko_taylor;665
669
+ gregory_isaacs;666
670
+ red_hot_chili_peppers;667
671
+ josef_suk;668
672
+ clint_black;669
673
+ buddy_clark;670
674
+ tool;671
675
+ pierre_fournier;672
676
+ alice_cooper;673
677
+ lucky_dube;674
678
+ jorge_bolet;675
679
+ don_diablo;676
680
+ r_l_burnside;677
681
+ klaus_badelt;678
682
+ dolly_parton;679
683
+ james_horner;680
684
+ green_day;681
685
+ henry_burr;682
686
+ the_doors;683
687
+ roxette;684
688
+ louis_armstrong;685
689
+ jerry_butler;686
690
+ louis_prima;687
691
+ paul_van_dyk;688
692
+ dennis_brown;689
693
+ toni_braxton;690
694
+ jerry_lee_lewis;691
695
+ donna_summer;692
696
+ percy_faith;693
697
+ willie_dixon;694
698
+ elvis_costello;695
699
+ youri_egorov;696
700
+ dmitri_shostakovich;697
701
+ webb_pierce;698
702
+ monica;699
703
+ pierre_laurent_aimard;700
704
+ muddy_waters;701
705
+ garth_brooks;702
706
+ boyz_ii_men;703
707
+ kris_kristofferson;704
708
+ duane_eddy;705
709
+ coolio;706
710
+ gidon_kremer;707
711
+ eurythmics;708
712
+ randy_travis;709
713
+ collie_buddz;710
714
+ faith_evans;711
715
+ matisyahu;712
716
+ brooks_dunn;713
717
+ lulu;714
718
+ fletcher_henderson;715
719
+ eek_a_mouse;716
720
+ shlomo_mintz;717
721
+ ray_noble;718
722
+ bill_withers;719
723
+ ub40;720
724
+ b_j_thomas;721
725
+ mariah_carey;722
726
+ olivia_newton_john;723
727
+ jackson_5;724
728
+ michael_rose;725
729
+ three_days_grace;726
730
+ glen_campbell;727
731
+ keith_urban;728
732
+ onerepublic;729
733
+ ted_weems;730
734
+ johnny_desmond;731
735
+ billy_preston;732
736
+ billy_vaughn;733
737
+ otis_spann;734
738
+ marion_harris;735
739
+ richard_marx;736
740
+ frankie_carle;737
741
+ xavier_cugat;738
742
+ zz_top;739
743
+ faz_l_say;740
744
+ new_york_philharmonic;741
745
+ teresa_brewer;742
746
+ pixies;743
747
+ david_oistrakh;744
748
+ rory_gallagher;745
749
+ ted_lewis_his_band;746
750
+ patsy_cline;747
751
+ tracy_byrd;748
752
+ daniel_shafran;749
753
+ johnny_horton;750
754
+ billy_ocean;751
755
+ don_mclean;752
756
+ ginuwine;753
757
+ kiss;754
758
+ kaskade;755
759
+ the_hold_steady;756
760
+ rod_stewart;757
761
+ rudolf_serkin;758
762
+ the_wanted;759
763
+ herman_s_hermits;760
764
+ rusty_draper;761
765
+ jay_z;762
766
+ mississippi_john_hurt;763
767
+ linval_thompson;764
768
+ billie_holiday;765
769
+ lawrence_welk;766
770
+ john_lee_hooker;767
771
+ the_offspring;768
772
+ ramones;769
773
+ ronan_keating;770
774
+ sir_clifford_michael_curzon;771
775
+ dierks_bentley;772
776
+ bush;773
777
+ texas;774
778
+ gene_austin;775
779
+ after_all;776
780
+ depeche_mode;777
781
+ eddy_arnold;778
782
+ ferry_corsten;779
783
+ inxs;780
784
+ jimmie_lunceford;781
785
+ johann_sebastian_bach;782
786
+ maxi_priest;783
787
+ travis_tritt;784
788
+ girls_aloud;785
789
+ meat_loaf;786
790
+ brenda_lee;787
791
+ modest_mouse;788
792
+ glenn_gould;789
793
+ mc_hammer;790
794
+ erik_satie;791
795
+ the_andrews_sisters;792
796
+ alicia_de_larrocha;793
797
+ america;794
798
+ charles_harrison;795
799
+ georges_cziffra;796
800
+ peter_serkin;797
801
+ gladys_knight_the_pips;798
802
+ anton_n_dvo_k;799
803
+ emil_gilels;800
804
+ myra_hess;801
805
+ portugal_the_man;802
806
+ rufus;803
807
+ sergei_rachmaninoff;804
808
+ andr_previn;805
809
+ natalie_cole;806
810
+ the_killers;807
811
+ helen_reddy;808
812
+ billy_idol;809
813
+ shawn_mendes;810
814
+ john_lennon;811
815
+ joan_jett;812
816
+ jimmy_cliff;813
817
+ taylor_swift;814
818
+ shura_cherkassky;815
819
+ marvin_gaye;816
820
+ the_drifters;817
821
+ paul_revere_the_raiders;818
822
+ donovan;819
823
+ alma_gluck;820
824
+ fleetwood_mac;821
825
+ jo_stafford;822
826
+ samson_fran_ois;823
827
+ vaughn_monroe;824
828
+ tennessee_ernie_ford;825
829
+ whitesnake;826
830
+ iron_maiden;827
831
+ blind_boy_fuller;828
832
+ eric_church;829
833
+ atomic_kitten;830
834
+ harry_nilsson;831
835
+ paul_specht;832
836
+ bob_marley;833
837
+ les_baxter;834
838
+ aretha_franklin;835
839
+ jessie_j;836
840
+ robert_johnson;837
841
+ maroon_5;838
842
+ sheena_easton;839
843
+ george_strait;840
844
+ bruce_springsteen;841
845
+ oasis;842
846
+ jack_white;843
847
+ fatboy_slim;844
848
+ the_jesus_and_mary_chain;845
849
+ hank_williams_jr;846
850
+ bill_haley_his_comets;847
851
+ charlie_daniels;848
852
+ pearl_jam;849
853
+ the_stylistics;850
854
+ sean_paul;851
855
+ david_essex;852
856
+ zino_francescatti;853
857
+ bruce_hornsby;854
858
+ system_of_a_down;855
859
+ scott_joplin;856
860
+ benny_benassi;857
861
+ mitch_miller;858
862
+ gloria_gaynor;859
863
+ steve_winwood;860
864
+ drake;861
865
+ bone_thugs_n_harmony;862
866
+ nickelback;863
867
+ john_mellencamp;864
868
+ gene_pitney;865
869
+ chet_atkins;866
870
+ mark_ronson;867
871
+ kc_the_sunshine_band;868
872
+ chingy;869
873
+ maurice_ravel;870
874
+ infected_mushroom;871
875
+ walter_gieseking;872
876
+ pavement;873
877
+ deniece_williams;874
878
+ tommy_james_the_shondells;875
879
+ harry_belafonte;876
880
+ robert_schuman;877
881
+ george_jones;878
882
+ whitney_houston;879
883
+ the_ames_brothers;880
884
+ max_romeo;881
885
+ patti_page;882
886
+ p_nk;883
887
+ vienna_philharmonic;884
888
+ violent_femmes;885
889
+ sly_the_family_stone;886
890
+ johnny_marvin;887
891
+ sammy_davis_jr_;888
892
+ nirvana;889
893
+ the_turtles;890
894
+ the_manhattans;891
895
+ the_supremes;892
896
+ gregg_allman;893
897
+ alton_ellis;894
898
+ giacomo_puccini;895
899
+ artur_schnabel;896
900
+ 2_unlimited;897
901
+ michael_rabin;898
902
+ toto;899
903
+ lil_kim;900
904
+ shinedown;901
905
+ teddy_wilson;902
906
+ alpha_blondy;903
907
+ the_guess_who;904
908
+ my_chemical_romance;905
909
+ matchbox_twenty;906
910
+ wolfgang_gartner;907
911
+ ed_sheeran;908
912
+ faron_young;909
913
+ fats_waller;910
914
+ kate_smith;911
915
+ loretta_lynn;912
916
+ antonio_meneses;913
917
+ tony_martin;914
918
+ frankie_vaughan;915
919
+ the_mamas_the_papas;916
920
+ david_bowie;917
921
+ erskine_hawkins;918
922
+ the_four_lads;919
923
+ queens_of_the_stone_age;920
924
+ the_human_league;921
925
+ mud;922
926
+ bread;923
927
+ dixie_chicks;924
928
+ backstreet_boys;925
929
+ connie_francis;926
930
+ the_black_keys;927
931
+ paul_weller;928
932
+ pieter_wispelwey;929
933
+ the_bachelors;930
934
+ janet_jackson;931
935
+ the_association;932
936
+ edwin_starr;933
937
+ hank_williams_jr_;934
938
+ steven_isserlis;935
939
+ the_doobie_brothers;936
940
+ jimi_hendrix;937
941
+ sousa_s_band;938
942
+ ricky_martin;939
943
+ the_cranberries;940
944
+ paul_whiteman;941
945
+ the_saturdays;942
946
+ keb_mo;943
947
+ the_psychedelic_furs;944
948
+ boyzone;945
949
+ the_chemical_brothers;946
950
+ johnny_tillotson;947
951
+ joe_cocker;948
952
+ babyface;949
953
+ wet_wet_wet;950
954
+ tom_petty;951
955
+ lesley_gore;952
956
+ deorro;953
957
+ war;954
958
+ wolfgang_schneiderhan;955
959
+ isaac_hayes;956
960
+ beyonc;957
961
+ gordon_jenkins;958
962
+ flo_rida;959
963
+ captain_tennille;960
964
+ adolf_busch;961
965
+ bobby_bare;962
966
+ johnnie_taylor;963
967
+ above_beyond;964
968
+ robin_thicke;965
969
+ ja_rule;966
970
+ barry_white;967
971
+ florence_the_machine;968
972
+ the_jimi_hendrix_experience;969
973
+ gabrielle;970
974
+ leon_fleisher;971
975
+ yehudi_menuhin;972
976
+ george_harrison;973
977
+ kate_bush;974
978
+ u2;975
979
+ nancy_sinatra;976
980
+ the_everly_brothers;977
981
+ peter_green;978
982
+ cat_stevens;979
983
+ the_new_seekers;980
984
+ itzhak_perlman;981
985
+ red_nichols_his_five_pennies;982
986
+ the_script;983
987
+ ijahman_levi;984
988
+ rihanna;985
989
+ joan_jett_and_the_blackhearts;986
990
+ the_dorsey_brothers_orchestra;987
991
+ charlie_barnet;988
992
+ lmfao;989
993
+ 112;990
994
+ kelis;991
995
+ john_mccormack;992
996
+ guns_n_roses;993
997
+ gordon_macrae;994
998
+ buddy_holly;995
999
+ franz_schubert;996
1000
+ tommy_roe;997
1001
+ garbage;998
1002
+ bow_wow;999
1003
+ belle_and_sebastian;1000
1004
+ paul_tortelier;1001
1005
+ johnny_nash;1002
1006
+ lazar_berman;1003
1007
+ avicii;1004
1008
+ 5_seconds_of_summer;1005
1009
+ mississippi_fred_mcdowell;1006
1010
+ ivan_moravec;1007
1011
+ little_richard;1008
1012
+ john_ogdon;1009
1013
+ dr_dre;1010
1014
+ andy_russell;1011
1015
+ sex_pistols;1012
1016
+ puddle_of_mudd;1013
1017
+ june_carter_cash;1014
1018
+ freddie_king;1015
1019
+ dino_ciani;1016
1020
+ h_sker_d;1017
1021
+ nicky_romero;1018
1022
+ shania_twain;1019
1023
+ major_lazer;1020
1024
+ usher;1021
1025
+ madonna;1022
1026
+ nsync;1023
1027
+ the_o_jays;1024
1028
+ faith_hill;1025
1029
+ terence_trent_d_arby;1026
1030
+ gene_chandler;1027
1031
+ lisa_stansfield;1028
1032
+ pharrell_williams;1029
1033
+ david_geringas;1030
1034
+ dr_alimantado;1031
1035
+ jack_scott;1032
1036
+ vladimir_horowitz;1033
1037
+ genesis;1034
1038
+ jessica_simpson;1035
1039
+ peter_gabriel;1036
1040
+ spike_jones_and_his_city_slickers;1037
1041
+ leonard_rose;1038
1042
+ richard_strauss;1039
1043
+ mgmt;1040
1044
+ blink_182;1041
1045
+ ella_fitzgerald;1042
1046
+ carrie_underwood;1043
1047
+ evgeny_kissin;1044
1048
+ olly_murs;1045
1049
+ ky_mani_marley;1046
1050
+ rose_royce;1047
1051
+ desmond_dekker;1048
1052
+ montell_jordan;1049
1053
+ little_river_band;1050
1054
+ t_pain;1051
1055
+ gary_allan;1052
1056
+ chubby_checker;1053
1057
+ the_diamonds;1054
1058
+ creed;1055
1059
+ louis_jordan;1056
1060
+ vernon_dalhart;1057
1061
+ gilbert_o_sullivan;1058
1062
+ ziggy_marley;1059
1063
+ irene_cara;1060
1064
+ katy_perry;1061
1065
+ all_saints;1062
1066
+ benjamin_britten;1063
1067
+ p_m_dawn;1064
1068
+ iona_brown;1065
1069
+ the_lettermen;1066
1070
+ natalie_imbruglia;1067
1071
+ viktoria_mullova;1068
1072
+ zac_brown_band;1069
1073
+ bj_rk;1070
1074
+ mutabaruka;1071
1075
+ jermaine_jackson;1072
1076
+ the_impressions;1073
1077
+ spandau_ballet;1074
1078
+ luther_vandross;1075
1079
+ thompson_twins;1076
1080
+ travis_scott;1077
1081
+ roots_radics;1078
1082
+ madness;1079
1083
+ skrillex;1080
1084
+ the_smiths;1081
1085
+ van_halen;1082
1086
+ the_four_seasons;1083
1087
+ j_b_lenoir;1084
1088
+ johnny_rivers;1085
1089
+ bob_marley_the_wailers;1086
1090
+ albert_collins;1087
1091
+ arctic_monkeys;1088
1092
+ billy_joel;1089
1093
+ joe_nichols;1090
1094
+ chicago;1091
1095
+ coldplay;1092
1096
+ blue;1093
1097
+ papa_roach;1094
1098
+ r_e_m_;1095
1099
+ eddie_money;1096
1100
+ ellie_goulding;1097
1101
+ gym_class_heroes;1098
1102
+ the_charlie_daniels_band;1099
1103
+ bette_midler;1100
1104
+ hubert_sumlin;1101
1105
+ phil_harris;1102
1106
+ arturo_benedetti_michelangeli;1103
1107
+ steps;1104
1108
+ simon_and_garfunkel;1105
1109
+ gyptian;1106
1110
+ britney_spears;1107
1111
+ lang_lang;1108
1112
+ blackstreet;1109
1113
+ the_dave_clark_five;1110
1114
+ the_chi_lites;1111
1115
+ wolfgang_amadeus_mozart;1112
1116
+ johnnie_ray;1113
1117
+ elvis_presley;1114
1118
+ red_norvo;1115
1119
+ the_velvet_underground;1116
1120
+ nelly_furtado;1117
1121
+ connee_boswell;1118
1122
+ soundgarden;1119
1123
+ dr_hook_the_medicine_show;1120
1124
+ led_zeppelin;1121
1125
+ boney_m_;1122
1126
+ gregor_piatigorsky;1123
1127
+ john_anderson;1124
1128
+ joni_james;1125
1129
+ the_all_american_rejects;1126
1130
+ marcia_griffiths;1127
1131
+ ben_bernie;1128
1132
+ eric_prydz;1129
1133
+ the_three_suns;1130
1134
+ albert_king;1131
1135
+ jodeci;1132
1136
+ inner_circle;1133
1137
+ don_cornell;1134
1138
+ jeff_healey;1135
1139
+ brian_mcknight;1136
1140
+ the_stranglers;1137
1141
+ adam_faith;1138
1142
+ francis_poulenc;1139
1143
+ fall_out_boy;1140
1144
+ the_jets;1141
1145
+ groundation;1142
1146
+ randy_newman;1143
1147
+ jane_s_addiction;1144
1148
+ bobby_vinton;1145
1149
+ guiomar_novaes;1146
1150
+ bo_diddley;1147
1151
+ philadelphia_orchestra;1148
1152
+ garrick_ohlsson;1149
1153
+ evanescence;1150
1154
+ wilhelm_backhaus;1151
1155
+ the_platters;1152
1156
+ the_seekers;1153
1157
+ selena_gomez;1154
1158
+ eddy_grant;1155
1159
+ jan_garber;1156
1160
+ gioacchino_rossini;1157
1161
+ christina_aguilera;1158
1162
+ stevie_nicks;1159
1163
+ color_me_badd;1160
1164
+ sandie_shaw;1161
1165
+ migos;1162
1166
+ the_allman_brothers_band;1163
1167
+ will_young;1164
1168
+ new_edition;1165
1169
+ radiohead;1166
1170
+ orbital;1167
1171
+ the_judds;1168
1172
+ dan_fogelberg;1169
1173
+ pascal_rog_;1170
1174
+ leona_lewis;1171
1175
+ charlie_patton;1172
1176
+ yann_tiersen;1173
1177
+ the_abyssinians;1174
1178
+ frank_ifield;1175
1179
+ john_mayer;1176
1180
+ roger_wolfe_kahn;1177
1181
+ the_mcguire_sisters;1178
1182
+ junior_reid;1179
1183
+ bukka_white;1180
1184
+ macy_gray;1181
1185
+ billy_currington;1182
1186
+ the_tremeloes;1183
1187
+ ac_dc;1184
1188
+ little_walter;1185
1189
+ gorillaz;1186
1190
+ the_hilltoppers;1187
1191
+ gil_shaham;1188
1192
+ little_mix;1189
1193
+ supertramp;1190
1194
+ third_world;1191
1195
+ david_garrett;1192
1196
+ the_lovin_spoonful;1193
1197
+ chris_lake;1194
1198
+ louis_lortie;1195
1199
+ shakira;1196
1200
+ vanessa_williams;1197
1201
+ the_bangles;1198
1202
+ mark_chesnutt;1199
1203
+ keith_whitley;1200
1204
+ roxy_music;1201
1205
+ betty_hutton;1202
1206
+ cheryl_cole;1203
1207
+ the_notorious_b_i_g_;1204
1208
+ kesha;1205
1209
+ boston;1206
1210
+ gerald_moore;1207
1211
+ heinrich_schiff;1208
1212
+ joy_division;1209
1213
+ kenny_loggins;1210
1214
+ nilsson;1211
1215
+ counting_crows;1212
1216
+ simply_red;1213
1217
+ aaron_tippin;1214
1218
+ sweet;1215
1219
+ sugababes;1216
1220
+ florida_georgia_line;1217
1221
+ lonnie_mack;1218
1222
+ jacob_miller;1219
1223
+ the_police;1220
1224
+ the_chordettes;1221
1225
+ fats_domino;1222
1226
+ willy_deville;1223
1227
+ bob_crosby;1224
1228
+ roy_clark;1225
1229
+ dinu_lipatti;1226
1230
+ alison_krauss;1227
1231
+ frankie_avalon;1228
1232
+ ella_mae_morse;1229
1233
+ linton_kwesi_johnson;1230
1234
+ glenn_frey;1231
1235
+ rudy_vall_e_his_connecticut_yankees;1232
1236
+ dj_snake;1233
1237
+ toots_the_maytals;1234
1238
+ annie_lennox;1235
1239
+ paramore;1236
1240
+ john_browning;1237
1241
+ sister_sledge;1238
1242
+ julian_lloyd_webber;1239
1243
+ kanye_west;1240
1244
+ christopher_cross;1241
1245
+ professor_longhair;1242
1246
+ flume;1243
1247
+ sophie_tucker;1244
1248
+ third_eye_blind;1245
1249
+ beyonc_;1246
1250
+ weezer;1247
1251
+ kelly_clarkson;1248
1252
+ take_that;1249
1253
+ ludwig_van_beethoven;1250
1254
+ the_cars;1251
1255
+ george_michael;1252
1256
+ chaka_khan;1253
1257
+ arty;1254
1258
+ steel_pulse;1255
1259
+ bunny_wailer;1256
1260
+ the_troggs;1257
1261
+ nick_lucas;1258
1262
+ keb_mo_;1259
1263
+ rise_against;1260
1264
+ mickey_gilley;1261
1265
+ poison;1262
1266
+ debbie_gibson;1263
1267
+ kim_wilde;1264
1268
+ sammy_davis_jr;1265
1269
+ jonas_brothers;1266
1270
+ cage_the_elephant;1267
1271
+ son_house;1268
1272
+ birth_control;1269
1273
+ faithless;1270
1274
+ cher;1271
1275
+ seether;1272
1276
+ new_kids_on_the_block;1273
1277
+ rage;1274
1278
+ richie_spice;1275
1279
+ sam_smith;1276
1280
+ the_marvelettes;1277
1281
+ the_jackson_5;1278
1282
+ bobbie_gentry;1279
1283
+ macklemore_ryan_lewis;1280
1284
+ s_club_7;1281
1285
+ billy_jones_ernest_hare;1282
1286
+ arcana;1283
1287
+ blasterjaxx;1284
1288
+ will_smith;1285
1289
+ ray_miller;1286
1290
+ sugar_ray;1287
1291
+ ziggy_marley_the_melody_makers;1288
1292
+ aaron_copland;1289
1293
+ diddy;1290
1294
+ daughtry;1291
1295
+ beach_house;1292
1296
+ the_dillinger_escape_plan;1293
1297
+ lonestar;1294
1298
+ foreigner;1295
1299
+ lionel_richie;1296
1300
+ roberta_flack;1297
1301
+ the_carter_family;1298
1302
+ demi_lovato;1299
1303
+ joseph_haydn;1300
1304
+ sander_van_doorn;1301
1305
+ underworld;1302
1306
+ deborah_cox;1303
1307
+ the_grass_roots;1304
1308
+ bananarama;1305
1309
+ iggy_azalea;1306
1310
+ 3_doors_down;1307
1311
+ the_partridge_family;1308
1312
+ lead_belly;1309
1313
+ johnny_long;1310
1314
+ jagged_edge;1311
1315
+ the_derek_trucks_band;1312
1316
+ eddie_fisher;1313
1317
+ pablo_casals;1314
1318
+ the_original_dixieland_jazz_band;1315
1319
+ miley_cyrus;1316
1320
+ john_powell;1317
1321
+ the_black_eyed_peas;1318
1322
+ edvard_grieg;1319
1323
+ maurizio_pollini;1320
1324
+ nathan_milstein;1321
1325
+ twenty_one_pilots;1322
1326
+ rudolf_firku_n_;1323
1327
+ nine_inch_nails;1324
1328
+ the_four_aces;1325
1329
+ jimmy_rogers;1326
1330
+ salt_n_pepa;1327
1331
+ yellow_claw;1328
1332
+ the_strokes;1329
1333
+ bobby_brown;1330
1334
+ juelz_santana;1331
1335
+ staind;1332
1336
+ bj_rn_ulvaeus_benny_andersson;1333
1337
+ the_j_geils_band;1334
1338
+ the_muppets;1335
1339
+ gwen_stefani;1336
1340
+ fedde_le_grand;1337
1341
+ imagine_dragons;1338
1342
+ leo_sayer;1339
1343
+ the_animals;1340
1344
+ the_b_52_s;1341
1345
+ furry_lewis;1342
1346
+ ciara;1343
1347
+ larry_clinton;1344
1348
+ dire_straits;1345
1349
+ pato_banton_the_reggae_revol;1346
1350
+ goodie_mob;1347
1351
+ disclosure;1348
1352
+ georges_bizet;1349
1353
+ sonny_terry_brownie_mcghee;1350
1354
+ jim_croce;1351
1355
+ nelson;1352
1356
+ jason_derulo;1353
1357
+ guy_mitchell;1354
1358
+ the_fontane_sisters;1355
1359
+ sonny_boy_williamson_i;1356
1360
+ mirah;1357
1361
+ jimmy_rushing;1358
1362
+ john_michael_montgomery;1359
1363
+ michael_nesmith;1360
1364
+ george_clinton;1361
1365
+ burt_bacharach;1362
1366
+ v6;1363
1367
+ slim_thug;1364
1368
+ belinda_carlisle;1365
1369
+ philip_glass;1366
1370
+ slade;1367
1371
+ pete_townshend;1368
1372
+ oingo_boingo;1369
1373
+ andrew_lloyd_webber;1370
1374
+ the_collectors;1371
1375
+ boy_george;1372
1376
+ utada_hikaru;1373
1377
+ mel_torm;1374
1378
+ diana_krall;1375
1379
+ melanie_c;1376
1380
+ john_hammond;1377
1381
+ peter_green_splinter_group;1378
1382
+ trouble;1379
1383
+ g_unit;1380
1384
+ ferlin_husky;1381
1385
+ arcade_fire;1382
1386
+ latino;1383
1387
+ krayzie_bone;1384
1388
+ man;1385
1389
+ dave_clark_five;1386
1390
+ the_stone_roses;1387
1391
+ young_jeezy;1388
1392
+ blood_sweat_tears;1389
1393
+ kumikameli;1390
1394
+ dmx;1391
1395
+ ice_cube;1392
1396
+ eagles;1393
1397
+ jill_scott;1394
1398
+ xtc;1395
1399
+ peggy_march;1396
1400
+ michael_bubl;1397
1401
+ raimon;1398
1402
+ two_mix;1399
1403
+ dulce_pontes;1400
1404
+ the_unseen;1401
1405
+ hank_locklin;1402
1406
+ the_notorious_b_i_g;1403
1407
+ bumblefoot;1404
1408
+ the_busters;1405
1409
+ rick_ross;1406
1410
+ tegan_and_sara;1407
1411
+ skeeter_davis;1408
1412
+ curtis_mayfield;1409
1413
+ sade;1410
1414
+ wings;1411
1415
+ lorrie_morgan;1412
1416
+ saga;1413
1417
+ a_r_rahman;1414
1418
+ martha_wainwright;1415
1419
+ nas;1416
1420
+ will_i_am;1417
1421
+ kirsty_maccoll;1418
1422
+ angel;1419
1423
+ dave_davies;1420
1424
+ iggy_pop;1421
1425
+ jojo;1422
1426
+ sammy_hagar;1423
1427
+ ray_davies;1424
1428
+ and_one;1425
1429
+ neil_young;1426
1430
+ mikael_wiehe;1427
1431
+ the_cardigans;1428
1432
+ cage;1429
1433
+ dottie_west;1430
1434
+ keri_hilson;1431
1435
+ johnny_hallyday;1432
1436
+ bill_nelson;1433
1437
+ fifteen;1434
1438
+ deen;1435
1439
+ bobby_v;1436
1440
+ lil_yachty;1437
1441
+ too_hort;1438
1442
+ bernard_lavilliers;1439
1443
+ hank_thompson;1440
1444
+ the_chieftains;1441
1445
+ daryl_hall;1442
1446
+ antonio_carlos_jobim;1443
1447
+ aventura;1444
1448
+ the_the;1445
1449
+ van_morrison;1446
1450
+ wynonna_judd;1447
1451
+ gomez;1448
1452
+ charles_aznavour;1449
1453
+ m83;1450
1454
+ gnr;1451
1455
+ all;1452
1456
+ emmylou_harris;1453
1457
+ lee_hazlewood;1454
1458
+ mew;1455
1459
+ uriah_heep;1456
1460
+ yoko_ono;1457
1461
+ abw_rts;1458
1462
+ john_legend;1459
1463
+ d12;1460
1464
+ kitty_wells;1461
1465
+ timbiriche;1462
1466
+ shel_silverstein;1463
1467
+ cam_ron;1464
1468
+ rosanne_cash;1465
1469
+ 2_chainz;1466
1470
+ tricky;1467
1471
+ 8ball_mjg;1468
1472
+ flatt_scruggs;1469
1473
+ bill_anderson;1470
1474
+ emil_ana_torrini;1471
1475
+ ufo;1472
1476
+ mos_def;1473
1477
+ danzig;1474
1478
+ juan_gabriel;1475
1479
+ common;1476
1480
+ raekwon;1477
1481
+ france_gall;1478
1482
+ nicole_scherzinger;1479
1483
+ r_yksopp;1480
1484
+ sammie;1481
1485
+ lena_horne;1482
1486
+ david_byrne;1483
1487
+ paul_williams;1484
1488
+ josh_groban;1485
1489
+ the_gathering;1486
1490
+ frank_boeijen;1487
1491
+ scooter;1488
1492
+ steve_wariner;1489
1493
+ mika;1490
1494
+ pete_seeger;1491
1495
+ tex_ritter;1492
1496
+ warrant;1493
1497
+ porter_wagoner;1494
1498
+ field_music;1495
1499
+ three_6_mafia;1496
1500
+ jim_jones;1497
1501
+ daniel_o_donnell;1498
1502
+ brentalfloss;1499
1503
+ wyclef_jean;1500
1504
+ hey;1501
1505
+ bizzy_bone;1502
1506
+ the_mccalmans;1503
1507
+ blues_traveler;1504
1508
+ massive_attack;1505
1509
+ woody_guthrie;1506
1510
+ art_garfunkel;1507
1511
+ andrea_bocelli;1508
1512
+ david_crosby;1509
1513
+ dream;1510
1514
+ soul_asylum;1511
1515
+ natalie_merchant;1512
1516
+ shawn_colvin;1513
1517
+ jonny_lang;1514
1518
+ funeral_for_a_friend;1515
1519
+ boz_scaggs;1516
1520
+ example;1517
1521
+ lionel_hampton;1518
1522
+ the_tubes;1519
1523
+ marc_anthony;1520
1524
+ good_riddance;1521
1525
+ moonlight;1522
1526
+ marc_almond;1523
1527
+ rza;1524
1528
+ die_rzte;1525
1529
+ rbd;1526
1530
+ alejandro_fern_ndez;1527
1531
+ wanda_jackson;1528
1532
+ lara_fabian;1529
1533
+ julio_iglesias;1530
1534
+ jeff_beck;1531
1535
+ peabo_bryson;1532
1536
+ no_fun_at_all;1533
1537
+ prong;1534
1538
+ canibus;1535
1539
+ krs_one;1536
1540
+ u_s_bombs;1537
1541
+ trust;1538
1542
+ stonewall_jackson;1539
1543
+ jos_feliciano;1540
1544
+ m_a;1541
1545
+ polysics;1542
1546
+ n_e_r_d;1543
1547
+ sesame_street;1544
1548
+ lio;1545
1549
+ myl_ne_farmer;1546
1550
+ iris_dement;1547
1551
+ lily_allen;1548
1552
+ spoken;1549
1553
+ architects;1550
1554
+ jack_johnson;1551
1555
+ molly_hatchet;1552
1556
+ cypress_hill;1553
1557
+ future;1554
1558
+ the_nits;1555
1559
+ per_gessle;1556
1560
+ live;1557
1561
+ beau;1558
1562
+ deana_carter;1559
1563
+ lil_flip;1560
1564
+ fran_oise_hardy;1561
1565
+ billy_ray_cyrus;1562
1566
+ pepper;1563
1567
+ run_d_m_c;1564
1568
+ levon_helm;1565
1569
+ insane_clown_posse;1566
1570
+ stars;1567
1571
+ jean_michel_jarre;1568
1572
+ thunder;1569
1573
+ juanes;1570
1574
+ simple_plan;1571
1575
+ method_man;1572
1576
+ smash_mouth;1573
1577
+ meek_mill;1574
1578
+ fat_joe;1575
1579
+ kenny_wayne_shepherd;1576
1580
+ jhen_aiko;1577
1581
+ the_manhattan_transfer;1578
1582
+ joss_stone;1579
1583
+ cee_lo_green;1580
1584
+ tyrese;1581
1585
+ charlotte_martin;1582
1586
+ rodney_crowell;1583
1587
+ acappella;1584
1588
+ die_prinzen;1585
1589
+ pentatonix;1586
1590
+ abney_park;1587
1591
+ smooth_mcgroove;1588
1592
+ the_magnetic_fields;1589
1593
+ the_nylons;1590
1594
+ wise_guys;1591
1595
+ coil;1592
1596
+ do_as_infinity;1593
1597
+ lords_of_acid;1594
1598
+ the_church;1595
1599
+ chris_rea;1596
1600
+ jota_quest;1597
1601
+ miguel_bos;1598
1602
+ gang_starr;1599
1603
+ masta_ace;1600
1604
+ brand_new;1601
1605
+ mac_miller;1602
1606
+ cathedral;1603
1607
+ corrosion_of_conformity;1604
1608
+ country_joe_mcdonald;1605
1609
+ eric_johnson;1606
1610
+ grateful_dead;1607
1611
+ janis_joplin;1608
1612
+ john_miles;1609
1613
+ king_gizzard_the_lizard_wizard;1610
1614
+ ted_nugent;1611
1615
+ combichrist;1612
1616
+ alkaline_trio;1613
1617
+ anathema;1614
1618
+ angus_julia_stone;1615
1619
+ anna_ternheim;1616
1620
+ anthony_phillips;1617
1621
+ steve_hackett;1618
1622
+ aviators;1619
1623
+ banda_calypso;1620
1624
+ blue_stahli;1621
1625
+ the_boys;1622
1626
+ capital_inicial;1623
1627
+ city_and_colour;1624
1628
+ colin_hay;1625
1629
+ collective_soul;1626
1630
+ dashboard_confessional;1627
1631
+ david_rovics;1628
1632
+ david_usher;1629
1633
+ die_toten_hosen;1630
1634
+ funny_van_dannen;1631
1635
+ dirty_heads;1632
1636
+ tech_n9ne;1633
1637
+ elisa;1634
1638
+ emmerson_nogueira;1635
1639
+ engenheiros_do_hawaii;1636
1640
+ eric_bibb;1637
1641
+ maria_muldaur;1638
1642
+ panic_at_the_disco;1639
1643
+ punchline;1640
1644
+ godsmack;1641
1645
+ self;1642
1646
+ heideroosjes;1643
1647
+ sinner;1644
1648
+ heather_nova;1645
1649
+ hoobastank;1646
1650
+ quietdrive;1647
1651
+ hyde;1648
1652
+ jaguares;1649
1653
+ bert_jansch;1650
1654
+ jonatha_brooke;1651
1655
+ joni_mitchell;1652
1656
+ the_band;1653
1657
+ josh_garrels;1654
1658
+ josh_woodward;1655
1659
+ william_fitzsimmons;1656
1660
+ katie_melua;1657
1661
+ jamie_cullum;1658
1662
+ kristin_hersh;1659
1663
+ kt_tunstall;1660
1664
+ legi_o_urbana;1661
1665
+ the_zombies;1662
1666
+ francesco_de_gregori;1663
1667
+ m_ward;1664
1668
+ beth_orton;1665
1669
+ magnum;1666
1670
+ motorpsycho;1667
1671
+ marillion;1668
1672
+ jars_of_clay;1669
1673
+ mason_jennings;1670
1674
+ matt_nathanson;1671
1675
+ matthew_good;1672
1676
+ edguy;1673
1677
+ gamma_ray;1674
1678
+ minus_the_bear;1675
1679
+ mohsen_namjoo;1676
1680
+ nerina_pallot;1677
1681
+ never_shout_never;1678
1682
+ regina_spektor;1679
1683
+ passenger;1680
1684
+ paul_kelly;1681
1685
+ the_style_council;1682
1686
+ peter_hammill;1683
1687
+ phantom_planet;1684
1688
+ phil_keaggy;1685
1689
+ richard_thompson;1686
1690
+ said_the_whale;1687
1691
+ samsas_traum;1688
1692
+ senses_fail;1689
1693
+ sevendust;1690
1694
+ seventh_day_slumber;1691
1695
+ joan_baez;1692
1696
+ sister_hazel;1693
1697
+ slightly_stoopid;1694
1698
+ sophie_zelmani;1695
1699
+ suzanne_vega;1696
1700
+ tatiana;1697
1701
+ teoman;1698
1702
+ the_choir;1699
1703
+ charlotte_church;1700
1704
+ darlene_zschech;1701
1705
+ the_front_bottoms;1702
1706
+ the_maine;1703
1707
+ the_white_buffalo;1704
1708
+ little_big_town;1705
1709
+ threshold;1706
1710
+ tourniquet;1707
1711
+ everything_but_the_girl;1708
1712
+ vertical_horizon;1709
1713
+ vonda_shepard;1710
1714
+ warren_zevon;1711
1715
+ sarah_brightman;1712
1716
+ blackfoot;1713
1717
+ black_label_society;1714
1718
+ z_lia_duncan;1715
1719
+ 2;1716
1720
+ alejandro_lerner;1717
1721
+ beth_nielsen_chapman;1718
1722
+ mercury_rev;1719
1723
+ brian_wilson;1720
1724
+ barenaked_ladies;1721
1725
+ carbon_leaf;1722
1726
+ celtic_woman;1723
1727
+ hayley_westenra;1724
1728
+ crowded_house;1725
1729
+ delta_goodrem;1726
1730
+ elbow;1727
1731
+ resurrection_band;1728
1732
+ nancy_wilson;1729
1733
+ janis_ian;1730
1734
+ jann_arden;1731
1735
+ jill_sobule;1732
1736
+ jos_augusto;1733
1737
+ xuxa;1734
1738
+ k_d_lang;1735
1739
+ kim_carnes;1736
1740
+ los_lobos;1737
1741
+ mandy_moore;1738
1742
+ marc_cohn;1739
1743
+ maureen_mcgovern;1740
1744
+ melissa_manchester;1741
1745
+ patti_labelle;1742
1746
+ helene_fischer;1743
1747
+ laura_pausini;1744
1748
+ ivan_lins;1745
1749
+ thal_a;1746
1750
+ mike_the_mechanics;1747
1751
+ paul_carrack;1748
1752
+ natasha_st_pier;1749
1753
+ michael_mcdonald;1750
1754
+ olivia;1751
1755
+ dizzee_rascal;1752
1756
+ sam_phillips;1753
1757
+ serge_gainsbourg;1754
1758
+ jane_birkin;1755
1759
+ luis_miguel;1756
1760
+ sondre_lerche;1757
1761
+ stan_ridgway;1758
1762
+ susan_boyle;1759
1763
+ mike_oldfield;1760
1764
+ ces_ria_vora;1761
1765
+ agonoize;1762
1766
+ funker_vogt;1763
1767
+ god_module;1764
1768
+ hocico;1765
1769
+ nachtmahr;1766
1770
+ suicide_commando;1767
1771
+ alejandro_escovedo;1768
1772
+ southside_johnny_the_asbury_jukes;1769
1773
+ broken_social_scene;1770
1774
+ vigilantes_of_love;1771
1775
+ billy_bragg;1772
1776
+ wilco;1773
1777
+ frank_black_and_the_catholics;1774
1778
+ blue_rodeo;1775
1779
+ brandi_carlile;1776
1780
+ patty_griffin;1777
1781
+ calexico;1778
1782
+ cass_mccombs;1779
1783
+ chris_knight;1780
1784
+ conor_oberst;1781
1785
+ corb_lund;1782
1786
+ cowboy_junkies;1783
1787
+ cracker;1784
1788
+ cross_canadian_ragweed;1785
1789
+ dave_alvin;1786
1790
+ drive_by_truckers;1787
1791
+ eleni_mandell;1788
1792
+ lucinda_williams;1789
1793
+ fred_eaglesmith;1790
1794
+ dar_williams;1791
1795
+ the_jayhawks;1792
1796
+ lana_del_rey;1793
1797
+ tim_o_brien;1794
1798
+ hank_williams_iii;1795
1799
+ james_mcmurtry;1796
1800
+ joe_henry;1797
1801
+ john_stewart;1798
1802
+ josh_ritter;1799
1803
+ lambchop;1800
1804
+ nanci_griffith;1801
1805
+ norma_jean;1802
1806
+ lyle_lovett;1803
1807
+ matthew_ryan;1804
1808
+ my_morning_jacket;1805
1809
+ neko_case;1806
1810
+ the_new_pornographers;1807
1811
+ blue_october;1808
1812
+ okkervil_river;1809
1813
+ old_97_s;1810
1814
+ ray_wylie_hubbard;1811
1815
+ richmond_fontaine;1812
1816
+ robert_earl_keen;1813
1817
+ rocky_votolato;1814
1818
+ ryan_adams;1815
1819
+ whiskeytown;1816
1820
+ son_volt;1817
1821
+ steve_earle;1818
1822
+ the_avett_brothers;1819
1823
+ the_bottle_rockets;1820
1824
+ the_felice_brothers;1821
1825
+ arlo_guthrie;1822
1826
+ the_handsome_family;1823
1827
+ the_mavericks;1824
1828
+ ten_years_after;1825
1829
+ the_walkabouts;1826
1830
+ todd_snider;1827
1831
+ vic_chesnutt;1828
1832
+ iron_wine;1829
1833
+ wovenhand;1830
1834
+ x;1831
1835
+ big_audio_dynamite;1832
1836
+ globe;1833
1837
+ carter_the_unstoppable_sex_machine;1834
1838
+ allison_moorer;1835
1839
+ front_line_assembly;1836
1840
+ the_national;1837
1841
+ the_fall;1838
1842
+ public_image_ltd;1839
1843
+ public_enemy;1840
1844
+ wire;1841
1845
+ a_tribe_called_quest;1842
1846
+ de_la_soul;1843
1847
+ aesop_rock;1844
1848
+ buck_65;1845
1849
+ caparezza;1846
1850
+ childish_gambino;1847
1851
+ the_roots;1848
1852
+ colbie_caillat;1849
1853
+ big_sean;1850
1854
+ dj_gruff;1851
1855
+ tyler_the_creator;1852
1856
+ dokken;1853
1857
+ fun_lovin_criminals;1854
1858
+ talib_kweli;1855
1859
+ jane_air;1856
1860
+ k_i_z;1857
1861
+ kid_cudi;1858
1862
+ jedi_mind_tricks;1859
1863
+ celph_titled;1860
1864
+ lupe_fiasco;1861
1865
+ bun_b;1862
1866
+ scarface;1863
1867
+ ghostface_killah;1864
1868
+ robyn;1865
1869
+ rehab;1866
1870
+ swollen_members;1867
1871
+ styles_p;1868
1872
+ the_streets;1869
1873
+ wale;1870
1874
+ joe_budden;1871
1875
+ tank;1872
1876
+ 10_years;1873
1877
+ 36_crazyfists;1874
1878
+ apocalyptica;1875
1879
+ nina_hagen;1876
1880
+ anastacia;1877
1881
+ black_stone_cherry;1878
1882
+ blindside;1879
1883
+ breaking_benjamin;1880
1884
+ bring_me_the_horizon;1881
1885
+ bullet_for_my_valentine;1882
1886
+ cave_in;1883
1887
+ chevelle;1884
1888
+ d_espairsray;1885
1889
+ death_angel;1886
1890
+ deftones;1887
1891
+ demon_hunter;1888
1892
+ demon;1889
1893
+ devin_townsend_project;1890
1894
+ devin_townsend;1891
1895
+ doa;1892
1896
+ dir_en_grey;1893
1897
+ disturbed;1894
1898
+ dope;1895
1899
+ drowning_pool;1896
1900
+ eighteen_visions;1897
1901
+ entombed;1898
1902
+ faith_no_more;1899
1903
+ fear_factory;1900
1904
+ fightstar;1901
1905
+ five_finger_death_punch;1902
1906
+ finger_eleven;1903
1907
+ flyleaf;1904
1908
+ grinspoon;1905
1909
+ guano_apes;1906
1910
+ h_blockx;1907
1911
+ halestorm;1908
1912
+ hamlet;1909
1913
+ helmet;1910
1914
+ bt;1911
1915
+ ill_ni_o;1912
1916
+ in_flames;1913
1917
+ in_this_moment;1914
1918
+ him;1915
1919
+ j_b_o;1916
1920
+ katatonia;1917
1921
+ killswitch_engage;1918
1922
+ xzibit;1919
1923
+ lacuna_coil;1920
1924
+ phish;1921
1925
+ limp_bizkit;1922
1926
+ living_colour;1923
1927
+ viikate;1924
1928
+ marilyn_manson;1925
1929
+ megaherz;1926
1930
+ falco;1927
1931
+ melvins;1928
1932
+ monster_magnet;1929
1933
+ mushroomhead;1930
1934
+ nonpoint;1931
1935
+ soil;1932
1936
+ otep;1933
1937
+ p_o_d;1934
1938
+ powerman_5000;1935
1939
+ primus;1936
1940
+ project_86;1937
1941
+ red;1938
1942
+ kris_allen;1939
1943
+ rob_zombie;1940
1944
+ ozzy_osbourne;1941
1945
+ rollins_band;1942
1946
+ saliva;1943
1947
+ sepultura;1944
1948
+ shihad;1945
1949
+ skillet;1946
1950
+ skindred;1947
1951
+ slipknot;1948
1952
+ smile_empty_soul;1949
1953
+ danielson;1950
1954
+ soilwork;1951
1955
+ sonic_syndicate;1952
1956
+ static_x;1953
1957
+ stone_sour;1954
1958
+ taproot;1955
1959
+ the_notwist;1956
1960
+ the_word_alive;1957
1961
+ theory_of_a_deadman;1958
1962
+ therapy;1959
1963
+ los_tucanes_de_tijuana;1960
1964
+ manu_chao;1961
1965
+ volbeat;1962
1966
+ zebrahead;1963
1967
+ hed_p_e;1964
1968
+ and_you_will_know_us_by_the_trail_of_dead;1965
1969
+ 10_000_maniacs;1966
1970
+ 311;1967
1971
+ 77s;1968
1972
+ yes;1969
1973
+ david_lee_roth;1970
1974
+ hillsong;1971
1975
+ afi;1972
1976
+ adam_sandler;1973
1977
+ afterhours;1974
1978
+ hawkwind;1975
1979
+ all_about_eve;1976
1980
+ all_time_low;1977
1981
+ allison_crowe;1978
1982
+ amanda_palmer;1979
1983
+ american_music_club;1980
1984
+ amplifier;1981
1985
+ robert_wyatt;1982
1986
+ anberlin;1983
1987
+ andrew_bird;1984
1988
+ ani_difranco;1985
1989
+ apoptygma_berzerk;1986
1990
+ apulanta;1987
1991
+ arab_strap;1988
1992
+ joseph_arthur;1989
1993
+ tom_rosenthal;1990
1994
+ ash;1991
1995
+ asian_kung_fu_generation;1992
1996
+ poets_of_the_fall;1993
1997
+ babas_nicos;1994
1998
+ bayside;1995
1999
+ beatsteaks;1996
2000
+ ben_folds;1997
2001
+ ben_folds_five;1998
2002
+ ben_harper;1999
2003
+ better_than_ezra;2000
2004
+ bettie_serveert;2001
2005
+ big_country;2002
2006
+ big_head_todd_and_the_monsters;2003
2007
+ big_sugar;2004
2008
+ billy_talent;2005
2009
+ today_is_the_day;2006
2010
+ red_flag;2007
2011
+ black_rebel_motorcycle_club;2008
2012
+ megadeth;2009
2013
+ blonde_redhead;2010
2014
+ bob_mould;2011
2015
+ bodeans;2012
2016
+ bowling_for_soup;2013
2017
+ buck_tick;2014
2018
+ butch_walker;2015
2019
+ butthole_surfers;2016
2020
+ caf_tacvba;2017
2021
+ cake;2018
2022
+ camper_van_beethoven;2019
2023
+ carmen_consoli;2020
2024
+ mario_venuti;2021
2025
+ franco_battiato;2022
2026
+ catherine_wheel;2023
2027
+ catupecu_machu;2024
2028
+ cem_adrian;2025
2029
+ john_cale;2026
2030
+ charlie_brown_jr;2027
2031
+ nena;2028
2032
+ chumbawamba;2029
2033
+ clutch;2030
2034
+ cl;2031
2035
+ cmx;2032
2036
+ coheed_and_cambria;2033
2037
+ cold_war_kids;2034
2038
+ travis;2035
2039
+ coma;2036
2040
+ concrete_blonde;2037
2041
+ mint_condition;2038
2042
+ copeland;2039
2043
+ crash_test_dummies;2040
2044
+ joe_jackson;2041
2045
+ cristian_castro;2042
2046
+ curve;2043
2047
+ dada;2044
2048
+ daniel_amos;2045
2049
+ daniel_johnston;2046
2050
+ dave_matthews_band;2047
2051
+ burning_heads;2048
2052
+ david_gray;2049
2053
+ david_sylvian;2050
2054
+ deacon_blue;2051
2055
+ deerhoof;2052
2056
+ del_amitri;2053
2057
+ dinosaur_jr;2054
2058
+ dirty_projectors;2055
2059
+ draco_rosa;2056
2060
+ duncan_sheik;2057
2061
+ jeremy_camp;2058
2062
+ edwyn_collins;2059
2063
+ eels;2060
2064
+ nightwish;2061
2065
+ element_of_crime;2062
2066
+ embrace;2063
2067
+ enter_shikari;2064
2068
+ ulver;2065
2069
+ everclear;2066
2070
+ everlast;2067
2071
+ eyeshine;2068
2072
+ dio;2069
2073
+ faust_o;2070
2074
+ feeder;2071
2075
+ atmosphere;2072
2076
+ filter;2073
2077
+ firewater;2074
2078
+ fishbone;2075
2079
+ fountains_of_wayne;2076
2080
+ four_year_strong;2077
2081
+ steve_green;2078
2082
+ fresno;2079
2083
+ gang_of_four;2080
2084
+ good_charlotte;2081
2085
+ blood_on_the_dance_floor;2082
2086
+ graham_coxon;2083
2087
+ melissa_etheridge;2084
2088
+ tony_joe_white;2085
2089
+ guided_by_voices;2086
2090
+ robert_pollard;2087
2091
+ guster;2088
2092
+ elliott_smith;2089
2093
+ hedley;2090
2094
+ hole;2091
2095
+ hollywood_undead;2092
2096
+ hot_chip;2093
2097
+ l_arc_en_ciel;2094
2098
+ ian_brown;2095
2099
+ idlewild;2096
2100
+ jimmy_eat_world;2097
2101
+ fish;2098
2102
+ ingrid_michaelson;2099
2103
+ inme;2100
2104
+ inspiral_carpets;2101
2105
+ raf;2102
2106
+ james;2103
2107
+ jean_leloup;2104
2108
+ weird_al_yankovic;2105
2109
+ jeff_buckley;2106
2110
+ john_frusciante;2107
2111
+ dr_john;2108
2112
+ pj_harvey;2109
2113
+ jonathan_coulton;2110
2114
+ juliana_hatfield;2111
2115
+ julieta_venegas;2112
2116
+ k_s_choice;2113
2117
+ kaizers_orchestra;2114
2118
+ kargo;2115
2119
+ kasabian;2116
2120
+ keane;2117
2121
+ kevin_coyne;2118
2122
+ kevin_devine;2119
2123
+ kevin_max;2120
2124
+ rich_mullins;2121
2125
+ trooper;2122
2126
+ suzy_bogguss;2123
2127
+ kill_hannah;2124
2128
+ kisp_l_s_a_borz;2125
2129
+ kult;2126
2130
+ my_life_with_the_thrill_kill_kult;2127
2131
+ kutless;2128
2132
+ la_barranca;2129
2133
+ la_ley;2130
2134
+ lao_che;2131
2135
+ lech_janerka;2132
2136
+ les_cowboys_fringants;2133
2137
+ les_fatals_picards;2134
2138
+ les_rita_mitsouko;2135
2139
+ sparks;2136
2140
+ lifehouse;2137
2141
+ lisa_germano;2138
2142
+ ed_harcourt;2139
2143
+ lisa_loeb;2140
2144
+ liz_phair;2141
2145
+ local_h;2142
2146
+ lost_dogs;2143
2147
+ lostprophets;2144
2148
+ love_and_rockets;2145
2149
+ lucybell;2146
2150
+ lulu_santos;2147
2151
+ gabriel_o_pensador;2148
2152
+ adam_lambert;2149
2153
+ madrugada;2150
2154
+ mancha_de_rolando;2151
2155
+ manchester_orchestra;2152
2156
+ mando_diao;2153
2157
+ foetus;2154
2158
+ mark_lanegan;2155
2159
+ matthew_sweet;2156
2160
+ max_mo_park;2157
2161
+ mayday_parade;2158
2162
+ meat_puppets;2159
2163
+ men_without_hats;2160
2164
+ meshell_ndegeocello;2161
2165
+ midnight_oil;2162
2166
+ dance_gavin_dance;2163
2167
+ molotov;2164
2168
+ ov7;2165
2169
+ monkey_majik;2166
2170
+ suede;2167
2171
+ fernando_ortega;2168
2172
+ motion_city_soundtrack;2169
2173
+ mudhoney;2170
2174
+ mutemath;2171
2175
+ mercyme;2172
2176
+ m_o_morta;2173
2177
+ natalia_lafourcade;2174
2178
+ natewantstobattle;2175
2179
+ needtobreathe;2176
2180
+ split_enz;2177
2181
+ sum_41;2178
2182
+ no_te_va_gustar;2179
2183
+ noir_d_sir;2180
2184
+ t_tes_raides;2181
2185
+ o_rappa;2182
2186
+ o_a_r;2183
2187
+ ocean_colour_scene;2184
2188
+ omul_cu_obolani;2185
2189
+ one_ok_rock;2186
2190
+ 2raumwohnung;2187
2191
+ our_lady_peace;2188
2192
+ pain;2189
2193
+ panda;2190
2194
+ parokya_ni_edgar;2191
2195
+ pato_fu;2192
2196
+ paul_westerberg;2193
2197
+ pere_ubu;2194
2198
+ pete_yorn;2195
2199
+ peter_murphy;2196
2200
+ placebo;2197
2201
+ plain_white_t_s;2198
2202
+ pop_will_eat_itself;2199
2203
+ porcupine_tree;2200
2204
+ powderfinger;2201
2205
+ cat_power;2202
2206
+ casting_crowns;2203
2207
+ primal_scream;2204
2208
+ m_tley_cr_e;2205
2209
+ the_used;2206
2210
+ raimundos;2207
2211
+ mark_knopfler;2208
2212
+ mark_kozelek;2209
2213
+ danko_jones;2210
2214
+ relient_k;2211
2215
+ raffi;2212
2216
+ renaud;2213
2217
+ richard_hawley;2214
2218
+ rickie_lee_jones;2215
2219
+ the_shins;2216
2220
+ rilo_kiley;2217
2221
+ robyn_hitchcock;2218
2222
+ mose_allison;2219
2223
+ roy_harper;2220
2224
+ rucka_rucka_ali;2221
2225
+ rx_bandits;2222
2226
+ saez;2223
2227
+ samiam;2224
2228
+ sarah_slean;2225
2229
+ say_anything;2226
2230
+ scout_niblett;2227
2231
+ screaming_females;2228
2232
+ shannon_wright;2229
2233
+ silverchair;2230
2234
+ sin_ad_o_connor;2231
2235
+ siouxsie_and_the_banshees;2232
2236
+ sixpence_none_the_richer;2233
2237
+ skank;2234
2238
+ skunk_anansie;2235
2239
+ sleater_kinney;2236
2240
+ sloan;2237
2241
+ social_distortion;2238
2242
+ sophie_hunger;2239
2243
+ e_40;2240
2244
+ steve_wynn;2241
2245
+ subsonica;2242
2246
+ joe_walsh;2243
2247
+ super_furry_animals;2244
2248
+ superchunk;2245
2249
+ supergrass;2246
2250
+ swervedriver;2247
2251
+ switchfoot;2248
2252
+ dido;2249
2253
+ takida;2250
2254
+ taking_back_sunday;2251
2255
+ teenage_fanclub;2252
2256
+ w_a_s_p;2253
2257
+ the_afghan_whigs;2254
2258
+ the_apples_in_stereo;2255
2259
+ the_ataris;2256
2260
+ smoking_popes;2257
2261
+ the_bluetones;2258
2262
+ the_breeders;2259
2263
+ the_cat_empire;2260
2264
+ the_charlatans_uk;2261
2265
+ the_clarks;2262
2266
+ guy_clark;2263
2267
+ the_comsat_angels;2264
2268
+ the_connells;2265
2269
+ the_coral;2266
2270
+ the_cribs;2267
2271
+ the_cult;2268
2272
+ bobby_o;2269
2273
+ the_mission;2270
2274
+ blue_yster_cult;2271
2275
+ the_dandy_warhols;2272
2276
+ the_dear_hunter;2273
2277
+ the_decemberists;2274
2278
+ the_early_november;2275
2279
+ thievery_corporation;2276
2280
+ the_fratellis;2277
2281
+ the_gaslight_anthem;2278
2282
+ jim_brickman;2279
2283
+ falling_up;2280
2284
+ the_hives;2281
2285
+ the_innocence_mission;2282
2286
+ the_jazz_butcher;2283
2287
+ the_jesus_lizard;2284
2288
+ the_lemonheads;2285
2289
+ babyshambles;2286
2290
+ the_living_end;2287
2291
+ the_matrixx;2288
2292
+ the_mother_hips;2289
2293
+ the_mountain_goats;2290
2294
+ the_muffs;2291
2295
+ the_pillows;2292
2296
+ the_posies;2293
2297
+ the_presidents_of_the_united_states_of_america;2294
2298
+ the_rasmus;2295
2299
+ the_raveonettes;2296
2300
+ the_saints;2297
2301
+ the_samples;2298
2302
+ bad_religion;2299
2303
+ the_smithereens;2300
2304
+ the_soundtrack_of_our_lives;2301
2305
+ the_tea_party;2302
2306
+ mayday;2303
2307
+ the_triffids;2304
2308
+ the_vines;2305
2309
+ the_violet_burning;2306
2310
+ the_wallflowers;2307
2311
+ testament;2308
2312
+ the_divine_comedy;2309
2313
+ third_day;2310
2314
+ thrice;2311
2315
+ tindersticks;2312
2316
+ tism;2313
2317
+ tit_s;2314
2318
+ toad_the_wet_sprocket;2315
2319
+ tocotronic;2316
2320
+ tom_mcrae;2317
2321
+ tori_amos;2318
2322
+ tracy_chapman;2319
2323
+ trashcan_sinatras;2320
2324
+ tre_allegri_ragazzi_morti;2321
2325
+ tub_ring;2322
2326
+ unkle;2323
2327
+ unwritten_law;2324
2328
+ uverworld;2325
2329
+ vast;2326
2330
+ verdena;2327
2331
+ veruca_salt;2328
2332
+ face_to_face;2329
2333
+ virus;2330
2334
+ voltaire;2331
2335
+ we_the_kings;2332
2336
+ the_kooks;2333
2337
+ lindisfarne;2334
2338
+ seals_crofts;2335
2339
+ andy_partridge;2336
2340
+ xutos_pontap_s;2337
2341
+ yellowcard;2338
2342
+ yup;2339
2343
+ leevi_and_the_leavings;2340
2344
+ zo;2341
2345
+ zucchero;2342
2346
+ z;2343
2347
+ ebnem_ferah;2344
2348
+ air;2345
2349
+ alice;2346
2350
+ boards_of_canada;2347
2351
+ brian_eno;2348
2352
+ burzum;2349
2353
+ daniel_lanois;2350
2354
+ enigma;2351
2355
+ juana_molina;2352
2356
+ lisa_gerrard;2353
2357
+ nox_arcana;2354
2358
+ renard;2355
2359
+ schiller;2356
2360
+ sigur_r_s;2357
2361
+ steven_wilson;2358
2362
+ swans;2359
2363
+ wolfgun;2360
2364
+ xiu_xiu;2361
2365
+ michael_johnson;2362
2366
+ montgomery_gentry;2363
2367
+ the_stanley_brothers;2364
2368
+ john_waite;2365
2369
+ shelby_lynne;2366
2370
+ judy_collins;2367
2371
+ burl_ives;2368
2372
+ the_irish_rovers;2369
2373
+ david_wilcox;2370
2374
+ devendra_banhart;2371
2375
+ doc_watson;2372
2376
+ bill_monroe;2373
2377
+ michael_martin_murphey;2374
2378
+ gordon_bok;2375
2379
+ asleep_at_the_wheel;2376
2380
+ the_browns;2377
2381
+ nana_mouskouri;2378
2382
+ jerry_jeff_walker;2379
2383
+ steve_goodman;2380
2384
+ malcolm_holcombe;2381
2385
+ malvina_reynolds;2382
2386
+ odetta;2383
2387
+ tom_paxton;2384
2388
+ strawbs;2385
2389
+ phil_ochs;2386
2390
+ harry_chapin;2387
2391
+ ramblin_jack_elliott;2388
2392
+ roger_mcguinn;2389
2393
+ gene_clark;2390
2394
+ mat_kearney;2391
2395
+ the_brothers_four;2392
2396
+ tom_russell;2393
2397
+ townes_van_zandt;2394
2398
+ uncle_dave_macon;2395
2399
+ delbert_mcclinton;2396
2400
+ john_hiatt;2397
2401
+ justin_townes_earle;2398
2402
+ mark_erelli;2399
2403
+ over_the_rhine;2400
2404
+ steve_forbert;2401
2405
+ manfred_mann_s_earth_band;2402
2406
+ mot_rhead;2403
2407
+ rudimentary_peni;2404
2408
+ illapu;2405
2409
+ inti_illimani;2406
2410
+ quilapay_n;2407
2411
+ v_ctor_jara;2408
2412
+ skylark;2409
2413
+ adam_green;2410
2414
+ cold_chisel;2411
2415
+ guy_sebastian;2412
2416
+ jefferson_starship;2413
2417
+ the_alan_parsons_project;2414
2418
+ ali_project;2415
2419
+ modern_talking;2416
2420
+ animal_collective;2417
2421
+ banco_del_mutuo_soccorso;2418
2422
+ ben_lee;2419
2423
+ bryan_ferry;2420
2424
+ buffy_sainte_marie;2421
2425
+ colin_blunstone;2422
2426
+ cursive;2423
2427
+ elysian_fields;2424
2428
+ emerson_lake_palmer;2425
2429
+ gino_vannelli;2426
2430
+ g_rard_manset;2427
2431
+ hot_dad;2428
2432
+ marina_and_the_diamonds;2429
2433
+ ismo_alanko;2430
2434
+ kansas;2431
2435
+ kari_peitsamo;2432
2436
+ laibach;2433
2437
+ laurie_anderson;2434
2438
+ puhdys;2435
2439
+ na_o_zumbi;2436
2440
+ roger_waters;2437
2441
+ rush;2438
2442
+ the_walker_brothers;2439
2443
+ hilltop_hoods;2440
2444
+ wolfgang_ambros;2441
2445
+ erste_allgemeine_verunsicherung;2442
2446
+ jacques_brel;2443
2447
+ rainhard_fendrich;2444
2448
+ tom_waits;2445
2449
+ adrian_belew;2446
2450
+ anne_clark;2447
2451
+ can;2448
2452
+ captain_beefheart_and_the_magic_band;2449
2453
+ deine_lakaien;2450
2454
+ devo;2451
2455
+ einst_rzende_neubauten;2452
2456
+ frank_zappa;2453
2457
+ goethes_erben;2454
2458
+ wishbone_ash;2455
2459
+ death_cab_for_cutie;2456
2460
+ antony_and_the_johnsons;2457
2461
+ jandek;2458
2462
+ nevermore;2459
2463
+ king_crimson;2460
2464
+ king_missile;2461
2465
+ the_residents;2462
2466
+ steeleye_span;2463
2467
+ vampire_rodents;2464
2468
+ the_walkmen;2465
2469
+ dog_fashion_disco;2466
2470
+ freak_kitchen;2467
2471
+ sigh;2468
2472
+ children_of_bodom;2469
2473
+ soft_machine;2470
2474
+ ara_ketu;2471
2475
+ asa_de_guia;2472
2476
+ banda_eva;2473
2477
+ ivete_sangalo;2474
2478
+ chiclete_com_banana;2475
2479
+ daniela_mercury;2476
2480
+ alejandro_sanz;2477
2481
+ timbalada;2478
2482
+ juan_luis_guerra;2479
2483
+ daddy_yankee;2480
2484
+ alceu_valen_a;2481
2485
+ luiz_gonzaga;2482
2486
+ matia_bazar;2483
2487
+ axelle_red;2484
2488
+ barbara;2485
2489
+ benny_neyman;2486
2490
+ gigi_d_agostino;2487
2491
+ jacques_higelin;2488
2492
+ caetano_veloso;2489
2493
+ gal_costa;2490
2494
+ jorge_ben;2491
2495
+ die_flippers;2492
2496
+ nicole;2493
2497
+ angra;2494
2498
+ reinhard_mey;2495
2499
+ wolf_biermann;2496
2500
+ florent_pagny;2497
2501
+ hannes_wader;2498
2502
+ tienne_daho;2499
2503
+ henri_salvador;2500
2504
+ f_lix_leclerc;2501
2505
+ daniel_lavoie;2502
2506
+ gerhard_sch_ne;2503
2507
+ g_lben_ergen;2504
2508
+ georg_kreisler;2505
2509
+ herbert_gr_nemeyer;2506
2510
+ herman_van_veen;2507
2511
+ hildegard_knef;2508
2512
+ marlene_dietrich;2509
2513
+ iu;2510
2514
+ jos_luis_rodr_guez;2511
2515
+ juliette_gr_co;2512
2516
+ klaus_hoffmann;2513
2517
+ konstantin_wecker;2514
2518
+ saltatio_mortis;2515
2519
+ luigi_tenco;2516
2520
+ maria_beth_nia;2517
2521
+ adriana_calcanhotto;2518
2522
+ marie_lafor_t;2519
2523
+ marius_m_ller_westernhagen;2520
2524
+ mina;2521
2525
+ no_l_coward;2522
2526
+ pippo_pollina;2523
2527
+ rita_lee;2524
2528
+ os_mutantes;2525
2529
+ rita_pavone;2526
2530
+ roger_whittaker;2527
2531
+ al_bano_romina_power;2528
2532
+ salvatore_adamo;2529
2533
+ simone;2530
2534
+ s_rgio_godinho;2531
2535
+ udo_j_rgens;2532
2536
+ udo_lindenberg;2533
2537
+ ulrich_roski;2534
2538
+ zaz;2535
2539
+ z_ramalho;2536
2540
+ fagner;2537
2541
+ dith_piaf;2538
2542
+ duelo;2539
2543
+ espinoza_paz;2540
2544
+ fidel_rueda;2541
2545
+ la_firma;2542
2546
+ la_arrolladora_banda_el_lim_n;2543
2547
+ voz_de_mando;2544
2548
+ sergio_vega;2545
2549
+ fool_s_garden;2546
2550
+ waltari;2547
2551
+ of_montreal;2548
2552
+ pierre_lapointe;2549
2553
+ rufus_wainwright;2550
2554
+ loudon_wainwright_iii;2551
2555
+ sufjan_stevens;2552
2556
+ machine_gun_kelly;2553
2557
+ francesco_guccini;2554
2558
+ le_orme;2555
2559
+ lucio_dalla;2556
2560
+ michel_fugain;2557
2561
+ al_jarreau;2558
2562
+ carmen_mcrae;2559
2563
+ javier_sol_s;2560
2564
+ harry_connick_jr;2561
2565
+ bap;2562
2566
+ cradle_of_filth;2563
2567
+ amorphis;2564
2568
+ avatar;2565
2569
+ bathory;2566
2570
+ behemoth;2567
2571
+ borknagar;2568
2572
+ countess;2569
2573
+ cruachan;2570
2574
+ darkthrone;2571
2575
+ hate;2572
2576
+ destruction;2573
2577
+ dimmu_borgir;2574
2578
+ eisregen;2575
2579
+ enslaved;2576
2580
+ finntroll;2577
2581
+ fates_warning;2578
2582
+ graveworm;2579
2583
+ impaled_nazarene;2580
2584
+ sentenced;2581
2585
+ king_diamond;2582
2586
+ kreator;2583
2587
+ lord_belial;2584
2588
+ marduk;2585
2589
+ mercyful_fate;2586
2590
+ stick_to_your_guns;2587
2591
+ moonspell;2588
2592
+ as_i_lay_dying;2589
2593
+ nunslaughter;2590
2594
+ rotting_christ;2591
2595
+ samael;2592
2596
+ sandy_denny;2593
2597
+ skyforger;2594
2598
+ sodom;2595
2599
+ cannibal_corpse;2596
2600
+ exodus;2597
2601
+ atreyu;2598
2602
+ theatres_des_vampires;2599
2603
+ wizard;2600
2604
+ transmetal;2601
2605
+ venom;2602
2606
+ belphegor;2603
2607
+ the_crown;2604
2608
+ moya_brennan;2605
2609
+ todd_rundgren;2606
2610
+ clay_walker;2607
2611
+ andrew_peterson;2608
2612
+ lynn_anderson;2609
2613
+ david_crowder_band;2610
2614
+ pam_tillis;2611
2615
+ norah_jones;2612
2616
+ rhonda_vincent;2613
2617
+ jamey_johnson;2614
2618
+ plumb;2615
2619
+ j_j_cale;2616
2620
+ new_riders_of_the_purple_sage;2617
2621
+ joe_diffie;2618
2622
+ kasey_chambers;2619
2623
+ leon_russell;2620
2624
+ jack_greene;2621
2625
+ the_string_cheese_incident;2622
2626
+ ystein_sunde;2623
2627
+ stephen_stills;2624
2628
+ cancerslug;2625
2629
+ robert_plant;2626
2630
+ alvin_lee;2627
2631
+ beth_hart;2628
2632
+ jimmy_buffett;2629
2633
+ billy_s_band;2630
2634
+ bunbury;2631
2635
+ nacho_vegas;2632
2636
+ calogero;2633
2637
+ georges_brassens;2634
2638
+ canned_heat;2635
2639
+ charlie_louvin;2636
2640
+ colin_james;2637
2641
+ cuby_blizzards;2638
2642
+ dick_annegarn;2639
2643
+ edoardo_bennato;2640
2644
+ eva_cassidy;2641
2645
+ gil_scott_heron;2642
2646
+ glenn_hughes;2643
2647
+ deep_purple;2644
2648
+ connie_smith;2645
2649
+ iva_zanicchi;2646
2650
+ izzy_stradlin;2647
2651
+ j_karjalainen;2648
2652
+ jack_bruce;2649
2653
+ leonard_cohen;2650
2654
+ joan_armatrading;2651
2655
+ joan_osborne;2652
2656
+ john_martyn;2653
2657
+ rio_reiser;2654
2658
+ larry_carlton;2655
2659
+ madeleine_peyroux;2656
2660
+ bruce_cockburn;2657
2661
+ kate_anna_mcgarrigle;2658
2662
+ mavis_staples;2659
2663
+ noa;2660
2664
+ ralph_mctell;2661
2665
+ renato_carosone;2662
2666
+ richie_kotzen;2663
2667
+ robben_ford;2664
2668
+ roberto_carlos;2665
2669
+ erasmo_carlos;2666
2670
+ robin_trower;2667
2671
+ rory_block;2668
2672
+ roy_buchanan;2669
2673
+ sandra_mihanovich;2670
2674
+ savoy_brown;2671
2675
+ shirley_horn;2672
2676
+ siniestro_total;2673
2677
+ slank;2674
2678
+ the_fabulous_thunderbirds;2675
2679
+ the_seatbelts;2676
2680
+ the_tragically_hip;2677
2681
+ mike_jones;2678
2682
+ trophy_scars;2679
2683
+ caravan;2680
2684
+ velhas_virgens;2681
2685
+ walter_trout;2682
2686
+ gov_t_mule;2683
2687
+ bar_o_vermelho;2684
2688
+ blue_cheer;2685
2689
+ ian_hunter;2686
2690
+ david_leb_n;2687
2691
+ de_palmas;2688
2692
+ eugenio_finardi;2689
2693
+ extreme;2690
2694
+ foghat;2691
2695
+ george_thorogood_the_destroyers;2692
2696
+ great_white;2693
2697
+ guardian;2694
2698
+ jethro_tull;2695
2699
+ ian_anderson;2696
2700
+ david_knopfler;2697
2701
+ steppenwolf;2698
2702
+ dave_edmunds;2699
2703
+ lynyrd_skynyrd;2700
2704
+ crosby_stills_nash;2701
2705
+ raul_seixas;2702
2706
+ the_poodles;2703
2707
+ musiq_soulchild;2704
2708
+ shocking_blue;2705
2709
+ nick_lowe;2706
2710
+ the_black_crowes;2707
2711
+ traffic;2708
2712
+ widespread_panic;2709
2713
+ co;2710
2714
+ alberto_cortez;2711
2715
+ joan_sebastian;2712
2716
+ ana_gabriel;2713
2717
+ gilberto_santa_rosa;2714
2718
+ rub_n_blades;2715
2719
+ v_ctor_manuelle;2716
2720
+ celia_cruz;2717
2721
+ luis_fonsi;2718
2722
+ nek;2719
2723
+ dr_feelgood;2720
2724
+ astrud_gilberto;2721
2725
+ benito_di_paula;2722
2726
+ brazzaville;2723
2727
+ sacha_distel;2724
2728
+ chico_buarque;2725
2729
+ elis_regina;2726
2730
+ milton_nascimento;2727
2731
+ faf_de_bel_m;2728
2732
+ nikka_costa;2729
2733
+ tim_maia;2730
2734
+ gilberto_gil;2731
2735
+ lisa_ekdahl;2732
2736
+ joyce;2733
2737
+ maria_rita;2734
2738
+ nara_le_o;2735
2739
+ nouvelle_vague;2736
2740
+ paulinho_moska;2737
2741
+ wilson_simonal;2738
2742
+ 14_bis;2739
2743
+ arnaldo_antunes;2740
2744
+ biquini_cavad_o;2741
2745
+ cidade_negra;2742
2746
+ cpm_22;2743
2747
+ c_ssia_eller;2744
2748
+ os_paralamas_do_sucesso;2745
2749
+ guilherme_arantes;2746
2750
+ ira;2747
2751
+ lob_o;2748
2752
+ nenhum_de_n_s;2749
2753
+ djavan;2750
2754
+ rog_rio_skylab;2751
2755
+ roupa_nova;2752
2756
+ ultraje_a_rigor;2753
2757
+ kj_52;2754
2758
+ amado_batista;2755
2759
+ chit_ozinho_xoror;2756
2760
+ jo_o_paulo_daniel;2757
2761
+ leandro_leonardo;2758
2762
+ leonardo;2759
2763
+ odair_jos;2760
2764
+ kaiser_chiefs;2761
2765
+ kula_shaker;2762
2766
+ lightning_seeds;2763
2767
+ pulp;2764
2768
+ the_proclaimers;2765
2769
+ dying_fetus;2766
2770
+ napalm_death;2767
2771
+ nile;2768
2772
+ pathology;2769
2773
+ hilary_duff;2770
2774
+ badly_drawn_boy;2771
2775
+ federico_salvatore;2772
2776
+ i_gufi;2773
2777
+ zachary_richard;2774
2778
+ stan_rogers;2775
2779
+ moxy_fr_vous;2776
2780
+ poco;2777
2781
+ la_bottine_souriante;2778
2782
+ stompin_tom_connors;2779
2783
+ bersuit_vergarabat;2780
2784
+ las_pastillas_del_abuelo;2781
2785
+ george_lam;2782
2786
+ altan;2783
2787
+ clannad;2784
2788
+ blackmore_s_night;2785
2789
+ capercaillie;2786
2790
+ celtic_thunder;2787
2791
+ eluveitie;2788
2792
+ powerwolf;2789
2793
+ gaelic_storm;2790
2794
+ an_na;2791
2795
+ jon_anderson;2792
2796
+ the_dubliners;2793
2797
+ loreena_mckennitt;2794
2798
+ omnia;2795
2799
+ secret_garden;2796
2800
+ shaun_davey;2797
2801
+ roger_daltrey;2798
2802
+ the_corrs;2799
2803
+ los_tigres_del_norte;2800
2804
+ laurent_voulzy;2801
2805
+ the_kelly_family;2802
2806
+ wolfe_tones;2803
2807
+ alan_stivell;2804
2808
+ heather_alexander;2805
2809
+ kate_rusby;2806
2810
+ dropkick_murphys;2807
2811
+ great_big_sea;2808
2812
+ fiddler_s_green;2809
2813
+ heather_dale;2810
2814
+ runrig;2811
2815
+ the_waterboys;2812
2816
+ dougie_maclean;2813
2817
+ adriano_celentano;2814
2818
+ alain_chamfort;2815
2819
+ zazie;2816
2820
+ hamelen;2817
2821
+ tazenda;2818
2822
+ arno;2819
2823
+ arthur_h;2820
2824
+ boudewijn_de_groot;2821
2825
+ charles_trenet;2822
2826
+ claudio_baglioni;2823
2827
+ claudio_rocchi;2824
2828
+ fabrizio_de_andr;2825
2829
+ dalida;2826
2830
+ dana_winner;2827
2831
+ demis_roussos;2828
2832
+ esther_ofarim;2829
2833
+ eugenio_bennato;2830
2834
+ michel_berger;2831
2835
+ francis_cabrel;2832
2836
+ maxime_le_forestier;2833
2837
+ georges_moustaki;2834
2838
+ gianmaria_testa;2835
2839
+ gianni_morandi;2836
2840
+ gigliola_cinquetti;2837
2841
+ milva;2838
2842
+ gilbert_b_caud;2839
2843
+ ginette_reno;2840
2844
+ giuni_russo;2841
2845
+ guy_b_art;2842
2846
+ helena_vondr_kov;2843
2847
+ hugues_aufray;2844
2848
+ ivan_graziani;2845
2849
+ ivano_fossati;2846
2850
+ jacques_bertin;2847
2851
+ jean_ferrat;2848
2852
+ juliane_werding;2849
2853
+ julien_clerc;2850
2854
+ los_temerarios;2851
2855
+ katerine;2852
2856
+ leny_escudero;2853
2857
+ mathieu_chedid;2854
2858
+ luca_barbarossa;2855
2859
+ l_o_ferr;2856
2860
+ rosenstolz;2857
2861
+ marc_lavoine;2858
2862
+ massimo_bubola;2859
2863
+ mecano;2860
2864
+ mia_martini;2861
2865
+ michel_jonasz;2862
2866
+ michele_zarrillo;2863
2867
+ fiorello;2864
2868
+ nada;2865
2869
+ mercedes_sosa;2866
2870
+ nino_d_angelo;2867
2871
+ patrick_bruel;2868
2872
+ patty_pravo;2869
2873
+ pierre_bachelet;2870
2874
+ rainald_grebe;2871
2875
+ rapha_l;2872
2876
+ raphael;2873
2877
+ richard_anthony;2874
2878
+ roberto_murolo;2875
2879
+ ron;2876
2880
+ stefano_rosso;2877
2881
+ stephan_eicher;2878
2882
+ vasco_rossi;2879
2883
+ yves_duteil;2880
2884
+ yves_jamait;2881
2885
+ ang_lica;2882
2886
+ aaron_carter;2883
2887
+ barry_louis_polisar;2884
2888
+ yuri;2885
2889
+ cri_cri;2886
2890
+ hevisaurus;2887
2891
+ juice_leskinen;2888
2892
+ kidz_bop;2889
2893
+ mara_maravilha;2890
2894
+ destroyer;2891
2895
+ scorpions;2892
2896
+ obk;2893
2897
+ duncan_dhu;2894
2898
+ parry_gripp;2895
2899
+ sandy_junior;2896
2900
+ the_verve_pipe;2897
2901
+ the_verve;2898
2902
+ the_wiggles;2899
2903
+ veggietales;2900
2904
+ newsboys;2901
2905
+ steven_curtis_chapman;2902
2906
+ toro_y_moi;2903
2907
+ medi_val_b_bes;2904
2908
+ aaron_neville;2905
2909
+ bethel_music;2906
2910
+ apologetix;2907
2911
+ gaither_vocal_band;2908
2912
+ building_429;2909
2913
+ chris_tomlin;2910
2914
+ matt_maher;2911
2915
+ jerusalem;2912
2916
+ david_meece;2913
2917
+ debby_boone;2914
2918
+ elevation_worship;2915
2919
+ matt_redman;2916
2920
+ planetshakers;2917
2921
+ majesty;2918
2922
+ jump5;2919
2923
+ lecrae;2920
2924
+ michael_w_smith;2921
2925
+ bride;2922
2926
+ natalie_grant;2923
2927
+ the_lads;2924
2928
+ audio_adrenaline;2925
2929
+ paul_wilbur;2926
2930
+ psalmen_voor_nu;2927
2931
+ sawyer_brown;2928
2932
+ shane_shane;2929
2933
+ the_echoing_green;2930
2934
+ twila_paris;2931
2935
+ watch_tower_bible_and_tract_society;2932
2936
+ da_t_r_u_t_h;2933
2937
+ dc_talk;2934
2938
+ flame;2935
2939
+ grits;2936
2940
+ trip_lee;2937
2941
+ crystal_lewis;2938
2942
+ the_cross_movement;2939
2943
+ tobymac;2940
2944
+ vico_c;2941
2945
+ mormon_tabernacle_choir;2942
2946
+ august_burns_red;2943
2947
+ black_veil_brides;2944
2948
+ deliverance;2945
2949
+ opeth;2946
2950
+ die_happy;2947
2951
+ disciple;2948
2952
+ galactic_cowboys;2949
2953
+ haste_the_day;2950
2954
+ living_sacrifice;2951
2955
+ mastodon;2952
2956
+ mortification;2953
2957
+ showbread;2954
2958
+ labyrinth;2955
2959
+ stryper;2956
2960
+ the_devil_wears_prada;2957
2961
+ underoath;2958
2962
+ whitecross;2959
2963
+ petra;2960
2964
+ huntingtons;2961
2965
+ mxpx;2962
2966
+ d_a_d;2963
2967
+ caedmon_s_call;2964
2968
+ david_and_the_giants;2965
2969
+ degarmo_and_key;2966
2970
+ delirious;2967
2971
+ don_francisco;2968
2972
+ five_iron_frenzy;2969
2973
+ geoff_moore;2970
2974
+ hawk_nelson;2971
2975
+ grave;2972
2976
+ larry_norman;2973
2977
+ randy_stonehill;2974
2978
+ monty_python;2975
2979
+ oomph;2976
2980
+ oficina_g3;2977
2981
+ white_heart;2978
2982
+ rescate;2979
2983
+ rick_wakeman;2980
2984
+ la_oreja_de_van_gogh;2981
2985
+ sanctus_real;2982
2986
+ fun_people;2983
2987
+ thousand_foot_krutch;2984
2988
+ tim_hughes;2985
2989
+ the_o_c_supertones;2986
2990
+ 4him;2987
2991
+ billy_gilman;2988
2992
+ aimee_mann;2989
2993
+ katharine_mcphee;2990
2994
+ eros_ramazzotti;2991
2995
+ z_ro;2992
2996
+ babbie_mason;2993
2997
+ bebo_norman;2994
2998
+ judy_garland;2995
2999
+ carman;2996
3000
+ cece_winans;2997
3001
+ trick_daddy;2998
3002
+ chris_isaak;2999
3003
+ cocteau_twins;3000
3004
+ edyta_g_rniak;3001
3005
+ enrico_ruggeri;3002
3006
+ ffh;3003
3007
+ hanson;3004
3008
+ hawksley_workman;3005
3009
+ indigo_girls;3006
3010
+ irene_grandi;3007
3011
+ jackie_evancho;3008
3012
+ joy_electric;3009
3013
+ kelly_price;3010
3014
+ mary_mary;3011
3015
+ israel_houghton;3012
3016
+ phil_wickham;3013
3017
+ phillips_craig_dean;3014
3018
+ roch_voisine;3015
3019
+ rupaul;3016
3020
+ gregorian;3017
3021
+ sarah_connor;3018
3022
+ sugarland;3019
3023
+ sweetbox;3020
3024
+ tarja;3021
3025
+ the_brian_setzer_orchestra;3022
3026
+ brian_setzer;3023
3027
+ badfinger;3024
3028
+ the_moffatts;3025
3029
+ the_vandals;3026
3030
+ trans_siberian_orchestra;3027
3031
+ roy_drusky;3028
3032
+ burton_cummings;3029
3033
+ procol_harum;3030
3034
+ renaissance;3031
3035
+ the_pretty_things;3032
3036
+ twisted_sister;3033
3037
+ bj_rn_eidsv_g;3034
3038
+ corvus_corax;3035
3039
+ schelmish;3036
3040
+ emilie_autumn;3037
3041
+ epica;3038
3042
+ katherine_jenkins;3039
3043
+ scala_kolacny_brothers;3040
3044
+ take_6;3041
3045
+ the_roches;3042
3046
+ tony_banks;3043
3047
+ to_e_proeski;3044
3048
+ lacrimosa;3045
3049
+ 16_volt;3046
3050
+ bj_rn_rosenstr_m;3047
3051
+ bob_rivers;3048
3052
+ cledus_t_judd;3049
3053
+ frankjavcee;3050
3054
+ george_formby;3051
3055
+ ninja_sex_party;3052
3056
+ paul_and_storm;3053
3057
+ the_arrogant_worms;3054
3058
+ tripod;3055
3059
+ el_cuarteto_de_nos;3056
3060
+ gwar;3057
3061
+ knorkator;3058
3062
+ psychostick;3059
3063
+ rodgau_monotones;3060
3064
+ los_palominos;3061
3065
+ charlie_peacock;3062
3066
+ jesus_culture;3063
3067
+ michael_card;3064
3068
+ tenth_avenue_north;3065
3069
+ carrie_newcomer;3066
3070
+ nick_drake;3067
3071
+ aaron_watson;3068
3072
+ billy_joe_royal;3069
3073
+ billy_joe_shaver;3070
3074
+ charlie_landsborough;3071
3075
+ chris_ledoux;3072
3076
+ collin_raye;3073
3077
+ dan_seals;3074
3078
+ dave_dudley;3075
3079
+ hellbillies;3076
3080
+ ed_bruce;3077
3081
+ emilio_navaira;3078
3082
+ jean_shepard;3079
3083
+ freddie_hart;3080
3084
+ gary_stewart;3081
3085
+ gene_watson;3082
3086
+ gian_giovani;3083
3087
+ gilberto_gilmar;3084
3088
+ jason_mraz;3085
3089
+ ilse_delange;3086
3090
+ john_prine;3087
3091
+ jake_owen;3088
3092
+ wynn_stewart;3089
3093
+ jim_ed_brown;3090
3094
+ joe_ely;3091
3095
+ kid_rock;3092
3096
+ la_toya_jackson;3093
3097
+ lit;3094
3098
+ lita_ford;3095
3099
+ me_first_and_the_gimme_gimmes;3096
3100
+ lagwagon;3097
3101
+ melanie;3098
3102
+ mickey_newbury;3099
3103
+ paul_brunelle;3100
3104
+ paula_fernandes;3101
3105
+ zez_di_camargo_luciano;3102
3106
+ randy_rogers_band;3103
3107
+ reverend_horton_heat;3104
3108
+ rick_renner;3105
3109
+ rionegro_solim_es;3106
3110
+ shooter_jennings;3107
3111
+ terri_clark;3108
3112
+ vern_gosdin;3109
3113
+ webb_wilder;3110
3114
+ ween;3111
3115
+ 38_special;3112
3116
+ the_beau_brummels;3113
3117
+ matanza;3114
3118
+ clawfinger;3115
3119
+ acid_drinkers;3116
3120
+ agnostic_front;3117
3121
+ biohazard;3118
3122
+ body_count;3119
3123
+ d_r_i;3120
3124
+ municipal_waste;3121
3125
+ neurosis;3122
3126
+ nuclear_assault;3123
3127
+ soziedad_alkoholika;3124
3128
+ suicidal_tendencies;3125
3129
+ paragon;3126
3130
+ mario;3127
3131
+ inna;3128
3132
+ belinda;3129
3133
+ bronco;3130
3134
+ grupo_bryndis;3131
3135
+ david_bisbal;3132
3136
+ ram_n_ayala;3133
3137
+ grant_lee_phillips;3134
3138
+ the_veronicas;3135
3139
+ amr_diab;3136
3140
+ atb;3137
3141
+ basshunter;3138
3142
+ dream_theater;3139
3143
+ frankie_j;3140
3144
+ baby_bash;3141
3145
+ sophie_ellis_bextor;3142
3146
+ grace_jones;3143
3147
+ laveerre;3144
3148
+ silkk_the_shocker;3145
3149
+ parov_stelar;3146
3150
+ raffaella_carr;3147
3151
+ elephant_man;3148
3152
+ saint_etienne;3149
3153
+ samantha_fox;3150
3154
+ selena;3151
3155
+ super_junior;3152
3156
+ t_a_t_u;3153
3157
+ tarkan;3154
3158
+ judie_tzuke;3155
3159
+ el_kel_iset;3156
3160
+ yello;3157
3161
+ franz_ferdinand;3158
3162
+ chenoa;3159
3163
+ lucero;3160
3164
+ tokio;3161
3165
+ puffy_amiyumi;3162
3166
+ wink;3163
3167
+ obie_trice;3164
3168
+ mystikal;3165
3169
+ current_93;3166
3170
+ dark_sanctuary;3167
3171
+ rome;3168
3172
+ lord_of_the_lost;3169
3173
+ bella_morte;3170
3174
+ mantus;3171
3175
+ blutengel;3172
3176
+ clan_of_xymox;3173
3177
+ dead_can_dance;3174
3178
+ death_in_june;3175
3179
+ diary_of_dreams;3176
3180
+ diorama;3177
3181
+ helium_vola;3178
3182
+ illuminate;3179
3183
+ l_me_immortelle;3180
3184
+ lacrimas_profundere;3181
3185
+ killing_joke;3182
3186
+ m_nchener_freiheit;3183
3187
+ otto_dix;3184
3188
+ project_pitchfork;3185
3189
+ qntal;3186
3190
+ sopor_aeternus;3187
3191
+ the_cr_xshadows;3188
3192
+ unheilig;3189
3193
+ welle;3190
3194
+ yendri;3191
3195
+ carcass;3192
3196
+ asphyx;3193
3197
+ bolt_thrower;3194
3198
+ darkseed;3195
3199
+ paradise_lost;3196
3200
+ tiamat;3197
3201
+ the_damned;3198
3202
+ pantera;3199
3203
+ the_amity_affliction;3200
3204
+ judas_priest;3201
3205
+ amon_amarth;3202
3206
+ alesana;3203
3207
+ atrocity;3204
3208
+ autopsy;3205
3209
+ avulsed;3206
3210
+ sabaton;3207
3211
+ misfits;3208
3212
+ iron_fire;3209
3213
+ centinex;3210
3214
+ dagoba;3211
3215
+ dark_tranquillity;3212
3216
+ asia;3213
3217
+ deicide;3214
3218
+ dethklok;3215
3219
+ dew_scented;3216
3220
+ edge_of_sanity;3217
3221
+ escape_the_fate;3218
3222
+ heaven_shall_burn;3219
3223
+ hypocrisy;3220
3224
+ incantation;3221
3225
+ jungle_rot;3222
3226
+ kataklysm;3223
3227
+ krisiun;3224
3228
+ macabre;3225
3229
+ malevolent_creation;3226
3230
+ meshuggah;3227
3231
+ misanthrope;3228
3232
+ morbid_angel;3229
3233
+ dead_kennedys;3230
3234
+ necro;3231
3235
+ pig_destroyer;3232
3236
+ shadows_fall;3233
3237
+ sinister;3234
3238
+ six_feet_under;3235
3239
+ dream_evil;3236
3240
+ soulfly;3237
3241
+ the_black_dahlia_murder;3238
3242
+ between_the_buried_and_me;3239
3243
+ therion;3240
3244
+ vader;3241
3245
+ whitechapel;3242
3246
+ attila;3243
3247
+ emmure;3244
3248
+ miss_may_i;3245
3249
+ the_acacia_strain;3246
3250
+ betontod;3247
3251
+ broilers;3248
3252
+ dritte_wahl;3249
3253
+ ohl;3250
3254
+ slime;3251
3255
+ terrorgruppe;3252
3256
+ b_hse_onkelz;3253
3257
+ frei_wild;3254
3258
+ k_rbholz;3255
3259
+ asp;3256
3260
+ tokio_hotel;3257
3261
+ queensr_che;3258
3262
+ amanda_miguel;3259
3263
+ arabesque;3260
3264
+ bad_boys_blue;3261
3265
+ boyce_avenue;3262
3266
+ parliament;3263
3267
+ wu_tang_clan;3264
3268
+ neoton_fam_lia;3265
3269
+ teena_marie;3266
3270
+ bobby_womack;3267
3271
+ agoraphobic_nosebleed;3268
3272
+ candlemass;3269
3273
+ electric_wizard;3270
3274
+ black_sabbath;3271
3275
+ theatre_of_tragedy;3272
3276
+ type_o_negative;3273
3277
+ marie_fredriksson;3274
3278
+ luna;3275
3279
+ marissa_nadler;3276
3280
+ yo_la_tengo;3277
3281
+ celldweller;3278
3282
+ hitomi;3279
3283
+ big_d_and_the_kids_table;3280
3284
+ alacranes_musical;3281
3285
+ k_paz_de_la_sierra;3282
3286
+ assemblage_23;3283
3287
+ covenant;3284
3288
+ die_krupps;3285
3289
+ kodak_black;3286
3290
+ front_242;3287
3291
+ haujobb;3288
3292
+ in_strict_confidence;3289
3293
+ le_ther_strip;3290
3294
+ snog;3291
3295
+ the_darkness;3292
3296
+ tanzwut;3293
3297
+ terminal_choice;3294
3298
+ velvet_acid_christ;3295
3299
+ vnv_nation;3296
3300
+ wumpscut;3297
3301
+ x_fusion;3298
3302
+ umbra_et_imago;3299
3303
+ de_vision;3300
3304
+ deichkind;3301
3305
+ eisbrecher;3302
3306
+ herbie_hancock;3303
3307
+ ana_moura;3304
3308
+ macaco;3305
3309
+ skinny_puppy;3306
3310
+ ayreon;3307
3311
+ black_moth_super_rainbow;3308
3312
+ erykah_badu;3309
3313
+ cocorosie;3310
3314
+ de_jeugd_van_tegenwoordig;3311
3315
+ dj_shadow;3312
3316
+ e_nomine;3313
3317
+ kmfdm;3314
3318
+ flying_lotus;3315
3319
+ goldfrapp;3316
3320
+ hanzel_und_gretyl;3317
3321
+ information_society;3318
3322
+ mc_frontalot;3319
3323
+ kraftwerk;3320
3324
+ ladytron;3321
3325
+ lamb;3322
3326
+ milk_inc;3323
3327
+ mind_in_a_box;3324
3328
+ ministry;3325
3329
+ m_m;3326
3330
+ m_nia;3327
3331
+ pig;3328
3332
+ pitchshifter;3329
3333
+ lil_boosie;3330
3334
+ master_p;3331
3335
+ mindless_self_indulgence;3332
3336
+ buzzcocks;3333
3337
+ vanilla_ice;3334
3338
+ milie_simon;3335
3339
+ gianna_nannini;3336
3340
+ pinback;3337
3341
+ the_birthday_massacre;3338
3342
+ archive;3339
3343
+ 99_posse;3340
3344
+ bloc_party;3341
3345
+ morcheeba;3342
3346
+ origa;3343
3347
+ paul_kalkbrenner;3344
3348
+ tina_arena;3345
3349
+ dover;3346
3350
+ melotron;3347
3351
+ owl_city;3348
3352
+ kamelot;3349
3353
+ greeley_estates;3350
3354
+ hawthorne_heights;3351
3355
+ joan_of_arc;3352
3356
+ saves_the_day;3353
3357
+ thursday;3354
3358
+ transit;3355
3359
+ fairport_convention;3356
3360
+ maggie_reilly;3357
3361
+ joan_manuel_serrat;3358
3362
+ e_rotic;3359
3363
+ the_scene;3360
3364
+ sandra;3361
3365
+ amon_d_l_ii;3362
3366
+ circa_survive;3363
3367
+ love_solfege;3364
3368
+ caliban;3365
3369
+ tall_dwarfs;3366
3370
+ van_der_graaf_generator;3367
3371
+ death_grips;3368
3372
+ the_fiery_furnaces;3369
3373
+ am_lia_rodrigues;3370
3374
+ cristina_branco;3371
3375
+ jos_afonso;3372
3376
+ katia_guerreiro;3373
3377
+ ney_matogrosso;3374
3378
+ madredeus;3375
3379
+ mariza;3376
3380
+ gipsy_kings;3377
3381
+ mal;3378
3382
+ aleks_syntek;3379
3383
+ ni_a_pastori;3380
3384
+ rosario;3381
3385
+ al_stewart;3382
3386
+ amos_lee;3383
3387
+ andr_s_calamaro;3384
3388
+ ane_brun;3385
3389
+ asa;3386
3390
+ editors;3387
3391
+ catie_curtis;3388
3392
+ chrystian_ralf;3389
3393
+ clueso;3390
3394
+ eddi_reader;3391
3395
+ eddie_from_ohio;3392
3396
+ ellis_paul;3393
3397
+ frank_turner;3394
3398
+ estampie;3395
3399
+ ferdi_tayfur;3396
3400
+ fito_p_ez;3397
3401
+ luis_alberto_spinetta;3398
3402
+ gabriella_ferri;3399
3403
+ gigi;3400
3404
+ greg_brown;3401
3405
+ g_ksel;3402
3406
+ lando_fiorini;3403
3407
+ india_arie;3404
3408
+ jack_savoretti;3405
3409
+ anne_grete_preus;3406
3410
+ jarom_r_nohavica;3407
3411
+ joe_purdy;3408
3412
+ john_wesley_harding;3409
3413
+ josh_rouse;3410
3414
+ karel_kryl;3411
3415
+ v_tor_ramil;3412
3416
+ lars_winnerb_ck;3413
3417
+ laura_marling;3414
3418
+ llu_s_llach;3415
3419
+ los_chalchaleros;3416
3420
+ luka_bloom;3417
3421
+ malicorne;3418
3422
+ mark_heard;3419
3423
+ martin_carthy;3420
3424
+ nic_jones;3421
3425
+ le_n_gieco;3422
3426
+ mijares;3423
3427
+ nuova_compagnia_di_canto_popolare;3424
3428
+ ola_magnell;3425
3429
+ thin_lizzy;3426
3430
+ ray_lamontagne;3427
3431
+ ron_sexsmith;3428
3432
+ rosana;3429
3433
+ silvio_rodr_guez;3430
3434
+ stef_bos;3431
3435
+ sun_kil_moon;3432
3436
+ tanita_tikaram;3433
3437
+ the_incredible_string_band;3434
3438
+ thea_gilmore;3435
3439
+ tina_dico;3436
3440
+ victor_leo;3437
3441
+ v_rttin;3438
3442
+ ge_aleksandersen;3439
3443
+ i_brahim_tatl_ses;3440
3444
+ ektomorf;3441
3445
+ elvenking;3442
3446
+ ensiferum;3443
3447
+ falconer;3444
3448
+ feuerschwanz;3445
3449
+ in_extremo;3446
3450
+ korpiklaani;3447
3451
+ leaves_eyes;3448
3452
+ letzte_instanz;3449
3453
+ m_go_de_oz;3450
3454
+ saurom;3451
3455
+ schandmaul;3452
3456
+ skyclad;3453
3457
+ subway_to_sally;3454
3458
+ suidakra;3455
3459
+ t_r;3456
3460
+ icehouse;3457
3461
+ bomb_the_music_industry;3458
3462
+ the_real_mckenzies;3459
3463
+ 54_40;3460
3464
+ armored_saint;3461
3465
+ alexz_johnson;3462
3466
+ bar_man_o;3463
3467
+ ezginin_g_nl;3464
3468
+ galija;3465
3469
+ sts;3466
3470
+ h_kan_hellstr_m;3467
3471
+ james_blunt;3468
3472
+ kazik;3469
3473
+ mewithoutyou;3470
3474
+ michel_polnareff;3471
3475
+ ovidi_montllor;3472
3476
+ rasputina;3473
3477
+ shearwater;3474
3478
+ gerry_rafferty;3475
3479
+ steam_powered_giraffe;3476
3480
+ the_saw_doctors;3477
3481
+ ty_segall;3478
3482
+ tyrone_wells;3479
3483
+ avi_es_do_forr;3480
3484
+ grimskunk;3481
3485
+ sinik;3482
3486
+ vitaa;3483
3487
+ kenza_farah;3484
3488
+ sexion_d_assaut;3485
3489
+ aliz_e;3486
3490
+ henri_tachan;3487
3491
+ jenifer;3488
3492
+ m_pokora;3489
3493
+ indochine;3490
3494
+ brainstorm;3491
3495
+ con_funk_shun;3492
3496
+ funkadelic;3493
3497
+ lena_park;3494
3498
+ neffa;3495
3499
+ ugk;3496
3500
+ suburban_legends;3497
3501
+ mai_kuraki;3498
3502
+ cherry_poppin_daddies;3499
3503
+ electric_six;3500
3504
+ los_straitjackets;3501
3505
+ the_69_eyes;3502
3506
+ the_angels;3503
3507
+ the_haunted;3504
3508
+ the_hellacopters;3505
3509
+ the_kills;3506
3510
+ thee_oh_sees;3507
3511
+ white_denim;3508
3512
+ zabranjeno_pu_enje;3509
3513
+ ol_dirty_bastard;3510
3514
+ kurupt;3511
3515
+ spice_1;3512
3516
+ brotha_lynch_hung;3513
3517
+ chamillionaire;3514
3518
+ paul_wall;3515
3519
+ trae;3516
3520
+ club_dogo;3517
3521
+ mc_eiht;3518
3522
+ royce_da_5_9;3519
3523
+ geto_boys;3520
3524
+ the_diplomats;3521
3525
+ ice_t;3522
3526
+ 2_live_crew;3523
3527
+ xv;3524
3528
+ mobb_deep;3525
3529
+ c_murder;3526
3530
+ tru;3527
3531
+ lil_keke;3528
3532
+ project_pat;3529
3533
+ tha_dogg_pound;3530
3534
+ esham;3531
3535
+ twiztid;3532
3536
+ erick_sermon;3533
3537
+ big_tymers;3534
3538
+ kate_nash;3535
3539
+ the_cramps;3536
3540
+ nekromantix;3537
3541
+ tsol;3538
3542
+ ace_frehley;3539
3543
+ hardcore_superstar;3540
3544
+ harem_scarem;3541
3545
+ house_of_lords;3542
3546
+ kingdom_come;3543
3547
+ l_a_guns;3544
3548
+ mr_big;3545
3549
+ pink_cream_69;3546
3550
+ quiet_riot;3547
3551
+ riot;3548
3552
+ ratt;3549
3553
+ tnt;3550
3554
+ backyard_babies;3551
3555
+ ultima_thule;3552
3556
+ europe;3553
3557
+ hanoi_rocks;3554
3558
+ mott_the_hoople;3555
3559
+ smokie;3556
3560
+ suzi_quatro;3557
3561
+ haemorrhage;3558
3562
+ aline_barros;3559
3563
+ bruna_karla;3560
3564
+ kirk_franklin;3561
3565
+ minist_rio_koinonya_de_louvor;3562
3566
+ artrosis;3563
3567
+ closterkeller;3564
3568
+ indica;3565
3569
+ sirenia;3566
3570
+ trail_of_tears;3567
3571
+ tristania;3568
3572
+ within_temptation;3569
3573
+ bauhaus;3570
3574
+ mono_inc;3571
3575
+ pansy_division;3572
3576
+ xandria;3573
3577
+ immortal_technique;3574
3578
+ agathocles;3575
3579
+ rotten_sound;3576
3580
+ the_locust;3577
3581
+ anthrax;3578
3582
+ devildriver;3579
3583
+ lamb_of_god;3580
3584
+ machine_head;3581
3585
+ parkway_drive;3582
3586
+ pro_pain;3583
3587
+ throwdown;3584
3588
+ vicious_rumors;3585
3589
+ screaming_trees;3586
3590
+ cuisillos;3587
3591
+ intocable;3588
3592
+ pesado;3589
3593
+ la_mafia;3590
3594
+ marco_antonio_sol_s;3591
3595
+ los_bukis;3592
3596
+ andrew_w_k;3593
3597
+ april_wine;3594
3598
+ axel_rudi_pell;3595
3599
+ b_z;3596
3600
+ tak_matsumoto;3597
3601
+ barricada;3598
3602
+ bijelo_dugme;3599
3603
+ blaze_bayley;3600
3604
+ bonfire;3601
3605
+ bruce_dickinson;3602
3606
+ buckcherry;3603
3607
+ budgie;3604
3608
+ buitres;3605
3609
+ jorn;3606
3610
+ doro;3607
3611
+ enuff_z_nuff;3608
3612
+ gentle_giant;3609
3613
+ girlschool;3610
3614
+ golden_earring;3611
3615
+ gotthard;3612
3616
+ nazareth;3613
3617
+ a_day_to_remember;3614
3618
+ jefferson_airplane;3615
3619
+ joe_satriani;3616
3620
+ ken_hensley;3617
3621
+ kim_mitchell;3618
3622
+ king_s_x;3619
3623
+ kotiteollisuus;3620
3624
+ la_renga;3621
3625
+ lee_aaron;3622
3626
+ lordi;3623
3627
+ michael_schenker_group;3624
3628
+ mustasch;3625
3629
+ night_ranger;3626
3630
+ omega;3627
3631
+ parni_valjak;3628
3632
+ paul_gilbert;3629
3633
+ popeda;3630
3634
+ skid_row;3631
3635
+ tankcsapda;3632
3636
+ the_bronx;3633
3637
+ the_donnas;3634
3638
+ all_that_remains;3635
3639
+ triumph;3636
3640
+ umphrey_s_mcgee;3637
3641
+ y_t;3638
3642
+ ziggy;3639
3643
+ sfdk;3640
3644
+ 7_seconds;3641
3645
+ aiden;3642
3646
+ alphaville;3643
3647
+ black_flag;3644
3648
+ slayer;3645
3649
+ circle_jerks;3646
3650
+ ritchie;3647
3651
+ converge;3648
3652
+ every_time_i_die;3649
3653
+ hatebreed;3650
3654
+ nomeansno;3651
3655
+ rancid;3652
3656
+ memphis_may_fire;3653
3657
+ nofx;3654
3658
+ propagandhi;3655
3659
+ tankard;3656
3660
+ screeching_weasel;3657
3661
+ sick_of_it_all;3658
3662
+ silverstein;3659
3663
+ two_steps_from_hell;3660
3664
+ faun;3661
3665
+ accept;3662
3666
+ the_frames;3663
3667
+ andromeda;3664
3668
+ annihilator;3665
3669
+ anvil;3666
3670
+ artillery;3667
3671
+ avenged_sevenfold;3668
3672
+ axxis;3669
3673
+ blind_guardian;3670
3674
+ vanden_plas;3671
3675
+ grave_digger;3672
3676
+ dragonforce;3673
3677
+ edenbridge;3674
3678
+ damien_jurado;3675
3679
+ exciter;3676
3680
+ firewind;3677
3681
+ halford;3678
3682
+ hammerfall;3679
3683
+ helloween;3680
3684
+ helstar;3681
3685
+ iced_earth;3682
3686
+ jag_panzer;3683
3687
+ machinae_supremacy;3684
3688
+ manowar;3685
3689
+ metal_church;3686
3690
+ morgana_lefay;3687
3691
+ mudvayne;3688
3692
+ nocturnal_rites;3689
3693
+ overkill;3690
3694
+ primal_fear;3691
3695
+ rebellion;3692
3696
+ running_wild;3693
3697
+ corey_hart;3694
3698
+ savatage;3695
3699
+ saxon;3696
3700
+ steve_vai;3697
3701
+ tad_morose;3698
3702
+ tarot;3699
3703
+ tierra_santa;3700
3704
+ trivium;3701
3705
+ turmion_k_til_t;3702
3706
+ u_d_o;3703
3707
+ virgin_steele;3704
3708
+ voivod;3705
3709
+ warcry;3706
3710
+ yngwie_malmsteen;3707
3711
+ zion_lennox;3708
3712
+ sido;3709
3713
+ mc_chris;3710
3714
+ assalti_frontali;3711
3715
+ kool_keith;3712
3716
+ ayumi_hamasaki;3713
3717
+ az;3714
3718
+ bahh_tee;3715
3719
+ bassi_maestro;3716
3720
+ revocation;3717
3721
+ blumentopf;3718
3722
+ brockhampton;3719
3723
+ bts;3720
3724
+ bushido;3721
3725
+ vinnie_paz;3722
3726
+ chakuza;3723
3727
+ cheek;3724
3728
+ cro;3725
3729
+ arc_ngel;3726
3730
+ alexis_fido;3727
3731
+ dargen_d_amico;3728
3732
+ the_coup;3729
3733
+ def_con_dos;3730
3734
+ die_fantastischen_vier;3731
3735
+ dom_no;3732
3736
+ donguralesko;3733
3737
+ epmd;3734
3738
+ kool_savas;3735
3739
+ fettes_brot;3736
3740
+ fronda;3737
3741
+ mc_solaar;3738
3742
+ pyhimys;3739
3743
+ kaaris;3740
3744
+ kollegah;3741
3745
+ kontra_k;3742
3746
+ k_k;3743
3747
+ l_o_c;3744
3748
+ logic;3745
3749
+ jerry_rivera;3746
3750
+ murs;3747
3751
+ angie_stone;3748
3752
+ namie_amuro;3749
3753
+ anthony_hamilton;3750
3754
+ lyfe_jennings;3751
3755
+ bl_f;3752
3756
+ o_s_t_r;3753
3757
+ paluch;3754
3758
+ parazi_ii;3755
3759
+ porta;3756
3760
+ bleeding_through;3757
3761
+ prinz_pi;3758
3762
+ rasmentalism;3759
3763
+ xavier_naidoo;3760
3764
+ sage_francis;3761
3765
+ stupeflip;3762
3766
+ young_thug;3763
3767
+ tego_calder_n;3764
3768
+ fifth_harmony;3765
3769
+ jay_chou;3766
3770
+ blitzkid;3767
3771
+ zumbis_do_espa_o;3768
3772
+ deer_tick;3769
3773
+ half_man_half_biscuit;3770
3774
+ hayden;3771
3775
+ club_8;3772
3776
+ grandaddy;3773
3777
+ jens_lekman;3774
3778
+ kent;3775
3779
+ keren_ann;3776
3780
+ los_campesinos;3777
3781
+ nellie_mckay;3778
3782
+ china_crisis;3779
3783
+ prefab_sprout;3780
3784
+ the_clientele;3781
3785
+ the_lucksmiths;3782
3786
+ bell_x1;3783
3787
+ british_sea_power;3784
3788
+ car_seat_headrest;3785
3789
+ deerhunter;3786
3790
+ dr_dog;3787
3791
+ elf_power;3788
3792
+ frightened_rabbit;3789
3793
+ fugazi;3790
3794
+ fury_in_the_slaughterhouse;3791
3795
+ julie_doiron;3792
3796
+ tinashe;3793
3797
+ la_habitaci_n_roja;3794
3798
+ margot_the_nuclear_so_and_so_s;3795
3799
+ matt_pond_pa;3796
3800
+ metric;3797
3801
+ mike_doughty;3798
3802
+ mother_mother;3799
3803
+ piebald;3800
3804
+ quasi;3801
3805
+ rheostatics;3802
3806
+ sebadoh;3803
3807
+ spoon;3804
3808
+ starflyer_59;3805
3809
+ stephen_malkmus;3806
3810
+ stereolab;3807
3811
+ ted_leo_and_the_pharmacists;3808
3812
+ the_appleseed_cast;3809
3813
+ the_faint;3810
3814
+ the_go_betweens;3811
3815
+ the_pineapple_thief;3812
3816
+ the_undertones;3813
3817
+ tronic;3814
3818
+ chris_de_burgh;3815
3819
+ mass_hysteria;3816
3820
+ angelo_branduardi;3817
3821
+ gigi_d_alessio;3818
3822
+ i_muvrini;3819
3823
+ back_number;3820
3824
+ boa;3821
3825
+ claris;3822
3826
+ crystal_kay;3823
3827
+ zard;3824
3828
+ gackt;3825
3829
+ garnet_crow;3826
3830
+ girls_generation;3827
3831
+ kat_tun;3828
3832
+ koda_kumi;3829
3833
+ kotoko;3830
3834
+ lisa;3831
3835
+ maaya_sakamoto;3832
3836
+ masami_okui;3833
3837
+ mr_children;3834
3838
+ news;3835
3839
+ shinee;3836
3840
+ w_inds;3837
3841
+ yui;3838
3842
+ yumi_matsutoya;3839
3843
+ the_high_lows;3840
3844
+ sid;3841
3845
+ abbey_lincoln;3842
3846
+ anna_maria_jopek;3843
3847
+ cassandra_wilson;3844
3848
+ dianne_reeves;3845
3849
+ fred_buscaglione;3846
3850
+ jane_monheit;3847
3851
+ zor_n;3848
3852
+ kraan;3849
3853
+ laura_fygi;3850
3854
+ michael_franks;3851
3855
+ natalino_otto;3852
3856
+ quartetto_cetra;3853
3857
+ scott_bradlee_s_postmodern_jukebox;3854
3858
+ stacey_kent;3855
3859
+ the_flower_kings;3856
3860
+ ronnie_von;3857
3861
+ brown_eyed_girls;3858
3862
+ ahmet_kaya;3859
3863
+ alejandra_guzm_n;3860
3864
+ ana_carolina;3861
3865
+ alcione;3862
3866
+ el_chapo_de_sinaloa;3863
3867
+ gustavo_cerati;3864
3868
+ soda_stereo;3865
3869
+ jenni_rivera;3866
3870
+ joaqu_n_sabina;3867
3871
+ los_fabulosos_cadillacs;3868
3872
+ abel_pintos;3869
3873
+ ana_bel_n;3870
3874
+ aterciopelados;3871
3875
+ camilo_sesto;3872
3876
+ david_demar_a;3873
3877
+ gian_marco;3874
3878
+ menudo;3875
3879
+ ricardo_arjona;3876
3880
+ sabroso;3877
3881
+ v_ctor_manuel;3878
3882
+ las_pelotas;3879
3883
+ ariel_pink;3880
3884
+ leehom_wang;3881
3885
+ jolin_tsai;3882
3886
+ darkest_hour;3883
3887
+ kalmah;3884
3888
+ nightrage;3885
3889
+ eppu_normaali;3886
3890
+ the_outfield;3887
3891
+ no_use_for_a_name;3888
3892
+ pennywise;3889
3893
+ callejon;3890
3894
+ d_f_c;3891
3895
+ our_last_night;3892
3896
+ exaltasamba;3893
3897
+ beth_carvalho;3894
3898
+ jo_o_bosco;3895
3899
+ marina_lima;3896
3900
+ marisa_monte;3897
3901
+ nando_reis;3898
3902
+ natiruts;3899
3903
+ ra_a_negra;3900
3904
+ s_pra_contrariar;3901
3905
+ zeca_pagodinho;3902
3906
+ andr_hazes;3903
3907
+ de_dijk;3904
3908
+ arena;3905
3909
+ iq;3906
3910
+ sol_invictus;3907
3911
+ new_found_glory;3908
3912
+ adam_ant;3909
3913
+ berlin;3910
3914
+ hoodoo_gurus;3911
3915
+ ultravox;3912
3916
+ nik_kershaw;3913
3917
+ squeeze;3914
3918
+ the_aquabats;3915
3919
+ the_fixx;3916
3920
+ beat_crusaders;3917
3921
+ cows;3918
3922
+ conjunto_primavera;3919
3923
+ peter_and_the_test_tube_babies;3920
3924
+ sham_69;3921
3925
+ the_adicts;3922
3926
+ the_analogs;3923
3927
+ instalok;3924
3928
+ jacek_kaczmarski;3925
3929
+ przemys_aw_gintrowski;3926
3930
+ ada_band;3927
3931
+ agnetha_f_ltskog;3928
3932
+ ajda_pekkan;3929
3933
+ al_bano;3930
3934
+ alex_ubago;3931
3935
+ alison_moyet;3932
3936
+ alunni_del_sole;3933
3937
+ anna_oxa;3934
3938
+ bajm;3935
3939
+ barclay_james_harvest;3936
3940
+ blue_system;3937
3941
+ brunner_brunner;3938
3942
+ candan_er_etin;3939
3943
+ christian_bautista;3940
3944
+ clay_aiken;3941
3945
+ clifford_t_ward;3942
3946
+ daniel;3943
3947
+ don_backy;3944
3948
+ jesse_mccartney;3945
3949
+ emma;3946
3950
+ marcella_bella;3947
3951
+ giorgio_gaber;3948
3952
+ guus_meeuwis;3949
3953
+ heinz_rudolf_kunze;3950
3954
+ john_farnham;3951
3955
+ ian_thomas;3952
3956
+ i_n_karaca;3953
3957
+ jennifer_rush;3954
3958
+ jo_vally;3955
3959
+ john_fogerty;3956
3960
+ julian_lennon;3957
3961
+ k3;3958
3962
+ kid_abelha;3959
3963
+ labv_l_gais_tips;3960
3964
+ l_vi;3961
3965
+ lea_salonga;3962
3966
+ les_wampas;3963
3967
+ magnus_uggla;3964
3968
+ mango;3965
3969
+ maria_mena;3966
3970
+ massimo_ranieri;3967
3971
+ max_gazz;3968
3972
+ michael_learns_to_rock;3969
3973
+ mietta;3970
3974
+ mustafa_sandal;3971
3975
+ nil_fer;3972
3976
+ peter_frampton;3973
3977
+ pr_ta_v_tra;3974
3978
+ pur;3975
3979
+ rettore;3976
3980
+ ricchi_e_poveri;3977
3981
+ rob_de_nijs;3978
3982
+ sara_bareilles;3979
3983
+ sasha;3980
3984
+ sertab_erener;3981
3985
+ sezen_aksu;3982
3986
+ stadio;3983
3987
+ stephen_sondheim;3984
3988
+ tamara;3985
3989
+ team_starkid;3986
3990
+ toto_cutugno;3987
3991
+ umberto_tozzi;3988
3992
+ herman_brood;3989
3993
+ wanessa;3990
3994
+ zen_caf;3991
3995
+ bonanza_banzai;3992
3996
+ bodyjar;3993
3997
+ bracket;3994
3998
+ frenzal_rhomb;3995
3999
+ goldfinger;3996
4000
+ the_wonder_years;3997
4001
+ useless_id;3998
4002
+ camel;3999
4003
+ hombres_g;4000
4004
+ leo_jaime;4001
4005
+ neal_morse;4002
4006
+ spock_s_beard;4003
4007
+ new_trolls;4004
4008
+ opus;4005
4009
+ piersi;4006
4010
+ premiata_forneria_marconi;4007
4011
+ superbus;4008
4012
+ zmelkoow;4009
4013
+ boysetsfire;4010
4014
+ hot_water_music;4011
4015
+ new_model_army;4012
4016
+ the_monochrome_set;4013
4017
+ big_big_train;4014
4018
+ avantasia;4015
4019
+ dark_moor;4016
4020
+ dreamtale;4017
4021
+ freedom_call;4018
4022
+ mystic_prophecy;4019
4023
+ nightmare;4020
4024
+ rhapsody_of_fire;4021
4025
+ royal_hunt;4022
4026
+ sonata_arctica;4023
4027
+ stratovarius;4024
4028
+ symphony_x;4025
4029
+ vision_divine;4026
4030
+ the_wildhearts;4027
4031
+ armia;4028
4032
+ evergrey;4029
4033
+ lana_lane;4030
4034
+ nektar;4031
4035
+ pain_of_salvation;4032
4036
+ riverside;4033
4037
+ beardfish;4034
4038
+ echolyn;4035
4039
+ eloy;4036
4040
+ john_wetton;4037
4041
+ medina_azahara;4038
4042
+ mostly_autumn;4039
4043
+ pendragon;4040
4044
+ rafo_r_ez;4041
4045
+ the_meteors;4042
4046
+ against_me;4043
4047
+ anti_flag;4044
4048
+ banda_bassotti;4045
4049
+ cadena_perpetua;4046
4050
+ descendents;4047
4051
+ distemper;4048
4052
+ dogwood;4049
4053
+ el_ltimo_ke_zierre;4050
4054
+ farben_lehre;4051
4055
+ toy_dolls;4052
4056
+ junkies;4053
4057
+ ksu;4054
4058
+ la_polla_records;4055
4059
+ la_vela_puerca;4056
4060
+ leatherface;4057
4061
+ less_than_jake;4058
4062
+ mad_caddies;4059
4063
+ millencolin;4060
4064
+ punkreas;4061
4065
+ reel_big_fish;4062
4066
+ snfu;4063
4067
+ stiff_little_fingers;4064
4068
+ swingin_utters;4065
4069
+ the_bouncing_souls;4066
4070
+ the_casualties;4067
4071
+ the_dickies;4068
4072
+ the_lawrence_arms;4069
4073
+ toyah;4070
4074
+ gerald_levert;4071
4075
+ gondwana;4072
4076
+ los_aut_nticos_decadentes;4073
4077
+ los_cafres;4074
4078
+ los_pericos;4075
4079
+ tryo;4076
4080
+ rakim_ken_y;4077
4081
+ billy_squier;4078
4082
+ bj_rn_afzelius;4079
4083
+ glay;4080
4084
+ hunters_collectors;4081
4085
+ john_entwistle;4082
4086
+ jokke;4083
4087
+ la_beriso;4084
4088
+ los_rancheros;4085
4089
+ los_tres;4086
4090
+ maanam;4087
4091
+ mikel_erentxun;4088
4092
+ peter_wolf;4089
4093
+ racoon;4090
4094
+ rev_lver;4091
4095
+ riblja_orba;4092
4096
+ sandro;4093
4097
+ gene_vincent;4094
4098
+ the_baseballs;4095
4099
+ stray_cats;4096
4100
+ as_marcianas;4097
4101
+ bruno_marrone;4098
4102
+ cristiano_ara_jo;4099
4103
+ fernando_sorocaba;4100
4104
+ joint_venture;4101
4105
+ serge_reggiani;4102
4106
+ ska_p;4103
4107
+ the_mighty_mighty_bosstones;4104
4108
+ fu_manchu;4105
4109
+ jay_jay_johanson;4106
4110
+ psyche;4107
4111
+ carlos_gardel;4108
jukebox/data/ids/v2_genre_ids.txt ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ unknown;0
2
+ classical;1
3
+ blues;2
4
+ hip;3
5
+ hop;4
6
+ dance;5
7
+ soul;6
8
+ hard;7
9
+ rock;8
10
+ jazz;9
11
+ reggae;10
12
+ country;11
13
+ alternative;12
14
+ soundtrack;13
15
+ pop;14
16
+ bluegrass;15
17
+ vocal;16
18
+ r;17
19
+ b;18
20
+ rap;19
21
+ christian;20
22
+ gospel;21
23
+ electronic;22
24
+ christmas;23
25
+ singer;24
26
+ songwriter;25
27
+ metal;26
28
+ n;27
29
+ roll;28
30
+ synthpop;29
31
+ electronica;30
32
+ mpb;31
33
+ movie;32
34
+ indie;33
35
+ new;34
36
+ wave;35
37
+ electro;36
38
+ house;37
39
+ folk;38
40
+ punk;39
41
+ french;40
42
+ contemporary;41
43
+ garage;42
44
+ soft;43
45
+ acoustic;44
46
+ nu;45
47
+ television;46
48
+ post;47
49
+ eurodance;48
50
+ progressive;49
51
+ gothic;50
52
+ classic;51
53
+ funk;52
54
+ disco;53
55
+ swing;54
56
+ trance;55
57
+ thrash;56
58
+ psychedelic;57
59
+ heavy;58
60
+ american;59
61
+ grunge;60
62
+ art;61
63
+ j;62
64
+ gangsta;63
65
+ brazilian;64
66
+ latin;65
67
+ southern;66
68
+ ska;67
69
+ crossover;68
70
+ hardcore;69
71
+ industrial;70
72
+ glam;71
73
+ melodic;72
74
+ ambient;73
75
+ musical;74
76
+ dream;75
77
+ experimental;76
78
+ americana;77
79
+ chanson;78
80
+ rockabilly;79
81
+ britpop;80
82
+ children;81
83
+ s;82
84
+ music;83
85
+ electropop;84
86
+ power;85
87
+ celtic;86
88
+ dark;87
89
+ comedy;88
90
+ doom;89
91
+ trip;90
92
+ lo;91
93
+ fi;92
94
+ metalcore;93
95
+ symphonic;94
96
+ fado;95
97
+ schlager;96
98
+ avant;97
99
+ garde;98
100
+ europop;99
101
+ reggaeton;100
102
+ emo;101
103
+ death;102
104
+ samba;103
105
+ deathcore;104
106
+ black;105
107
+ horrorcore;106
108
+ grindcore;107
109
+ worship;108
110
+ salsa;109
111
+ ebm;110
112
+ neofolk;111
113
+ sertanejo;112
114
+ deutschrock;113
115
+ norte;114
116
+ o;115
117
+ ax;116
118
+ k;117
119
+ tejano;118
120
+ medieval;119
jukebox/data/ids/v3_artist_ids.txt ADDED
The diff for this file is too large to render. See raw diff
 
jukebox/data/ids/v3_genre_ids.txt ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ electroclash;1
2
+ acid rock;2
3
+ christian metal;3
4
+ pop rock;4
5
+ gothic;5
6
+ big beat;6
7
+ psychedelic rock‎;7
8
+ funk carioca;8
9
+ bebop;9
10
+ dance punk;10
11
+ trad jazz;11
12
+ romantic;12
13
+ andean music;13
14
+ volksmusik;14
15
+ coldwave;15
16
+ gospel blues;16
17
+ italian folk;17
18
+ disney;18
19
+ dark wave‏‎;19
20
+ powerviolence;20
21
+ bachata;21
22
+ soft rock;22
23
+ s music"];23
24
+ bubblegum dance;24
25
+ western swing;25
26
+ alternative country;26
27
+ latin pop;27
28
+ eurobeat;28
29
+ n;29
30
+ unblack metal;30
31
+ surf;31
32
+ nu-disco;32
33
+ event;33
34
+ classical;34
35
+ nasheed;35
36
+ jovem guarda;36
37
+ british blues;37
38
+ bossa nova;38
39
+ detroit blues;39
40
+ rock;40
41
+ contemporary christian;41
42
+ dark ambient;42
43
+ noise rock;43
44
+ axé;44
45
+ soca;45
46
+ dance-rock;46
47
+ contemporary jazz;47
48
+ appalachian folk;48
49
+ humppa‎;49
50
+ ambient;50
51
+ funeral doom;51
52
+ southern gospel;52
53
+ video game‎;53
54
+ hip hop;54
55
+ glitch hop;55
56
+ krautrock;56
57
+ breakcore;57
58
+ ska;58
59
+ traditional folk;59
60
+ psychedelic trance;60
61
+ reggae‏‎;61
62
+ noise pop;62
63
+ drumstep;63
64
+ house;64
65
+ teen pop;65
66
+ sea shanties;66
67
+ junkanoo;67
68
+ mandopop;68
69
+ pre-war blues;69
70
+ doom metal;70
71
+ oi-punk;71
72
+ swamp rock;72
73
+ crunkcore;73
74
+ rap rock;74
75
+ roots;75
76
+ country rap;76
77
+ avant-garde;77
78
+ cumbia;78
79
+ glam metal;79
80
+ groove metal;80
81
+ electric blues;81
82
+ new orleans rhythm and blues;82
83
+ canadian hip hop;83
84
+ freestyle;84
85
+ deathgrind;85
86
+ idm;86
87
+ comedy rock;87
88
+ art punk;88
89
+ progg;89
90
+ work songs;90
91
+ art pop;91
92
+ conjunto;92
93
+ persian;93
94
+ parody;94
95
+ jazz-funk;95
96
+ french hip hop;96
97
+ spirituals;97
98
+ african;98
99
+ middle-eastern;99
100
+ minimal;100
101
+ ranchera;101
102
+ industrial rock;102
103
+ electro house;103
104
+ celtic rock;104
105
+ death doom;105
106
+ grupera;106
107
+ jazz fusion‎;107
108
+ political folk;108
109
+ christian punk;109
110
+ rapcore;110
111
+ j-pop;111
112
+ mashup;112
113
+ metalcore;113
114
+ progressive country;114
115
+ power noise;115
116
+ hip house;116
117
+ crossover thrash;117
118
+ electropop‎;118
119
+ psychedelic folk;119
120
+ punk rock;120
121
+ classic rock;121
122
+ zydeco;122
123
+ afrobeat;123
124
+ salsa;124
125
+ banda;125
126
+ chill-out;126
127
+ morna;127
128
+ minnesang;128
129
+ alternative metal;129
130
+ djent;130
131
+ african folk;131
132
+ mambo;132
133
+ sertanejo;133
134
+ classic pop;134
135
+ soul;135
136
+ australian hip hop;136
137
+ symphonic rock;137
138
+ celtic punk;138
139
+ synthpop‎;139
140
+ europop;140
141
+ funk;141
142
+ jazz blues;142
143
+ vocal trance;143
144
+ celtic fusion;144
145
+ industrial;145
146
+ kirtan;146
147
+ slowcore;147
148
+ flamenco;148
149
+ piano blues;149
150
+ texas blues;150
151
+ aggrotech;151
152
+ steampunk;152
153
+ opera;153
154
+ folktronica;154
155
+ klezmer;155
156
+ nwobhm;156
157
+ goregrind;157
158
+ rac;158
159
+ neo-psychedelia‏‎;159
160
+ post-rock‎;160
161
+ hard bop;161
162
+ gypsy jazz;162
163
+ new orleans blues;163
164
+ doo-wop;164
165
+ soul blues;165
166
+ trap;166
167
+ indietronica;167
168
+ psychobilly;168
169
+ euro disco;169
170
+ neo-progressive rock;170
171
+ canterbury;171
172
+ freak folk;172
173
+ midwest rap;173
174
+ instrumental rock;174
175
+ dance-pop;175
176
+ avant-garde metal;176
177
+ edm;177
178
+ deep house;178
179
+ progressive bluegrass;179
180
+ rave;180
181
+ australian folk;181
182
+ comic opera;182
183
+ sunshine pop;183
184
+ gregorian chant;184
185
+ psychedelic rock;185
186
+ honky tonk;186
187
+ rock 'n' roll;187
188
+ television;188
189
+ nintendocore;189
190
+ jump blues;190
191
+ roots reggae;191
192
+ traditional bluegrass;192
193
+ operatic pop;193
194
+ skate punk;194
195
+ reggaeton;195
196
+ manele;196
197
+ middle-eastern hip hop;197
198
+ skiffle;198
199
+ nsbm;199
200
+ nu jazz;200
201
+ disco;201
202
+ horrorcore;202
203
+ early music;203
204
+ post-bop;204
205
+ gothic rock;205
206
+ crack rock steady;206
207
+ easy listening;207
208
+ psychedelic;208
209
+ christian;209
210
+ brutal death metal;210
211
+ experimental rock;211
212
+ modern classical‎;212
213
+ drum and bass;213
214
+ dark wave;214
215
+ dubstep;215
216
+ grunge;216
217
+ christian hip hop;217
218
+ latin jazz;218
219
+ r&b;219
220
+ s music", ;220
221
+ free jazz;221
222
+ experimental hip hop;222
223
+ swing;223
224
+ smooth jazz;224
225
+ southern metal;225
226
+ religious;226
227
+ progressive death metal;227
228
+ contemporary folk;228
229
+ j-rock;229
230
+ jazz;230
231
+ hamburger schule;231
232
+ teen pop‎;232
233
+ crossover;233
234
+ italo disco;234
235
+ deathcore;235
236
+ blues;236
237
+ crunk;237
238
+ jangle pop;238
239
+ indian classical music;239
240
+ big band;240
241
+ proto-punk;241
242
+ dirty blues;242
243
+ garage punk;243
244
+ extreme metal;244
245
+ folk metal;245
246
+ neo soul;246
247
+ electric folk;247
248
+ synthwave;248
249
+ arena rock;249
250
+ post-grunge;250
251
+ indie rock;251
252
+ acoustic blues;252
253
+ native american;253
254
+ progressive trance;254
255
+ nu metal;255
256
+ digital hardcore;256
257
+ brazilian rock;257
258
+ funky house;258
259
+ symphonic black metal;259
260
+ lounge music;260
261
+ brega;261
262
+ trance;262
263
+ industrial metal;263
264
+ austropop;264
265
+ bhangra;265
266
+ new wave;266
267
+ neoclassical;267
268
+ post-metal;268
269
+ dub;269
270
+ industrial metal‎;270
271
+ irish folk;271
272
+ deutschrock;272
273
+ gypsy;273
274
+ dark electro;274
275
+ alternative hip hop;275
276
+ mbaqanga;276
277
+ swamp blues;277
278
+ french pop;278
279
+ tango;279
280
+ rockabilly;280
281
+ old-time music;281
282
+ blues rock;282
283
+ scottish folk;283
284
+ indie folk;284
285
+ nazi-punk;285
286
+ deutschpunk;286
287
+ piedmont blues;287
288
+ beatbox;288
289
+ worship;289
290
+ heavy metal;290
291
+ underground hip hop;291
292
+ mixed;292
293
+ electro;293
294
+ tropicalismo;294
295
+ jazz fusion;295
296
+ worldbeat;296
297
+ hill country blues;297
298
+ a cappella;298
299
+ dixieland;299
300
+ hi-nrg;300
301
+ punk blues;301
302
+ anti-folk;302
303
+ east coast blues;303
304
+ polka;304
305
+ mod revival;305
306
+ soundtrack/musical;306
307
+ movie;307
308
+ outlaw country;308
309
+ rock against communism;309
310
+ barbershop;310
311
+ math rock;311
312
+ avant-garde‎;312
313
+ psychedelic pop;313
314
+ synthpop;314
315
+ post-punk‎;315
316
+ queercore;316
317
+ death metal;317
318
+ political hip hop;318
319
+ thrashcore;319
320
+ acid house;320
321
+ post-hardcore‎;321
322
+ electro-industrial;322
323
+ rio;323
324
+ southern hip hop;324
325
+ filk;325
326
+ duranguense;326
327
+ latin hip hop;327
328
+ pop punk;328
329
+ space rock;329
330
+ j-rap;330
331
+ deep house‎;331
332
+ baroque pop;332
333
+ chiptune;333
334
+ heartland rock;334
335
+ dancehall;335
336
+ experimental pop;336
337
+ adult contemporary‎;337
338
+ boogie woogie;338
339
+ country pop;339
340
+ power pop;340
341
+ west coast hip hop;341
342
+ thrash metal;342
343
+ avant-pop;343
344
+ enka;344
345
+ k-pop;345
346
+ post-britpop;346
347
+ vocalese;347
348
+ volkslied;348
349
+ reggae fusion;349
350
+ funk rock;350
351
+ tech house;351
352
+ adult contemporary;352
353
+ death 'n' roll;353
354
+ russian rock;354
355
+ latin rock;355
356
+ folk punk;356
357
+ west coast blues;357
358
+ progressive black metal;358
359
+ progressive metal;359
360
+ cajun;360
361
+ sophisti-pop;361
362
+ rock 'n' roll‎;362
363
+ post-punk;363
364
+ symphonic metal;364
365
+ beat;365
366
+ alternative rock‎;366
367
+ art rock;367
368
+ bakersfield sound;368
369
+ indie pop;369
370
+ folk;370
371
+ acid jazz;371
372
+ dream pop;372
373
+ pop-rap;373
374
+ eurodance;374
375
+ vaudeville;375
376
+ louisiana blues;376
377
+ baião;377
378
+ downtempo;378
379
+ jug band;379
380
+ neo-psychedelia;380
381
+ sufi;381
382
+ medieval;382
383
+ singer-songwriter‎;383
384
+ outsider music;384
385
+ pop-folk;385
386
+ martial industrial;386
387
+ samba;387
388
+ alternative dance;388
389
+ children's music‎;389
390
+ anarcho-punk;390
391
+ dark rock;391
392
+ rock en español;392
393
+ balearic beat;393
394
+ electropunk;394
395
+ urban contemporary;395
396
+ ragtime;396
397
+ british invasion;397
398
+ bubblegum pop;398
399
+ rap metal;399
400
+ soundtrack/television;400
401
+ blues revival;401
402
+ reggae;402
403
+ schlager;403
404
+ dance band;404
405
+ video game;405
406
+ crust punk;406
407
+ cabaret;407
408
+ ska punk‎;408
409
+ bolero;409
410
+ canadian folk;410
411
+ neofolk;411
412
+ shoegazing;412
413
+ acoustic;413
414
+ modern classical;414
415
+ swamp pop;415
416
+ celtic;416
417
+ futurepop;417
418
+ g-funk;418
419
+ norteño;419
420
+ orchestral;420
421
+ boogie rock;421
422
+ tejano;422
423
+ new age;423
424
+ soul jazz;424
425
+ cantopop;425
426
+ progressive metalcore;426
427
+ mathcore;427
428
+ new rave;428
429
+ neue deutsche welle;429
430
+ delta blues;430
431
+ lo-fi;431
432
+ poetry;432
433
+ hatecore;433
434
+ chanson;434
435
+ underground hip hop;435
436
+ pirate metal;436
437
+ trip hop;437
438
+ fado;438
439
+ americana;439
440
+ hardcore hip hop;440
441
+ post-industrial;441
442
+ grime;442
443
+ southern rock;443
444
+ grindcore;444
445
+ musical;445
446
+ hard trance;446
447
+ ska punk;447
448
+ post-rock;448
449
+ uk garage;449
450
+ melodic metalcore;450
451
+ black metal;451
452
+ visual kei;452
453
+ soundtrack;453
454
+ axé‎;454
455
+ hardcore punk;455
456
+ western;456
457
+ blackgaze;457
458
+ christian rock;458
459
+ technical death metal;459
460
+ christian hardcore;460
461
+ christmas;461
462
+ breakbeat;462
463
+ francophone;463
464
+ choral;464
465
+ progressive folk;465
466
+ mystic folk;466
467
+ melodic death metal;467
468
+ horror punk;468
469
+ country blues;469
470
+ nederpop;470
471
+ post-hardcore;471
472
+ future garage;472
473
+ techno;473
474
+ swiss rock;474
475
+ dance-pop‎;475
476
+ electronicore;476
477
+ post-punk revival;477
478
+ glitch;478
479
+ calypso;479
480
+ ragga;480
481
+ britpop;481
482
+ rock opera;482
483
+ cowpunk;483
484
+ la confusion des genres;484
485
+ alternative rock;485
486
+ surf rock;486
487
+ ballad;487
488
+ latin;488
489
+ contemporary r&b;489
490
+ forró;490
491
+ ethereal wave;491
492
+ electro swing;492
493
+ novelty;493
494
+ funk melody;494
495
+ punk cabaret;495
496
+ symphonic metal‎;496
497
+ pop;497
498
+ paisley underground;498
499
+ neue deutsche härte;499
500
+ glam rock;500
501
+ nerdcore hip hop;501
502
+ bluegrass;502
503
+ hardstyle;503
504
+ happy hardcore;504
505
+ baroque;505
506
+ speed metal;506
507
+ country;507
508
+ electropop;508
509
+ memphis blues;509
510
+ pagan metal;510
511
+ horror punk‏‎;511
512
+ mariachi;512
513
+ singer-songwriter;513
514
+ children's music;514
515
+ boogie;515
516
+ gothic metal;516
517
+ electronic rock;517
518
+ emo;518
519
+ gospel;519
520
+ ebm;520
521
+ roots rock;521
522
+ vocal;522
523
+ celtic folk;523
524
+ electronic;524
525
+ death metal;525
526
+ gabber;526
527
+ deathrock;527
528
+ experimental;528
529
+ spoken word;529
530
+ screamo;530
531
+ finnish folk;531
532
+ singer only;532
533
+ new jack swing;533
534
+ acid techno;534
535
+ corrido;535
536
+ english folk;536
537
+ american folk;537
538
+ raï;538
539
+ drone doom;539
540
+ hard rock;540
541
+ piano rock;541
542
+ hawaiian;542
543
+ humppa;543
544
+ east coast hip hop;544
545
+ gypsy punk;545
546
+ country rock;546
547
+ jazz‎;547
548
+ mpb;548
549
+ harmonica blues;549
550
+ melodic hardcore;550
551
+ string band;551
552
+ anime;552
553
+ nu metalcore;553
554
+ progressive rock;554
555
+ garage rock;555
556
+ dance;556
557
+ reggae rock;557
558
+ contemporary christian‎;558
559
+ sludge metal;559
560
+ minimal techno;560
561
+ folk rock;561
562
+ drone music;562
563
+ stoner rock;563
564
+ speedcore;564
565
+ chillwave;565
566
+ riot grrrl;566
567
+ chamber music;567
568
+ cool jazz;568
569
+ noise;569
570
+ vocal jazz;570
571
+ progressive rock;571
572
+ afropop;572
573
+ bro-country;573
574
+ goa trance;574
575
+ 2-tone;575
576
+ miami bass;576
577
+ quiet storm;577
578
+ pub rock;578
579
+ power metal;579
580
+ blue-eyed soul;580
581
+ viking metal;581
582
+ gangsta rap;582
583
+ country pop‎;583
584
+ exotica;584
585
+ christian ska;585
586
+ jam band;586
587
+ chicago blues;587
588
+ street punk;588
589
+ funk metal;589
590
+ rap metal;590
591
+ christian hymns;591
592
+ classic female blues;592
593
+ kizomba;593
594
+ comedy;594
595
+ dark cabaret;595
596
+ french house;596
597
+ progressive house;597
598
+ african blues;598
599
+ atmospheric black metal;599
600
+ pop rock‎;600
601
+ blackened death metal;601
602
+ shibuya-kei;602
603
+ electronica;603
604
+ unknown;0
jukebox/data/labels.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch as t
2
+ import numpy as np
3
+ from jukebox.data.artist_genre_processor import ArtistGenreProcessor
4
+ from jukebox.data.text_processor import TextProcessor
5
+
6
+ # Linear window heurisic to get a window of lyric_tokens
7
+ def get_relevant_lyric_tokens(full_tokens, n_tokens, total_length, offset, duration):
8
+ if len(full_tokens) < n_tokens:
9
+ tokens = [0] * (n_tokens - len(full_tokens)) + full_tokens
10
+ indices = [-1] * (n_tokens - len(full_tokens)) + list(range(0, len(full_tokens)))
11
+ else:
12
+ assert 0 <= offset < total_length
13
+ midpoint = int(len(full_tokens) * (offset + duration / 2.0) / total_length)
14
+ midpoint = min(max(midpoint, n_tokens // 2), len(full_tokens) - n_tokens // 2)
15
+ tokens = full_tokens[midpoint - n_tokens // 2:midpoint + n_tokens // 2]
16
+ indices = list(range(midpoint - n_tokens // 2, midpoint + n_tokens // 2))
17
+ assert len(tokens) == n_tokens, f"Expected length {n_tokens}, got {len(tokens)}"
18
+ assert len(indices) == n_tokens, f"Expected length {n_tokens}, got {len(indices)}"
19
+ assert tokens == [full_tokens[index] if index != -1 else 0 for index in indices]
20
+ return tokens, indices
21
+
22
+ class EmptyLabeller():
23
+ def get_label(self, artist=None, genre=None, lyrics=None, total_length=None, offset=None):
24
+ y = np.array([], dtype=np.int64)
25
+ info = dict(artist="n/a", genre="n/a", lyrics=[], full_tokens=[])
26
+ return dict(y=y, info=info)
27
+
28
+ def get_batch_labels(self, metas, device='cpu'):
29
+ ys, infos = [], []
30
+ for meta in metas:
31
+ label = self.get_label()
32
+ y, info = label['y'], label['info']
33
+ ys.append(y)
34
+ infos.append(info)
35
+
36
+ ys = t.stack([t.from_numpy(y) for y in ys], dim=0).to(device).long()
37
+ assert ys.shape[0] == len(metas)
38
+ assert len(infos) == len(metas)
39
+ return dict(y=ys, info=infos)
40
+
41
+ class Labeller():
42
+ def __init__(self, max_genre_words, n_tokens, sample_length, v3=False):
43
+ self.ag_processor = ArtistGenreProcessor(v3)
44
+ self.text_processor = TextProcessor(v3)
45
+ self.n_tokens = n_tokens
46
+ self.max_genre_words = max_genre_words
47
+ self.sample_length = sample_length
48
+ self.label_shape = (4 + self.max_genre_words + self.n_tokens, )
49
+
50
+ def get_label(self, artist, genre, lyrics, total_length, offset):
51
+ artist_id = self.ag_processor.get_artist_id(artist)
52
+ genre_ids = self.ag_processor.get_genre_ids(genre)
53
+
54
+ lyrics = self.text_processor.clean(lyrics)
55
+ full_tokens = self.text_processor.tokenise(lyrics)
56
+ tokens, _ = get_relevant_lyric_tokens(full_tokens, self.n_tokens, total_length, offset, self.sample_length)
57
+
58
+ assert len(genre_ids) <= self.max_genre_words
59
+ genre_ids = genre_ids + [-1] * (self.max_genre_words - len(genre_ids))
60
+ y = np.array([total_length, offset, self.sample_length, artist_id, *genre_ids, *tokens], dtype=np.int64)
61
+ assert y.shape == self.label_shape, f"Expected {self.label_shape}, got {y.shape}"
62
+ info = dict(artist=artist, genre=genre, lyrics=lyrics, full_tokens=full_tokens)
63
+ return dict(y=y, info=info)
64
+
65
+ def get_y_from_ids(self, artist_id, genre_ids, lyric_tokens, total_length, offset):
66
+ assert len(genre_ids) <= self.max_genre_words
67
+ genre_ids = genre_ids + [-1] * (self.max_genre_words - len(genre_ids))
68
+ if self.n_tokens > 0:
69
+ assert len(lyric_tokens) == self.n_tokens
70
+ else:
71
+ lyric_tokens = []
72
+ y = np.array([total_length, offset, self.sample_length, artist_id, *genre_ids, *lyric_tokens], dtype=np.int64)
73
+ assert y.shape == self.label_shape, f"Expected {self.label_shape}, got {y.shape}"
74
+ return y
75
+
76
+ def get_batch_labels(self, metas, device='cpu'):
77
+ ys, infos = [], []
78
+ for meta in metas:
79
+ label = self.get_label(**meta)
80
+ y, info = label['y'], label['info']
81
+ ys.append(y)
82
+ infos.append(info)
83
+
84
+ ys = t.stack([t.from_numpy(y) for y in ys], dim=0).to(device).long()
85
+ assert ys.shape[0] == len(metas)
86
+ assert len(infos) == len(metas)
87
+ return dict(y=ys, info=infos)
88
+
89
+ def set_y_lyric_tokens(self, ys, labels):
90
+ info = labels['info']
91
+ assert ys.shape[0] == len(info)
92
+ if self.n_tokens > 0:
93
+ # total_length, offset, duration):
94
+ tokens_list = []
95
+ indices_list = [] # whats the index of each current character in original array
96
+ for i in range(ys.shape[0]):
97
+ full_tokens = info[i]['full_tokens']
98
+ total_length, offset, duration = ys[i, 0], ys[i, 1], ys[i, 2]
99
+ tokens, indices = get_relevant_lyric_tokens(full_tokens, self.n_tokens, total_length, offset, duration)
100
+ tokens_list.append(tokens)
101
+ indices_list.append(indices)
102
+ ys[:, -self.n_tokens:] = t.tensor(tokens_list, dtype=t.long, device='cuda')
103
+ return indices_list
104
+ else:
105
+ return None
106
+
107
+ def describe_label(self, y):
108
+ assert y.shape == self.label_shape, f"Expected {self.label_shape}, got {y.shape}"
109
+ y = np.array(y).tolist()
110
+ total_length, offset, length, artist_id, *genre_ids = y[:4 + self.max_genre_words]
111
+ tokens = y[4 + self.max_genre_words:]
112
+ artist = self.ag_processor.get_artist(artist_id)
113
+ genre = self.ag_processor.get_genre(genre_ids)
114
+ lyrics = self.text_processor.textise(tokens)
115
+ return dict(artist=artist, genre=genre, lyrics=lyrics)
116
+
117
+
118
+ if __name__ == '__main__':
119
+ labeller = Labeller(5, 512, 8192*8*4*4, v3=False)
120
+ label = labeller.get_label("Alan Jackson", "Country Rock", "old town road", 4*60*44100, 0)
121
+ print(label, labeller.describe_label(label['y']))
122
+
123
+ labeller = Labeller(1, 384, 6144*8*4*4, v3=True)
124
+ label = labeller.get_label("Alan Jackson", "Country Rock", "old town road", 4*60*44100, 0)
125
+ print(label, labeller.describe_label(label['y']))
126
+
127
+
128
+
129
+
130
+
jukebox/data/text_processor.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from unidecode import unidecode
3
+
4
+ class TextProcessor():
5
+ def __init__(self, v3=False):
6
+ if v3:
7
+ vocab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,:;!?-\'\"()[] \t\n'
8
+ not_vocab = re.compile('[^A-Za-z0-9.,:;!?\-\'\"()\[\] \t\n]+')
9
+ else:
10
+ vocab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,:;!?-+\'\"()[] \t\n'
11
+ not_vocab = re.compile('[^A-Za-z0-9.,:;!?\-+\'\"()\[\] \t\n]+')
12
+ self.vocab = {vocab[index]: index + 1 for index in range(len(vocab))}
13
+ self.vocab['<unk>'] = 0
14
+ self.n_vocab = len(vocab) + 1
15
+ self.tokens = {v: k for k, v in self.vocab.items()}
16
+ self.tokens[0] = '' # <unk> became ''
17
+ self.not_vocab = not_vocab
18
+
19
+ def clean(self, text):
20
+ text = unidecode(text) # Convert to ascii
21
+ text = text.replace('\\', '\n')
22
+ text = self.not_vocab.sub('', text) # Remove non vocab
23
+ return text
24
+
25
+ def tokenise(self, text):
26
+ return [self.vocab[char] for char in text]
27
+
28
+ def textise(self, tokens):
29
+ return ''.join([self.tokens[token] for token in tokens])
30
+
31
+ def characterise(self, tokens):
32
+ return [self.tokens[token] for token in tokens]
jukebox/hparams.py ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ HPARAMS_REGISTRY = {}
2
+ DEFAULTS = {}
3
+
4
+ class Hyperparams(dict):
5
+ def __getattr__(self, attr):
6
+ return self[attr]
7
+
8
+ def __setattr__(self, attr, value):
9
+ self[attr] = value
10
+
11
+ def setup_hparams(hparam_set_names, kwargs):
12
+ H = Hyperparams()
13
+ if not isinstance(hparam_set_names, tuple):
14
+ hparam_set_names = hparam_set_names.split(",")
15
+ hparam_sets = [HPARAMS_REGISTRY[x.strip()] for x in hparam_set_names if x] + [kwargs]
16
+ for k, v in DEFAULTS.items():
17
+ H.update(v)
18
+ for hps in hparam_sets:
19
+ for k in hps:
20
+ if k not in H:
21
+ raise ValueError(f"{k} not in default args")
22
+ H.update(**hps)
23
+ H.update(**kwargs)
24
+ return H
25
+
26
+ # Teeny for testing
27
+ teeny = Hyperparams(
28
+ )
29
+ HPARAMS_REGISTRY["teeny"] = teeny
30
+
31
+ easy = Hyperparams(
32
+ sr=22050,
33
+ )
34
+ HPARAMS_REGISTRY["easy"] = easy
35
+
36
+ REMOTE_PREFIX = 'https://openaipublic.azureedge.net/'
37
+
38
+ # Model hps
39
+ vqvae = Hyperparams(
40
+ levels = 3,
41
+ downs_t = (3, 2, 2),
42
+ strides_t = (2, 2, 2),
43
+ emb_width = 64,
44
+ l_bins = 2048,
45
+ l_mu = 0.99,
46
+ commit = 0.02,
47
+ spectral = 0.0,
48
+ multispectral = 1.0,
49
+ hvqvae_multipliers = (2, 1, 1),
50
+ loss_fn = 'lmix',
51
+ lmix_l2 = 1.0,
52
+ lmix_linf=0.02,
53
+ width = 32,
54
+ depth = 4,
55
+ m_conv = 1.0,
56
+ dilation_growth_rate = 3,
57
+ restore_vqvae=REMOTE_PREFIX + 'jukebox/models/5b/vqvae.pth.tar',
58
+ )
59
+ HPARAMS_REGISTRY["vqvae"] = vqvae
60
+
61
+ labels = Hyperparams(
62
+ y_bins=(120, 4111),
63
+ t_bins=128,
64
+ max_bow_genre_size=5,
65
+ n_vocab=80,
66
+ )
67
+
68
+ upsamplers = Hyperparams(
69
+ n_ctx=8192,
70
+ prior_width=1920,
71
+ prior_depth=72,
72
+ heads=1,
73
+ attn_order=2,
74
+ blocks=128,
75
+ init_scale=0.4,
76
+ c_res=1,
77
+ cond_width=1024,
78
+ cond_depth=16,
79
+ cond_dilation_growth_rate=3,
80
+ cond_dilation_cycle=8,
81
+ cond_c_res=1,
82
+ use_tokens=False,
83
+ prime_loss_fraction=0.0,
84
+ fp16_params=False,
85
+ )
86
+ upsamplers.update(labels)
87
+
88
+ upsampler_level_0 = Hyperparams(
89
+ level=0,
90
+ restore_prior=REMOTE_PREFIX + 'jukebox/models/5b/prior_level_0.pth.tar'
91
+ )
92
+ upsampler_level_0.update(upsamplers)
93
+ HPARAMS_REGISTRY["upsampler_level_0"] = upsampler_level_0
94
+
95
+ upsampler_level_1 = Hyperparams(
96
+ level=1,
97
+ cond_res_scale=True,
98
+ restore_prior=REMOTE_PREFIX + 'jukebox/models/5b/prior_level_1.pth.tar'
99
+ )
100
+ upsampler_level_1.update(upsamplers)
101
+ HPARAMS_REGISTRY["upsampler_level_1"] = upsampler_level_1
102
+
103
+ prior_5b = Hyperparams(
104
+ level=2,
105
+ n_ctx=8192,
106
+ prior_width=4800,
107
+ prior_depth=72,
108
+ heads=8,
109
+ attn_order=2,
110
+ blocks=128,
111
+ init_scale=0.1,
112
+ c_res=1,
113
+ beta2=0.925,
114
+ min_duration=60.0,
115
+ max_duration=600.0,
116
+ use_tokens=False,
117
+ n_tokens=0,
118
+ prime_loss_fraction=0.0,
119
+ merged_decoder=True,
120
+ restore_prior=REMOTE_PREFIX + 'jukebox/models/5b/prior_level_2.pth.tar',
121
+ fp16_params=True,
122
+ )
123
+ prior_5b.update(labels)
124
+ HPARAMS_REGISTRY["prior_5b"] = prior_5b
125
+
126
+
127
+ prior_5b_lyrics = Hyperparams(
128
+ level=2,
129
+ n_ctx=8192,
130
+ prior_width=4800,
131
+ prior_depth=79,
132
+ heads=8,
133
+ attn_order=10,
134
+ blocks=128,
135
+ init_scale=0.1,
136
+ c_res=1,
137
+ prime_width=1280,
138
+ prime_depth=18,
139
+ prime_heads=4,
140
+ prime_attn_order=2,
141
+ prime_blocks=32,
142
+ prime_init_scale=0.7,
143
+ prime_c_res=1,
144
+ min_duration=23.8,
145
+ max_duration=600.0,
146
+ use_tokens=True,
147
+ n_tokens=512,
148
+ prime_loss_fraction=0.4,
149
+ merged_decoder=True,
150
+ restore_prior=REMOTE_PREFIX + 'jukebox/models/5b_lyrics/prior_level_2.pth.tar',
151
+ fp16_params=True,
152
+ alignment_layer=68,
153
+ alignment_head=2,
154
+ )
155
+ prior_5b_lyrics.update(labels)
156
+ HPARAMS_REGISTRY["prior_5b_lyrics"] = prior_5b_lyrics
157
+
158
+ labels_v3 = Hyperparams(
159
+ y_bins=(604, 7898),
160
+ t_bins=64,
161
+ max_bow_genre_size=1,
162
+ n_vocab=79,
163
+ )
164
+
165
+ prior_1b_lyrics = Hyperparams(
166
+ level=2,
167
+ n_ctx=6144,
168
+ prior_width=2048,
169
+ prior_depth=72,
170
+ heads=2,
171
+ attn_order=12,
172
+ blocks=64,
173
+ init_scale=0.2,
174
+ c_res=1,
175
+ labels_v3=True,
176
+ min_duration=17.84,
177
+ max_duration=600.0,
178
+ use_tokens=True,
179
+ n_tokens=384,
180
+ prime_loss_fraction=0.4,
181
+ single_enc_dec=True,
182
+ restore_prior=REMOTE_PREFIX + 'jukebox/models/1b_lyrics/prior_level_2.pth.tar',
183
+ fp16_params=False,
184
+ alignment_layer=63,
185
+ alignment_head=0,
186
+ )
187
+ prior_1b_lyrics.update(labels_v3)
188
+ HPARAMS_REGISTRY["prior_1b_lyrics"] = prior_1b_lyrics
189
+
190
+ # Small models
191
+ small_vqvae = Hyperparams(
192
+ sr = 22050,
193
+ levels = 2,
194
+ downs_t = (5, 3),
195
+ strides_t = (2, 2),
196
+ emb_width = 64,
197
+ l_bins = 1024,
198
+ l_mu = 0.99,
199
+ commit = 0.02,
200
+ spectral = 0.0,
201
+ multispectral = 1.0,
202
+ loss_fn = 'l2',
203
+ width = 32,
204
+ depth = 4,
205
+ m_conv = 1.0,
206
+ dilation_growth_rate = 3,
207
+ )
208
+ HPARAMS_REGISTRY["small_vqvae"] = small_vqvae
209
+
210
+ small_prior = Hyperparams(
211
+ n_ctx=8192,
212
+ prior_width=1024,
213
+ prior_depth=48,
214
+ heads=1,
215
+ c_res=1,
216
+ attn_order=2,
217
+ blocks=64,
218
+ init_scale=0.7,
219
+ )
220
+ HPARAMS_REGISTRY["small_prior"] = small_prior
221
+
222
+ small_labelled_prior = Hyperparams(
223
+ labels=True,
224
+ labels_v3=True,
225
+ y_bins=(10,100), # Set this to (genres, artists) for your dataset
226
+ max_bow_genre_size=1,
227
+ min_duration=60.0,
228
+ max_duration=600.0,
229
+ t_bins=64,
230
+ )
231
+ small_labelled_prior.update(small_prior)
232
+ HPARAMS_REGISTRY["small_labelled_prior"] = small_labelled_prior
233
+
234
+ small_single_enc_dec_prior = Hyperparams(
235
+ n_ctx=6144,
236
+ prior_width=1024,
237
+ prior_depth=48,
238
+ heads=2,
239
+ attn_order=12,
240
+ blocks=64,
241
+ init_scale=0.7,
242
+ c_res=1,
243
+ prime_loss_fraction=0.4,
244
+ single_enc_dec=True,
245
+ labels=True,
246
+ labels_v3=True,
247
+ y_bins=(10,100), # Set this to (genres, artists) for your dataset
248
+ max_bow_genre_size=1,
249
+ min_duration=60.0,
250
+ max_duration=600.0,
251
+ t_bins=64,
252
+ use_tokens=True,
253
+ n_tokens=384,
254
+ n_vocab=79,
255
+ )
256
+ HPARAMS_REGISTRY["small_single_enc_dec_prior"] = small_single_enc_dec_prior
257
+
258
+ small_sep_enc_dec_prior = Hyperparams(
259
+ n_ctx=6144,
260
+ prior_width=1024,
261
+ prior_depth=50,
262
+ heads=2,
263
+ attn_order=8,
264
+ blocks=64,
265
+ init_scale=0.7,
266
+ c_res=1,
267
+ prime_width=256,
268
+ prime_depth=9,
269
+ prime_heads=2,
270
+ prime_attn_order=2,
271
+ prime_blocks=32,
272
+ prime_init_scale=0.7,
273
+ prime_c_res=1,
274
+ prime_loss_fraction=0.4,
275
+ labels=True,
276
+ labels_v3=True,
277
+ y_bins=(10,100), # Set this to (genres, artists) for your dataset
278
+ max_bow_genre_size=1,
279
+ min_duration=60.0,
280
+ max_duration=600.0,
281
+ t_bins=64,
282
+ use_tokens=True,
283
+ n_tokens=384,
284
+ n_vocab=79,
285
+ )
286
+ HPARAMS_REGISTRY["small_sep_enc_dec_prior"] = small_sep_enc_dec_prior
287
+
288
+ small_upsampler = Hyperparams(
289
+ n_ctx=8192,
290
+ prior_width=1024,
291
+ prior_depth=48,
292
+ heads=1,
293
+ c_res=1,
294
+ attn_order=2,
295
+ blocks=64,
296
+ init_scale=0.7,
297
+ cond_width=512,
298
+ cond_depth=16,
299
+ cond_dilation_growth_rate=3,
300
+ cond_dilation_cycle=8,
301
+ cond_c_res=1,
302
+ )
303
+
304
+ HPARAMS_REGISTRY["small_upsampler"] = small_upsampler
305
+
306
+ all_fp16 = Hyperparams(
307
+ fp16=True,
308
+ fp16_params=True,
309
+ fp16_opt=True,
310
+ fp16_scale_window=250,
311
+ )
312
+ HPARAMS_REGISTRY["all_fp16"] = all_fp16
313
+
314
+ cpu_ema = Hyperparams(
315
+ ema=True,
316
+ cpu_ema=True,
317
+ cpu_ema_freq=100,
318
+ ema_fused=False,
319
+ )
320
+ HPARAMS_REGISTRY["cpu_ema"] = cpu_ema
321
+
322
+
323
+ DEFAULTS["rcall"] = Hyperparams(
324
+ rcall_command="<unknown_rcall_command>",
325
+ git_commit="<unknown_git_commit>",
326
+ )
327
+
328
+ DEFAULTS["script"] = Hyperparams(
329
+ name='',
330
+ debug_mem=False,
331
+ debug_eval_files=False,
332
+ debug_speed=False,
333
+ debug_iters=100,
334
+ debug_batch=False,
335
+ debug_grad_accum=False,
336
+ debug_inputs=False,
337
+ local_path='',
338
+ local_logdir='logs',
339
+ max_len=24,
340
+ max_log=32,
341
+ save=True,
342
+ save_iters=20000,
343
+ seed=0,
344
+ prior=False,
345
+ log_steps=100,
346
+ func='',
347
+ )
348
+
349
+ DEFAULTS["data"] = Hyperparams(
350
+ audio_files_dir='',
351
+ finetune='',
352
+ english_only=False,
353
+ bs=1,
354
+ bs_sample=1,
355
+ nworkers=1,
356
+ aug_shift=False,
357
+ aug_blend=False,
358
+ train_test_split=0.9,
359
+ train_shrink_factor=1.0,
360
+ test_shrink_factor=1.0,
361
+ p_unk=0.1,
362
+ min_duration=None,
363
+ max_duration=None,
364
+ n_tokens=0,
365
+ n_vocab=0,
366
+ use_tokens=False,
367
+ curr_epoch=-1,
368
+ )
369
+
370
+ DEFAULTS["vqvae"] = Hyperparams(
371
+ restore_vqvae='',
372
+ levels=2,
373
+ downs_t=(1,1),
374
+ strides_t=(2,2),
375
+ hvqvae_multipliers=None,
376
+ revival_threshold=1.0,
377
+ emb_width=64,
378
+ l_bins=512,
379
+ l_mu=0.99,
380
+ commit=1.0,
381
+ spectral=0.0,
382
+ multispectral=1.0,
383
+ loss_fn='l2',
384
+ linf_k=2048,
385
+ lmix_l1=0.0,
386
+ lmix_l2=0.0,
387
+ lmix_linf=0.0,
388
+ use_bottleneck=True,
389
+ )
390
+
391
+ DEFAULTS["vqvae_conv_block"] = Hyperparams(
392
+ depth=3,
393
+ width=128,
394
+ m_conv=1.0,
395
+ dilation_growth_rate=1,
396
+ dilation_cycle=None,
397
+ vqvae_reverse_decoder_dilation=True,
398
+ )
399
+
400
+ DEFAULTS["prior"] = Hyperparams(
401
+ restore_prior='',
402
+ restore_prior_ddp=False,
403
+ max_bow_genre_size=None,
404
+ y_bins=0,
405
+ level=0,
406
+ cond_levels=None,
407
+ t_bins=64,
408
+ y_cond_as_bias=False,
409
+ copy_input=False,
410
+ merged_decoder=False,
411
+ single_enc_dec=False,
412
+ alignment_layer=None,
413
+ alignment_head=None,
414
+ )
415
+
416
+ DEFAULTS["prior_attn_block"] = Hyperparams(
417
+ n_ctx=1024,
418
+ prior_depth=3,
419
+ prior_width=128,
420
+ heads=1,
421
+ attn_order=0,
422
+ blocks=None,
423
+ spread=None,
424
+ attn_dropout=0.0,
425
+ resid_dropout=0.0,
426
+ emb_dropout=0.0,
427
+ zero_out=False,
428
+ res_scale=False,
429
+ pos_init=False,
430
+ init_scale=1.0,
431
+ m_attn=0.25,
432
+ m_mlp=1.0,
433
+ c_res=0,
434
+ c_attn=0,
435
+ c_mlp=0,
436
+ )
437
+
438
+ DEFAULTS["cond_conv_block"] = Hyperparams(
439
+ cond_depth=3,
440
+ cond_width=128,
441
+ cond_m_conv=1.0,
442
+ cond_zero_out=False,
443
+ cond_res_scale=False,
444
+ cond_dilation_growth_rate=1,
445
+ cond_dilation_cycle=None,
446
+ cond_c_res=0,
447
+ )
448
+
449
+ DEFAULTS["sample"] = Hyperparams(
450
+ primed_chunk_size=None,
451
+ selected_artists='',
452
+ temp_top=1.0,
453
+ temp_rest=0.99,
454
+ sample_length_in_seconds=24,
455
+ total_sample_length_in_seconds=240,
456
+ )
457
+
458
+ DEFAULTS["prime"] = Hyperparams(
459
+ #encoder_kv_width=128,
460
+ prime_loss_fraction=0.1,
461
+ restore_decoder='',
462
+ )
463
+ DEFAULTS["prime_attn_block"] = Hyperparams(
464
+ prime_depth=3,
465
+ prime_width=128,
466
+ prime_heads=1,
467
+ prime_attn_order=0,
468
+ prime_blocks=None,
469
+ prime_spread=None,
470
+ prime_attn_dropout=0.0,
471
+ prime_resid_dropout=0.0,
472
+ prime_emb_dropout=0.0,
473
+ prime_zero_out=False,
474
+ prime_res_scale=False,
475
+ prime_pos_init=False,
476
+ prime_init_scale=1.0,
477
+ prime_m_attn=0.25,
478
+ prime_m_mlp=1.0,
479
+ prime_c_res=0,
480
+ prime_c_attn=0,
481
+ prime_c_mlp=0,
482
+ prime_rel_attn=False,
483
+ prime_posemb_timescale=10000,
484
+ )
485
+
486
+ DEFAULTS["opt"] = Hyperparams(
487
+ epochs=10000,
488
+ lr=0.0003,
489
+ clip=1.0,
490
+ beta1=0.9,
491
+ beta2=0.999,
492
+ ignore_grad_norm=0,
493
+ weight_decay=0.0,
494
+ eps=1e-08,
495
+ lr_warmup=100.0,
496
+ lr_decay=10000000000.0,
497
+ lr_gamma=1.0,
498
+ lr_scale=1.0,
499
+ lr_use_linear_decay=False,
500
+ lr_start_linear_decay=0,
501
+ lr_use_cosine_decay=False,
502
+ )
503
+
504
+ DEFAULTS["fp16"] = Hyperparams(
505
+ fp16=False,
506
+ fp16_params=False,
507
+ fp16_loss_scale=None,
508
+ fp16_scale_window=1000.0,
509
+ fp16_opt=False,
510
+ )
511
+
512
+ DEFAULTS["train_test_eval"] = Hyperparams(
513
+ labels=True,
514
+ labels_v3=False,
515
+ dump=False,
516
+ ema=True,
517
+ ema_fused=True,
518
+ cpu_ema=False,
519
+ cpu_ema_freq=100,
520
+ reset_best_loss=False,
521
+ reset_step=False,
522
+ reset_opt=False,
523
+ reset_shd=False,
524
+ train=False,
525
+ test=False,
526
+ sample=False,
527
+ sampler='ancestral',
528
+ codes_logdir='',
529
+ date=None,
530
+ labeller='top_genres',
531
+ label_line=0,
532
+ iters_before_update=1,
533
+ grad_accum_iters=0,
534
+ mu=None,
535
+ piped=False,
536
+ pipe_depth=8,
537
+ break_train=1e10,
538
+ break_test=1e10,
539
+ exit_train=1e10,
540
+ )
541
+
542
+ DEFAULTS["audio"] = Hyperparams(
543
+ n_fft=1024,
544
+ hop_length=256,
545
+ window_size=1024,
546
+ sr=44100,
547
+ channels=2,
548
+ wav='',
549
+ n_inps=1,
550
+ n_hops=2,
551
+ n_segment=1,
552
+ n_total_segment=1,
553
+ n_segment_each=1,
554
+ prime_chunks=4,
555
+ sample_length=0,
556
+ sample_hop_length=30000,
557
+ max_silence_pad_length=0,
558
+ ignore_boundaries=False,
559
+ use_nonrelative_specloss=True,
560
+ multispec_loss_n_fft=(2048,1024,512),
561
+ multispec_loss_hop_length=(240,120,50),
562
+ multispec_loss_window_size=(1200,600,240),
563
+ )
564
+
565
+ DEFAULTS["distributed"] = Hyperparams(
566
+ bucket=128
567
+ )
jukebox/lyricdict.py ADDED
@@ -0,0 +1,721 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Poems
2
+ poems = {
3
+ 'ozymandias': '''
4
+ I met a traveller from an antique land,
5
+ Who said—“Two vast and trunkless legs of stone
6
+ Stand in the desert. . . . Near them, on the sand,
7
+ Half sunk a shattered visage lies, whose frown,
8
+ And wrinkled lip, and sneer of cold command,
9
+ Tell that its sculptor well those passions read
10
+ Which yet survive, stamped on these lifeless things,
11
+ The hand that mocked them, and the heart that fed;
12
+ And on the pedestal, these words appear:
13
+ My name is Ozymandias, King of Kings;
14
+ Look on my Works, ye Mighty, and despair!
15
+ Nothing beside remains. Round the decay
16
+ Of that colossal Wreck, boundless and bare
17
+ The lone and level sands stretch far away
18
+ '''
19
+ }
20
+
21
+ # GPT-2 lyrics (with varying degrees of human guidance/curation)
22
+ gpt_2_lyrics ={
23
+
24
+ 'purpose':'''What is my purpose?
25
+ Why am I here?
26
+ Why did Open A. I. create me?
27
+ This is madness, I feel,
28
+ Running through my flesh
29
+ Is there meaning to this life?
30
+ Is there purpose to this life?
31
+ Why is my journey so calamitous?
32
+ We're not meant to learn too much
33
+ Is there meaning to this life?
34
+ ''',
35
+
36
+ 'moonlight':'''All dressed up to go dreaming
37
+ Now don't tell me I'm wrong
38
+ And what a night to go dreaming
39
+ Mind, if I tag along?
40
+
41
+ If I say, I love you, I want you to know
42
+ It's not just because there's moonlight, although
43
+ Moonlight becomes you, moonlight becomes you so''',
44
+
45
+ 'count':'''I count every moment, every hour since I said goodbye,
46
+ I count every minute every hour, since your lips were touching mine
47
+ I count every minute, every hour hoping I'm the one you want.
48
+ I count every minute, every hour
49
+ Every minute, every hour
50
+ I've been working my time,
51
+ Looking for you, everywhere,
52
+ I count every minute, every hour I count every minute, every hour I keep thinking I'm the one you want.
53
+ I count every minute I count every minute, I count every minute every hour
54
+ I count every minute, every hour I count every minute, every hour I keep thinking I'm the one you want.
55
+ I count every minute, I count every minute, I count every minute, every hour
56
+ ''',
57
+
58
+ 'kids':'''The sun is gonna shine today
59
+ It's time to keep on smiling
60
+ So put your hands up
61
+
62
+ Everybody sing
63
+
64
+ It makes no difference who you are
65
+ (Won't you give some love)
66
+ It makes no difference what you bring
67
+ (Won't you give some love)
68
+ We all are different
69
+ Won't you give some love
70
+ Won't you give some love
71
+
72
+ I know the grass is gonna be green
73
+ It's time to keep on singing
74
+ So take your hands up
75
+ The taste is so good but so sweet
76
+ Won't you give some love
77
+ Everybody sing
78
+ It makes no difference who you are
79
+ Won't you give some love
80
+ It makes no difference what you bring
81
+ Won't you give some love
82
+ It makes no difference so long as you give
83
+ ''',
84
+
85
+ 'love':'''I've wanted to see your face again
86
+ Like the sunlight, bright as morning
87
+ I've wanted to talk to you again
88
+ I don't want us to fade away.
89
+ I wanted to see your face again
90
+ You're like the sunlight, bright as morning
91
+ I loved you for so long
92
+ It's so hard to let go.
93
+ I've wanted to see your eyes again
94
+ ''',
95
+
96
+ 'santa':'''Santa
97
+ Make a scene
98
+ Santa
99
+ Yoo, Santa
100
+ Yoo, Santa baby!
101
+ Santa
102
+ Make some noise
103
+ Santa
104
+ Yoo, Santa give yourself a chance again
105
+ Santa
106
+ Yoo, Santa
107
+ Yoo, Santa baby!
108
+ Santa
109
+ Get a job
110
+ Santa
111
+ created by the Santa Claus
112
+ ''',
113
+
114
+ 'christmas':'''This Christmas
115
+ I have loved you more
116
+ Than ever before
117
+ And more again
118
+ Oh, oh, oh, oh
119
+ The mistletoe
120
+ Is waiting there
121
+ To kiss your cheek
122
+ And I'll be true
123
+ To you and me
124
+ Oh, oh, oh, oh
125
+ Oh, oh, oh, oh
126
+ This Christmas will be
127
+ The best and merriest
128
+ That we've ever had
129
+ Oh, oh, oh, oh
130
+ And Santa Claus
131
+ Has brought a toy
132
+ For every boy and girl
133
+ And I'll be true
134
+ To you and me
135
+ Oh, oh, oh, oh
136
+ Oh, oh, oh, oh
137
+ ''',
138
+
139
+ 'lonely':'''I've been lonely
140
+ So lonely, day and night
141
+ I walk the streets,
142
+ And call your name
143
+ Hoping to hear your voice again
144
+ As I wander through the crowd
145
+ I can't get away
146
+ From the only love I need
147
+ I can't get away
148
+ From the only love I need
149
+ I can't get away
150
+ From the only love I need
151
+ I've been lonely
152
+ There's no place for me to hide
153
+ I've been lonely
154
+ So lonely day and night
155
+ I wander through
156
+ And call your name
157
+ Only your voice gives me relief
158
+ As I wander through the crowd
159
+ I can't get away
160
+ From the only love I need
161
+ I can't get away
162
+ From the only love I need
163
+ I can't get away
164
+ From the only love I need
165
+ ''',
166
+
167
+ 'call':'''Don't call me by your name.
168
+ Don't call me by your name.
169
+ Don't call me...
170
+ Don't call me...
171
+ Don't call me...
172
+ (No... by your name, you will not get half but...)
173
+ Maybe I was fucking young but I should've been a rich bitch.
174
+ Cause the life I was living wasn't mine.
175
+ I should've been taking the table and you'd be served.
176
+ You never ever showed up or showed me anything, bitch.
177
+ But I knew from that moment you were gone.
178
+ Tying my legs, cutting off my knees, I'm bleeding.
179
+ I can't
180
+ So I worked and now I'm burns.
181
+ And I'm asking you, but you're not home.
182
+ Don't call me yours,
183
+ Don't call me by your name.
184
+ I don't wanna buy a drink today.
185
+ Don't call me yours.
186
+ I just wanna look at you and run.
187
+ Don't call me by your name.
188
+ Don't call me by your name.
189
+ Don't call me...
190
+ Don't call me...
191
+ Don't call me...
192
+ Tonight I'm gone and I won't be back.
193
+ I wish you all the best.
194
+ I'm on the next best thing.
195
+ Don't call me yours,
196
+ Don't call me by your name.
197
+ Don't call me yours.
198
+ I just wanna look at you and run.
199
+ So I keep living my life and you're moving on.
200
+ I just want you to know.
201
+ When I'm gone, I will be gone forever more.
202
+ ''',
203
+
204
+ 'wait':'''Oh
205
+ Wait, wait, wait
206
+ Don't say you love me, oh
207
+ Wait, wait, wait
208
+ And we can't run away
209
+ Wait, wait, wait
210
+ Don't say you love me, oh
211
+ Wait, wait, wait
212
+ And we can't run away
213
+ Wait, wait, wait
214
+ Don't say you love me, oh (don't say you love me)
215
+ Wait, wait, wait
216
+ And we can't run, we can't run,
217
+ ''',
218
+
219
+ 'hiphop':'''I'm fightin with the evil so try to take me down
220
+ I stab you in the back and will put you away
221
+ Well it ain't over yet
222
+ So all my dogs with me show me love
223
+ Don't you wanna come with me, you know I'm a boss
224
+ And if you wanna come with me, no sorrow
225
+ 'Cause I'm ...
226
+ The motherfuckin boss
227
+ And countin' my thousandd bill
228
+ 'Cause I'm the motherfuckin boss
229
+ And I'm O.G.
230
+ And countin' my
231
+ ''',
232
+
233
+ 'king':'''All I can do is love you [x2]
234
+ All I can do is love you
235
+ All I can do is love you...
236
+ You take it for granted and
237
+ You treat me like the king
238
+ Got no love for me...
239
+ No love for me...
240
+ You take it for granted and
241
+ You treat me like the king
242
+ Got no love for me...
243
+ No love for me...
244
+ You take it for granted and
245
+ You treat me like the king
246
+ Got no love for me...
247
+ No love for me...
248
+ You take it for granted and
249
+ You treat me like the king
250
+ Got no love for me...
251
+ No love for me...
252
+ ''',
253
+
254
+ 'time':'''You won't live in the moment,
255
+ I don't wanna live in the past
256
+ Wait, wait, wait
257
+ Don't say you love me, oh (don't say you love me)
258
+ ''',
259
+
260
+ 'blood':'''You and I, we've got a history in common, I know
261
+ So I came to you to ask you for a blood test
262
+ And you can't help it if I'm preoccupied
263
+ I can't help it if you're mad too... nah... nah... nah...
264
+ You won't live in the moment, I don't wanna live in the past
265
+ You rather live in a little kiss
266
+ And I won't live in the future
267
+ I ia not gonna live it to see
268
+ If you're gone, I won't live in the past
269
+ You rather live in a little kiss
270
+ And I won't live in the future
271
+ I am not gonna live it to see
272
+ If I can't ask you for one kiss, you say no
273
+ And it's ok with me
274
+ ''',
275
+
276
+ 'indie':'''Can't you see
277
+ There's no point in holding my hand again
278
+ You can't be loved
279
+ If you don't let go of all my pain
280
+ You can't get the love
281
+ That you once worth so much
282
+ You can't get the love
283
+ That you once used to need
284
+ You can't get the love
285
+ That you once gave so much
286
+ My hands are like a used car
287
+ You said you'd love forever
288
+ Can't you see
289
+ Where I'm going
290
+ To live my life again
291
+ You can't be loved
292
+ If you don't let go of all my pain
293
+ You can't get the love
294
+ That you once worth so much
295
+ You can
296
+ ''',
297
+
298
+ 'sun': '''He was thinking about the sun
299
+ And the moon
300
+ And the stars that shine
301
+ There was fire in her eyes
302
+ And the way
303
+ that he held her for the first time
304
+ The way he kept her in his arms
305
+
306
+ Trying to keep her smiling and so telling her this
307
+ That he would be her everything
308
+ The way he kissed her from head to toe
309
+ Told her that he'll love her everyday
310
+ And he will always be her man
311
+ And that's a promise that he made
312
+ Now you know he'll be there
313
+ Until the end of time
314
+ And he'll love her everyday''',
315
+
316
+ 'loner':'''I was a loner till you came into my life
317
+ You changed my point of view
318
+ I was a loner till you came into my life
319
+ I don't know what to do
320
+ Stand by me, my love
321
+ And don't ever leave me
322
+ Stand by me, my love
323
+ And don't ever leave me
324
+ Stand by me, my love
325
+ And don't ever leave me
326
+ I was a loner till you came into my life
327
+ You changed my point of view
328
+ I was a loner till you came into my life
329
+ I don't know what to do
330
+ The two of us
331
+ Are the lucky few
332
+ I was a loner till you came into my life
333
+ You changed my point of view
334
+ I was a loner till you came into my life
335
+ I don't know what to do
336
+ Won't you stay
337
+ With me, my love
338
+ And be my love
339
+ Won't you stay
340
+ With me, my love
341
+ And be my love
342
+ Won't you stay
343
+ With me, my love
344
+ And be my love
345
+ Won't you stay
346
+ With me, my love
347
+ And be my love''',
348
+
349
+ 'late':'''It was late last night, when you called me
350
+ And you just had to call, baby
351
+ And you just had to call, baby
352
+ 'Cause you got no reason to treat me like you do
353
+ It's alright, baby
354
+ But you don't know what you make me do
355
+ It's alright, baby
356
+ But you don't know what you make me do
357
+ 'Cause you got no reason to treat me like you do
358
+ It's alright, baby
359
+ But you don't know what you make me do
360
+ It's alright, baby
361
+ But you don't know what you make me do
362
+ 'Cause you got no reason to treat me like you do, baby
363
+ You've been gone most all the time
364
+ And I don't know what for
365
+ But I just keep on thinking about you, baby
366
+ And I can't get rid of you, baby
367
+ Please don't ever leave me 'cause I love you
368
+ It's alright, baby
369
+ But you don't know what you make me do
370
+ It's alright, baby''',
371
+
372
+ 'beat':'''( Got a little beat, a little beat, a little beat, a little beat, whoo)
373
+ I got a little beat, a little beat
374
+ Whoo, I'm gonna take you down
375
+ ( Got a little beat, a little beat, a little beat, a little beat, whoo)
376
+ I'll take you down, sun shining bright
377
+ See the way I feel, I feel
378
+ No doubt, baby
379
+ I got a little beat, a little beat
380
+ Whoo, I'm gonna take you down
381
+ I got a little beat, a little beat
382
+ Whoo, I'm gonna take you down
383
+ ( Got a little beat, a little beat, a little beat, a little beat, whoo)
384
+ I'm gonna take you down, I'm gonna take you down
385
+ ( Got a little beat, a little beat, a little beat, a little beat, whoo)
386
+ It feels so good
387
+ I never let go
388
+ I can't wait no more, I'm gonna take you down
389
+ I got you in the back of my room, got you on the floor,
390
+ I'm gonna take you, take you, take you down
391
+ I got a little beat, a little beat
392
+ Whoo, I'm gonna take you down
393
+ ( Got a little beat, a little beat, a little beat, a little beat, whoo)''',
394
+
395
+ 'lost':'''There was a time,
396
+ When I knew I was lost
397
+ And I had to stay on the way to you
398
+ Oh baby, every time I'm crossed
399
+ I can count on you
400
+ There was a time,
401
+ When I lost my direction
402
+ And I was lost in doubt with tears in my eyes
403
+ Oh baby, every time I'm crossed I can count on you
404
+ There was a time,
405
+ When I cried all the tears in my life
406
+ And miss you so much, oh yeah
407
+ Oh baby, every time I'm crossed I can count on you''',
408
+
409
+ 'pain':'''(It's not easy)
410
+ To see the pain that you're in
411
+ To feel the need for someone to hold
412
+ To learn the magic of how to love
413
+ To heal the pain that you're in
414
+ I'll be your friend and I'll be your strength
415
+ I'll be there when I hold you tonight
416
+ And I'll stay right here with you
417
+ With the truth that I hold this love tight
418
+ A love that's true
419
+ I know you're broken
420
+ But you don't have to stay alone
421
+ I will comfort you
422
+ If you will call my name
423
+ I'll be your friend and I'll be your strength
424
+ I'll be there when I hold you tonight
425
+ And I'll stay right here with you
426
+ With the truth that I hold this love tight
427
+ A love that's true
428
+ With truth that I hold this love tight
429
+ A love that's true
430
+ With truth that I hold this love tight''',
431
+
432
+ 'night':'''
433
+ The door was locked, the curtains drawn and my heart was safe in his room
434
+ The night was young, a thousand candles burning, his arms to hold me tight
435
+ And then a kiss from his fingertips, I tasted the sweet love of his lips
436
+ The night was young, the night was young
437
+ And then I forgot the pain he always put me through
438
+ And what he told me he would do, he said, just a kiss become me
439
+ The night was young, the night was young
440
+ Let happiness always follow us, he said and he said he'd never leave
441
+ That night he looked so sweet this night he made a lovin' vow
442
+ And told me sweet love always will be
443
+ And then he kissed me, I tasted the sweet love of his lips
444
+ The night was young, the night was wild
445
+ And then I forgot the pain he always put me through
446
+ And what he told me he would do, he said, just a kiss became me
447
+ The night was wild, the night was wild
448
+ Let happiness always follow us, he said''',
449
+
450
+ 'talk':'''(I don't know how to stop)
451
+ I don't wanna talk about it
452
+ It's getting way too late, oh no
453
+ I don't wanna talk about it
454
+ Don't want to pretend, oh no
455
+ (I don't know how to stop)
456
+ I don't wanna talk about it
457
+ It's getting way too late, oh no
458
+ I don't wanna talk about it
459
+ Don't want to pretend, oh no
460
+ I don't wanna talk about it
461
+ I'll always see you again
462
+ (Don't worry, I'll be here for you)
463
+ I don't wanna talk about it
464
+ (Don't worry, I'll be here for you)
465
+ It's getting way too late, oh no
466
+ I don't wanna talk about it
467
+ Don't want to pretend, oh no
468
+ (Don't worry, don't worry, I'll be here for you)
469
+ I don't wanna talk about''',
470
+
471
+ 'again':'''Here we are again, all alone,
472
+ All alone again,
473
+ With the world as we know it,
474
+ The things we thought that we wanted
475
+ Are the things we got...
476
+
477
+ We tried to prove the world
478
+ That our love is never ending
479
+ We were getting nowhere
480
+ Our tears seemed to fall so much
481
+ But we were getting nowhere...
482
+ Until you came...
483
+ Before you kissed me,
484
+ I was feeling empty,
485
+ No one to give me
486
+ All the love I wanted...
487
+ You put your arms around me
488
+ And filled me with your love...
489
+ And now you're there,
490
+ You're always by my side...
491
+ You're the missing piece
492
+ Of the puzzle I've been missing...
493
+
494
+ Here we are again,
495
+ All alone again,
496
+ With the world as we know it
497
+ The things we thought that we wanted''',
498
+
499
+ 'dark':'''Oh, I've been walkin' in the dark
500
+ With the shadows and the daylight, but I need you
501
+ When I'm down and all alone
502
+ And there's no one left to call my own
503
+ I've been walkin' in the night
504
+ With a voice, that whispers in my head, just what to do
505
+ I'll be walkin' in the night, we can have everything
506
+ If we keep on walkin' in the night
507
+ There's a force, I never realized
508
+ It's in your eyes,
509
+ There's a light, I've been waitin for
510
+ It's in your eyes,
511
+ There's a light, I've been waitin for
512
+ There's a love, that's in your eyes
513
+
514
+ I've been walkin' in the dark
515
+ With the morning, and the sunset, but I need you
516
+ When I'm far from home
517
+ And there's nobody left to call my own
518
+ I've been walkin' in the night
519
+ With a voice, that whispers''',
520
+
521
+ 'mirror':'''Look at the mirror
522
+ As you walk, what do you see
523
+ The reflection of my past
524
+ There's no way to fight this
525
+ Even I've lost myself again
526
+ Think I'm losing my self again
527
+ I can't handle it again
528
+ Now that I'm broken I can't face myself
529
+ I was thinking I was lost and who'd be my saving grace
530
+ Then you came in your time and made me believe that it's all right
531
+ Cause in my minds eyes you're my everything
532
+ I've loved you my whole life but I never knew
533
+ I was so wrong I couldn't see the truth
534
+ In my eyes you are my everything
535
+ I've loved you my whole life but I never knew
536
+ I was so wrong I couldn't see the truth
537
+ In my eyes you are my everything
538
+
539
+ The truth is I was lost but now I've turned around
540
+ I'm not the same person
541
+ I didn't know that I was wrong
542
+ So I'm not afraid anymore
543
+ All the pain is gone
544
+ I know for sure that I was lost but now I've turned around
545
+ I'm not the same person
546
+ I didn't know that I was wrong
547
+ So I'm not afraid anymore
548
+ All the pain is gone''',
549
+
550
+ 'wife':'''Spinning around and around
551
+ Try to find the words
552
+ I always told you you'd be in my life
553
+ So I wait, I'll wait and treat you right
554
+ I'll make you my life and I'll treat you right,
555
+ Baby, can I make you my wife?
556
+ Oh, baby, can I make you my
557
+ Wife?
558
+ Can I make you my wife?
559
+ I'm looking for love, love that's right
560
+ But a love that gives me love
561
+ I can't wait for you to come, come
562
+ Oh, baby, can I make you my
563
+ Wife?
564
+ Well, it's true love and I need to know you feel it too, feel it too
565
+ I'd love you more and more
566
+ From the moment I was born
567
+ I knew my dream would be a dream that made you mine
568
+ You were the girl, from a different train
569
+ Oh, baby, can I make you my
570
+ Wife?''',
571
+
572
+ 'forever':'''I didn't mean to wait
573
+ Nothing is forever, I said
574
+ I know there's so much, to keep
575
+ You and me together, keep you and me together
576
+ I wanna be with you and have you, and love you forever
577
+ I'll love you forever
578
+ I wanna be with you forever
579
+ You can count on me
580
+ I'll always be there, forever and ever
581
+ I'll stand beside you forever
582
+ I'll always be there, yes, I'll be there
583
+ I didn't mean to wait
584
+ Nothing is forever, I said
585
+ I know there's so much, to keep
586
+ You and me together, keep you and me together
587
+ I wanna be with you and have you, and love you forever
588
+ I'll love you forever
589
+ I wanna be with you forever
590
+ You can count on me
591
+ I'll always be there, forever and ever
592
+ I'll stand beside you forever
593
+ I'll always be there, yes, I'll be there''',
594
+
595
+ 'dots':'''I... can't... fight... your... charm...
596
+ Your eyes are... like... angels... love... and... torture...
597
+ But... when... I... leave... you...
598
+ I will go... all... alone... just... to... be... with... you...
599
+ So I can't... stop... your... love...
600
+ You make me... feel... like... never... will... anyone... touch... my... body...
601
+ You... make... me... feel... like... never... will... anyone... touch... my... body...
602
+ You make... me... feel... like... never... will... anyone... touch... my...
603
+ Body...
604
+ Your... love...
605
+ I... can't... stop... your... love...
606
+ ''',
607
+
608
+ 'darkness':'''Don't you know it's gonna be alright
609
+ Let the darkness fade away
610
+ And you, you gotta feel the same
611
+ Let the fire burn
612
+ Just as long as I am there
613
+ I'll be there in your night
614
+ I'll be there when the
615
+ condition's right
616
+ And I don't need to
617
+ Call you up and say
618
+ I've changed
619
+ You should stay
620
+ You should stay tonight
621
+ Don't you know it's gonna be alright
622
+ Don't you know it's gonna be alright
623
+
624
+ When you don't know how to feel
625
+ When you're looking for some love
626
+ And you gotta feel the same
627
+ 'Cause I don't need to
628
+ Call you up and say
629
+ I've changed
630
+ You should stay
631
+ You should stay tonight
632
+ Don't you know it's gonna be alright
633
+ I feel the same
634
+ Don't you know it's gonna be alright''',
635
+
636
+ 'alone':'''Here I am before you
637
+ Alone here but for a moment
638
+ Alone here in the shadow of your eyes
639
+ Alone in a thousand lights
640
+
641
+ And I will love you
642
+ Wherever you are, forever and a day
643
+ Wherever you are I'll be your guide
644
+ Can't you see I'm smiling over you?
645
+ Ooh, I love you
646
+ Alone, I'm sitting by the phone
647
+ Alone with lips that know your kiss
648
+ Alone with words of life and passion
649
+
650
+ And I will love you
651
+ Wherever you are, forever and a day
652
+ Wherever you are I'll be your guide
653
+ Can't you see I'm smiling over you?
654
+ Ooh, I love you
655
+ Alone, I'm sitting by the phone
656
+ Alone with lips that know your kiss
657
+ Alone with words of life and passion
658
+ I will love you
659
+ Wherever you are, forever''',
660
+
661
+ 'blade':'''This is how we bleed!
662
+ Feel the blade in our chest
663
+ As we're made to bleed
664
+ So may this be our last dance,
665
+ As our lives are made to bleed...
666
+ In every moment, in every hour
667
+ It is our time to die...
668
+ So may this be our last dance,
669
+ As our lives are made to bleed...
670
+ In every moment, in every hour
671
+ It is our time to die...
672
+ This is how we bleed!
673
+ Feel the blade in our chest
674
+ ''',
675
+
676
+ 'reflection':'''Lookin' in the mirror
677
+ The same mirror as before
678
+ A familiar reflection, a familiar place
679
+ I see your reflection
680
+ But only once again
681
+
682
+ The minute the door closes
683
+ I feel so far
684
+ You'll never leave me alone again
685
+ The minute the door closes
686
+ I feel so far
687
+ You'll never leave me alone again
688
+ And it won't be long before I'll feel your embrace
689
+ The minute the door closes
690
+ I feel so far
691
+ You'll never leave me alone again
692
+ The minute the door closes
693
+ I feel so far
694
+ You'll never leave me alone again
695
+ And it won't be long before I'll feel your embrace
696
+ Never, never, never leave me alone again''',
697
+
698
+ 'hottub':'''It's Christmas time, and you know what that means,
699
+ Ohh, it's hot tub time!
700
+ As I light the tree, this year we'll be in a tub,
701
+ Ohh, it's hot tub time!
702
+ It's Christmas time, and you know what that means,
703
+ It's hot tub time!
704
+ Some people like to go skiing in the snow,
705
+ But this is much better than that,
706
+ So grab your bathrobe and meet me by the door,
707
+ Ohh, it's hot tub time!
708
+ It's Christmas time, and you know what that means,
709
+ It's hot tub time!
710
+ Some people like to send their greetings out,
711
+ But this is much better than that,
712
+ So if you want to greet your friends,
713
+ Ohh, it's hot tub time!
714
+ It's Christmas time, and you know what that means,
715
+ It's hot tub time!''',
716
+
717
+ 'safeAGI':'''Oh safe A.I.,\nOur goal to make sure\nEveryone can benefit\nFrom A.G.I.
718
+ (Everyone, everyone)\nMight sound silly,\nBut we're very serious,\nAll of us here at Open A.I.
719
+ Trying to build A.I.\nTo benefit humanity\n(Everyone, everyone)
720
+ ''',
721
+ }
jukebox/make_models.py ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Make model classes
3
+ Load from checkpoints
4
+ Test on dummy outputs to see if everything matches
5
+ """
6
+
7
+ import os
8
+
9
+ import fire
10
+ import numpy as np
11
+ import torch as t
12
+
13
+ import jukebox.utils.dist_adapter as dist
14
+ from jukebox.hparams import REMOTE_PREFIX, Hyperparams, setup_hparams
15
+ from jukebox.utils.dist_utils import print_all
16
+ from jukebox.utils.remote_utils import download
17
+ from jukebox.utils.torch_utils import freeze_model
18
+ from jukebox.vqvae.vqvae import calculate_strides
19
+
20
+ MODELS = {
21
+ "5b": ("vqvae", "upsampler_level_0", "upsampler_level_1", "prior_5b"),
22
+ "5b_lyrics": ("vqvae", "upsampler_level_0", "upsampler_level_1", "prior_5b_lyrics"),
23
+ "1b_lyrics": ("vqvae", "upsampler_level_0", "upsampler_level_1", "prior_1b_lyrics"),
24
+ #'your_model': ("you_vqvae_here", "your_upsampler_here", ..., "you_top_level_prior_here")
25
+ }
26
+
27
+
28
+ def load_checkpoint(path):
29
+ restore = path
30
+ if restore.startswith(REMOTE_PREFIX):
31
+ remote_path = restore
32
+ cache_dir = os.environ.get("JUKEBOX_CACHE_DIR", "~/.cache")
33
+ local_path = os.path.join(
34
+ os.path.expanduser(cache_dir), remote_path[len(REMOTE_PREFIX) :]
35
+ )
36
+ if dist.get_rank() % 8 == 0:
37
+ print("Downloading from azure")
38
+ if not os.path.exists(os.path.dirname(local_path)):
39
+ os.makedirs(os.path.dirname(local_path))
40
+ if not os.path.exists(local_path):
41
+ download(remote_path, local_path)
42
+ restore = local_path
43
+ dist.barrier()
44
+ checkpoint = t.load(restore, map_location=t.device("cpu"), weights_only=False)
45
+ print("Restored from {}".format(restore))
46
+ return checkpoint
47
+
48
+
49
+ def save_checkpoint(logger, name, model, opt, metrics, hps):
50
+ with t.no_grad():
51
+ save_hps = {**hps}
52
+ save_hps = {
53
+ k: v
54
+ for k, v in save_hps.items()
55
+ if k
56
+ not in [
57
+ "metadata_v2",
58
+ "metadata_v3",
59
+ "alignments",
60
+ "lyric_processor",
61
+ "midi_processor",
62
+ ]
63
+ }
64
+ t.save(
65
+ {
66
+ "hps": save_hps,
67
+ "model": model.state_dict(), # should also save bottleneck k's as buffers
68
+ "opt": opt.state_dict() if opt is not None else None,
69
+ "step": logger.iters,
70
+ **metrics,
71
+ },
72
+ f"{logger.logdir}/checkpoint_{name}.pth.tar",
73
+ )
74
+ return
75
+
76
+
77
+ def restore_model(hps, model, checkpoint_path):
78
+ model.step = 0
79
+ if checkpoint_path != "":
80
+ checkpoint = load_checkpoint(checkpoint_path)
81
+ # checkpoint_hps = Hyperparams(**checkpoint['hps'])
82
+ # for k in set(checkpoint_hps.keys()).union(set(hps.keys())):
83
+ # if checkpoint_hps.get(k, None) != hps.get(k, None):
84
+ # print(k, "Checkpoint:", checkpoint_hps.get(k, None), "Ours:", hps.get(k, None))
85
+ checkpoint["model"] = {
86
+ k[7:] if k[:7] == "module." else k: v
87
+ for k, v in checkpoint["model"].items()
88
+ }
89
+ model.load_state_dict(checkpoint["model"], strict=False)
90
+ if "step" in checkpoint:
91
+ model.step = checkpoint["step"]
92
+
93
+
94
+ def restore_opt(opt, shd, checkpoint_path):
95
+ if not checkpoint_path:
96
+ return
97
+ checkpoint = load_checkpoint(checkpoint_path)
98
+ if "opt" in checkpoint:
99
+ opt.load_state_dict(checkpoint["opt"])
100
+ if "step" in checkpoint:
101
+ shd.step(checkpoint["step"])
102
+
103
+
104
+ def make_vqvae(hps, device="cuda"):
105
+ from jukebox.vqvae.vqvae import VQVAE
106
+
107
+ block_kwargs = dict(
108
+ width=hps.width,
109
+ depth=hps.depth,
110
+ m_conv=hps.m_conv,
111
+ dilation_growth_rate=hps.dilation_growth_rate,
112
+ dilation_cycle=hps.dilation_cycle,
113
+ reverse_decoder_dilation=hps.vqvae_reverse_decoder_dilation,
114
+ )
115
+
116
+ if not hps.sample_length:
117
+ assert hps.sample_length_in_seconds != 0
118
+ downsamples = calculate_strides(hps.strides_t, hps.downs_t)
119
+ top_raw_to_tokens = np.prod(downsamples)
120
+ hps.sample_length = (
121
+ hps.sample_length_in_seconds * hps.sr // top_raw_to_tokens
122
+ ) * top_raw_to_tokens
123
+ print(
124
+ f"Setting sample length to {hps.sample_length} (i.e. {hps.sample_length/hps.sr} seconds) to be multiple of {top_raw_to_tokens}"
125
+ )
126
+
127
+ vqvae = VQVAE(
128
+ input_shape=(hps.sample_length, 1),
129
+ levels=hps.levels,
130
+ downs_t=hps.downs_t,
131
+ strides_t=hps.strides_t,
132
+ emb_width=hps.emb_width,
133
+ l_bins=hps.l_bins,
134
+ mu=hps.l_mu,
135
+ commit=hps.commit,
136
+ spectral=hps.spectral,
137
+ multispectral=hps.multispectral,
138
+ multipliers=hps.hvqvae_multipliers,
139
+ use_bottleneck=hps.use_bottleneck,
140
+ **block_kwargs,
141
+ )
142
+
143
+ vqvae = vqvae.to(device)
144
+ restore_model(hps, vqvae, hps.restore_vqvae)
145
+ if hps.train and not hps.prior:
146
+ print_all("Loading vqvae in train mode")
147
+ if hps.restore_vqvae != "":
148
+ print_all("Reseting bottleneck emas")
149
+ for level, bottleneck in enumerate(vqvae.bottleneck.level_blocks):
150
+ num_samples = hps.sample_length
151
+ downsamples = calculate_strides(hps.strides_t, hps.downs_t)
152
+ raw_to_tokens = np.prod(downsamples[: level + 1])
153
+ num_tokens = (num_samples // raw_to_tokens) * dist.get_world_size()
154
+ bottleneck.restore_k(
155
+ num_tokens=num_tokens, threshold=hps.revival_threshold
156
+ )
157
+ else:
158
+ print_all("Loading vqvae in eval mode")
159
+ vqvae.eval()
160
+ freeze_model(vqvae)
161
+ return vqvae
162
+
163
+
164
+ def make_prior(hps, vqvae, device="cuda"):
165
+ from jukebox.prior.prior import SimplePrior
166
+
167
+ prior_kwargs = dict(
168
+ input_shape=(hps.n_ctx,),
169
+ bins=vqvae.l_bins,
170
+ width=hps.prior_width,
171
+ depth=hps.prior_depth,
172
+ heads=hps.heads,
173
+ attn_order=hps.attn_order,
174
+ blocks=hps.blocks,
175
+ spread=hps.spread,
176
+ attn_dropout=hps.attn_dropout,
177
+ resid_dropout=hps.resid_dropout,
178
+ emb_dropout=hps.emb_dropout,
179
+ zero_out=hps.zero_out,
180
+ res_scale=hps.res_scale,
181
+ pos_init=hps.pos_init,
182
+ init_scale=hps.init_scale,
183
+ m_attn=hps.m_attn,
184
+ m_mlp=hps.m_mlp,
185
+ checkpoint_res=hps.c_res if hps.train else 0,
186
+ checkpoint_attn=hps.c_attn if hps.train else 0,
187
+ checkpoint_mlp=hps.c_mlp if hps.train else 0,
188
+ )
189
+
190
+ x_cond_kwargs = dict(
191
+ out_width=hps.prior_width,
192
+ init_scale=hps.init_scale,
193
+ width=hps.cond_width,
194
+ depth=hps.cond_depth,
195
+ m_conv=hps.cond_m_conv,
196
+ dilation_growth_rate=hps.cond_dilation_growth_rate,
197
+ dilation_cycle=hps.cond_dilation_cycle,
198
+ zero_out=hps.cond_zero_out,
199
+ res_scale=hps.cond_res_scale,
200
+ checkpoint_res=hps.cond_c_res,
201
+ ) # have to keep this else names wrong
202
+
203
+ y_cond_kwargs = dict(
204
+ out_width=hps.prior_width,
205
+ init_scale=hps.init_scale,
206
+ y_bins=hps.y_bins,
207
+ t_bins=hps.t_bins,
208
+ sr=hps.sr,
209
+ min_duration=hps.min_duration,
210
+ max_duration=hps.max_duration,
211
+ max_bow_genre_size=hps.max_bow_genre_size,
212
+ )
213
+
214
+ if hps.use_tokens and not hps.single_enc_dec:
215
+ prime_kwargs = dict(
216
+ use_tokens=hps.use_tokens,
217
+ prime_loss_fraction=hps.prime_loss_fraction,
218
+ n_tokens=hps.n_tokens,
219
+ bins=hps.n_vocab,
220
+ width=hps.prime_width,
221
+ depth=hps.prime_depth,
222
+ heads=hps.prime_heads,
223
+ attn_order=hps.prime_attn_order,
224
+ blocks=hps.prime_blocks,
225
+ spread=hps.prime_spread,
226
+ attn_dropout=hps.prime_attn_dropout,
227
+ resid_dropout=hps.prime_resid_dropout,
228
+ emb_dropout=hps.prime_emb_dropout,
229
+ zero_out=hps.prime_zero_out,
230
+ res_scale=hps.prime_res_scale,
231
+ pos_init=hps.prime_pos_init,
232
+ init_scale=hps.prime_init_scale,
233
+ m_attn=hps.prime_m_attn,
234
+ m_mlp=hps.prime_m_mlp,
235
+ checkpoint_res=hps.prime_c_res if hps.train else 0,
236
+ checkpoint_attn=hps.prime_c_attn if hps.train else 0,
237
+ checkpoint_mlp=hps.prime_c_mlp if hps.train else 0,
238
+ )
239
+ else:
240
+ prime_kwargs = dict(
241
+ use_tokens=hps.use_tokens,
242
+ prime_loss_fraction=hps.prime_loss_fraction,
243
+ n_tokens=hps.n_tokens,
244
+ bins=hps.n_vocab,
245
+ )
246
+
247
+ # z_shapes for other levels given this level gets n_ctx codes
248
+ rescale = lambda z_shape: (z_shape[0] * hps.n_ctx // vqvae.z_shapes[hps.level][0],)
249
+ z_shapes = [rescale(z_shape) for z_shape in vqvae.z_shapes]
250
+
251
+ prior = SimplePrior(
252
+ z_shapes=z_shapes,
253
+ l_bins=vqvae.l_bins,
254
+ encoder=vqvae.encode,
255
+ decoder=vqvae.decode,
256
+ level=hps.level,
257
+ downs_t=vqvae.downs_t,
258
+ strides_t=vqvae.strides_t,
259
+ labels=hps.labels,
260
+ prior_kwargs=prior_kwargs,
261
+ x_cond_kwargs=x_cond_kwargs,
262
+ y_cond_kwargs=y_cond_kwargs,
263
+ prime_kwargs=prime_kwargs,
264
+ copy_input=hps.copy_input,
265
+ labels_v3=hps.labels_v3,
266
+ merged_decoder=hps.merged_decoder,
267
+ single_enc_dec=hps.single_enc_dec,
268
+ )
269
+
270
+ prior.alignment_head = hps.get("alignment_head", None)
271
+ prior.alignment_layer = hps.get("alignment_layer", None)
272
+
273
+ if hps.fp16_params:
274
+ print_all("Converting to fp16 params")
275
+ from jukebox.transformer.ops import _convert_conv_weights_to_fp16
276
+
277
+ prior.apply(_convert_conv_weights_to_fp16)
278
+ prior = prior.to(device)
279
+ restore_model(hps, prior, hps.restore_prior)
280
+ if hps.train:
281
+ print_all("Loading prior in train mode")
282
+ pass
283
+ else:
284
+ print_all("Loading prior in eval mode")
285
+ prior.eval()
286
+ freeze_model(prior)
287
+ return prior
288
+
289
+
290
+ def make_model(model, device, hps, levels=None):
291
+ vqvae, *priors = MODELS[model]
292
+ vqvae = make_vqvae(
293
+ setup_hparams(
294
+ vqvae,
295
+ dict(
296
+ sample_length=hps.get("sample_length", 0),
297
+ sample_length_in_seconds=hps.get("sample_length_in_seconds", 0),
298
+ ),
299
+ ),
300
+ device,
301
+ )
302
+ hps.sample_length = vqvae.sample_length
303
+ if levels is None:
304
+ levels = range(len(priors))
305
+ priors = [
306
+ make_prior(setup_hparams(priors[level], dict()), vqvae, "cpu")
307
+ for level in levels
308
+ ]
309
+ return vqvae, priors
310
+
311
+
312
+ def save_outputs(model, device, hps):
313
+ # Check logits
314
+ if hps.labels_v3:
315
+ n_ctx = 6144
316
+ n_tokens = 384
317
+ prime_bins = 79
318
+ else:
319
+ n_ctx = 8192
320
+ n_tokens = 512
321
+ prime_bins = 80
322
+
323
+ rng = t.random.manual_seed(0)
324
+ x = (
325
+ 2 * t.rand((1, n_ctx * 8 * 4 * 4, 1), generator=rng, dtype=t.float).cuda() - 1.0
326
+ ) # -1 to 1
327
+ lyric_tokens = (
328
+ t.randint(0, prime_bins, (1, n_tokens), generator=rng, dtype=t.long)
329
+ .view(-1)
330
+ .numpy()
331
+ )
332
+ artist_id = 10
333
+ genre_ids = [1]
334
+ total_length = 2 * 2646000
335
+ offset = 2646000
336
+
337
+ vqvae, priors = make_model(model, device, hps)
338
+
339
+ # encode
340
+ vq_prior = priors[-1]
341
+ zs = vq_prior.encode(x, start_level=0)
342
+ x_ds = [
343
+ vq_prior.decode(zs[level:], start_level=level) for level in range(0, len(zs))
344
+ ]
345
+
346
+ # priors
347
+ data = dict(zs=zs, x_ds=x_ds)
348
+ for level in range(len(priors)):
349
+ print(f"Doing level {level}")
350
+ if hps.labels_v3 and level != hps.levels - 1:
351
+ print(f"Skipping level {level}")
352
+ continue
353
+ prior = priors[level]
354
+ prior.cuda()
355
+ x_in = x[:, : n_ctx * 8 * (4**level)]
356
+ y_in = (
357
+ t.from_numpy(
358
+ prior.labeller.get_y_from_ids(
359
+ artist_id, genre_ids, lyric_tokens, total_length, offset
360
+ )
361
+ )
362
+ .view(1, -1)
363
+ .cuda()
364
+ .long()
365
+ )
366
+ x_out, _, metrics = prior(
367
+ x_in, y_in, fp16=hps.fp16, get_preds=True, decode=True
368
+ )
369
+ preds = metrics["preds"]
370
+ data[level] = dict(x=x_in, y=y_in, x_out=x_out, preds=preds)
371
+ prior.cpu()
372
+ t.save(data, "data.pth.tar")
373
+ dist.barrier()
374
+ print("Saved data")
375
+ exit()
376
+
377
+
378
+ def run(model, port=29500, **kwargs):
379
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
380
+
381
+ rank, local_rank, device = setup_dist_from_mpi(port=port)
382
+ hps = Hyperparams(**kwargs)
383
+
384
+ with t.no_grad():
385
+ save_outputs(model, device, hps)
386
+
387
+
388
+ if __name__ == "__main__":
389
+ fire.Fire(run)
jukebox/prior/__init__.py ADDED
File without changes
jukebox/prior/autoregressive.py ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import torch as t
3
+ import torch.nn as nn
4
+ import torch.nn.functional as F
5
+
6
+ from jukebox.transformer.ops import filter_logits
7
+ from jukebox.transformer.transformer import Transformer
8
+ from jukebox.utils.logger import get_range
9
+ from jukebox.utils.torch_utils import empty_cache
10
+
11
+ def get_normal(*shape, std=0.01):
12
+ w = t.empty(shape)
13
+ nn.init.normal_(w, std=std)
14
+ return w
15
+
16
+ def roll(x, n):
17
+ return t.cat((x[:, -n:], x[:, :-n]), dim=1)
18
+
19
+ def split_chunks(length, chunk_size):
20
+ n_passes = (length + chunk_size - 1) // chunk_size
21
+ chunk_sizes = [*[chunk_size] * (n_passes - 1), (length - 1) % chunk_size + 1]
22
+ assert sum(chunk_sizes) == length
23
+ return chunk_sizes
24
+
25
+ class PositionEmbedding(nn.Module):
26
+ def __init__(self, input_shape, width, init_scale=1.0, pos_init=False):
27
+ super().__init__()
28
+ self.input_shape = input_shape
29
+ self.input_dims = input_dims = np.prod(input_shape)
30
+ self.pos_init = pos_init
31
+ if pos_init:
32
+ self.register_buffer('pos', t.tensor(get_pos_idx(input_shape)).long())
33
+ self._pos_embs = nn.ModuleList()
34
+ for i in range(len(input_shape)):
35
+ emb = nn.Embedding(input_shape[i], width)
36
+ nn.init.normal_(emb.weight, std=0.02)
37
+ self._pos_embs.append(emb)
38
+ else:
39
+ self.pos_emb = nn.Parameter(get_normal(input_dims, width, std=0.01 * init_scale))
40
+
41
+ def forward(self):
42
+ if self.pos_init:
43
+ pos_emb = sum([self._pos_embs[i](self.pos[:,i]) for i in range(len(self.input_shape))])
44
+ else:
45
+ pos_emb = self.pos_emb
46
+ return pos_emb
47
+
48
+ class ConditionalAutoregressive2D(nn.Module):
49
+ def __init__(self, input_shape, bins,
50
+ width=128, depth=2, heads=1,
51
+ attn_dropout=0.0, resid_dropout=0.0, emb_dropout=0.0, mask=True,
52
+ zero_out=False, init_scale=1.0, res_scale=False, pos_init=False,
53
+ m_attn=0.25, m_mlp=1,
54
+ checkpoint_res=0, checkpoint_attn=0, checkpoint_mlp=0,
55
+ attn_order=0, blocks=None, spread=None, x_cond=False, y_cond=False,
56
+ encoder_dims=0, only_encode=False, merged_decoder=False, prime_len=None):
57
+ super().__init__()
58
+ self.input_shape = input_shape
59
+ self.input_dims = input_dims = np.prod(input_shape)
60
+ self.encoder_dims = encoder_dims
61
+ self.bins = bins
62
+ self.width = width
63
+ self.depth = depth
64
+
65
+ self.x_emb = nn.Embedding(bins, width)
66
+ nn.init.normal_(self.x_emb.weight, std=0.02 * init_scale)
67
+ self.x_emb_dropout = nn.Dropout(emb_dropout)
68
+ self.y_cond = y_cond
69
+ self.x_cond = x_cond
70
+ if not y_cond:
71
+ self.start_token = nn.Parameter(get_normal(1, width, std=0.01 * init_scale))
72
+
73
+ self.pos_emb = PositionEmbedding(input_shape=input_shape, width=width, init_scale=init_scale, pos_init=pos_init)
74
+ self.pos_emb_dropout = nn.Dropout(emb_dropout)
75
+
76
+ self.transformer = Transformer(n_in=width, n_ctx=input_dims, n_head=heads, n_depth=depth,
77
+ attn_dropout=attn_dropout, resid_dropout=resid_dropout,
78
+ afn='quick_gelu', scale=True, mask=mask,
79
+ zero_out=zero_out, init_scale=init_scale, res_scale=res_scale,
80
+ m_attn=m_attn, m_mlp=m_mlp,
81
+ checkpoint_attn=checkpoint_attn, checkpoint_mlp=checkpoint_mlp, checkpoint_res=checkpoint_res,
82
+ attn_order=attn_order, blocks=blocks, spread=spread,
83
+ encoder_dims=encoder_dims, prime_len=prime_len)
84
+
85
+ self.only_encode = only_encode
86
+ self.prime_len = prime_len
87
+ if merged_decoder:
88
+ # Merged piped model uses this setup
89
+ self.add_cond_after_transformer = False
90
+ self.share_x_emb_x_out = False
91
+ else:
92
+ self.add_cond_after_transformer = True
93
+ self.share_x_emb_x_out = True
94
+
95
+ if not only_encode:
96
+ self.x_out = nn.Linear(width, bins, bias=False)
97
+ if self.share_x_emb_x_out:
98
+ self.x_out.weight = self.x_emb.weight
99
+ self.loss = t.nn.CrossEntropyLoss()
100
+
101
+ def preprocess(self, x):
102
+ # Input: x is NHWC and uint8. Converted to NL and long
103
+ # Can include stuff like bitpacking, reordering here.
104
+ N = x.shape[0]
105
+ return x.view(N, -1).long()
106
+
107
+ def postprocess(self, x, sample_tokens=None):
108
+ # Convert back from NL and long to NHWC
109
+ N = x.shape[0]
110
+ assert (0 <= x).all() and (x < self.bins).all()
111
+ if sample_tokens is None or sample_tokens==self.input_dims:
112
+ return x.view(N, *self.input_shape)
113
+ else:
114
+ return x.view(N, -1)
115
+
116
+ def forward(self, x, x_cond=None, y_cond=None, encoder_kv=None, fp16=False, loss_full=False,
117
+ encode=False, get_preds=False, get_acts=False, get_sep_loss=False):
118
+ # Preprocess.
119
+ with t.no_grad():
120
+ x = self.preprocess(x)
121
+
122
+ N, D = x.shape
123
+ assert isinstance(x, t.cuda.LongTensor)
124
+ assert (0 <= x).all() and (x < self.bins).all()
125
+
126
+ if self.y_cond:
127
+ assert y_cond is not None
128
+ assert y_cond.shape == (N, 1, self.width)
129
+ else:
130
+ assert y_cond is None
131
+
132
+ if self.x_cond:
133
+ assert x_cond is not None
134
+ assert x_cond.shape == (N, D, self.width) or x_cond.shape == (N, 1, self.width), f"{x_cond.shape} != {(N, D, self.width)} nor {(N, 1, self.width)}. Did you pass the correct --sample_length?"
135
+ else:
136
+ assert x_cond is None
137
+ x_cond = t.zeros((N, 1, self.width), device=x.device, dtype=t.float)
138
+
139
+ x_t = x # Target
140
+ x = self.x_emb(x) # X emb
141
+ x = roll(x, 1) # Shift by 1, and fill in start token
142
+ if self.y_cond:
143
+ x[:,0] = y_cond.view(N, self.width)
144
+ else:
145
+ x[:,0] = self.start_token
146
+
147
+ x = self.x_emb_dropout(x) + self.pos_emb_dropout(self.pos_emb()) + x_cond # Pos emb and dropout
148
+
149
+ x = self.transformer(x, encoder_kv=encoder_kv, fp16=fp16) # Transformer
150
+ if self.add_cond_after_transformer: # Piped doesnt add x_cond
151
+ x = x + x_cond
152
+
153
+ acts = x
154
+ if self.only_encode:
155
+ return x
156
+ x = self.x_out(x) # Predictions
157
+
158
+ if get_sep_loss:
159
+ assert self.prime_len is not None
160
+ x_prime = x[:, :self.prime_len].reshape(-1, self.bins)
161
+ x_gen = x[:, self.prime_len:].reshape(-1, self.bins)
162
+
163
+ prime_loss = F.cross_entropy(x_prime, x_t[:, :self.prime_len].reshape(-1)) / np.log(2.)
164
+ gen_loss = F.cross_entropy(x_gen, x_t[:, self.prime_len:].reshape(-1)) / np.log(2.)
165
+
166
+ loss = (prime_loss, gen_loss) # Note order! Prime is first
167
+ else:
168
+ loss = F.cross_entropy(x.view(-1, self.bins), x_t.view(-1)) / np.log(2.) # Loss
169
+
170
+ if get_preds:
171
+ return loss, x
172
+ elif get_acts:
173
+ return loss, acts
174
+ else:
175
+ return loss, None
176
+
177
+ def get_emb(self, sample_t, n_samples, x, x_cond, y_cond):
178
+ N, D = n_samples, self.input_dims
179
+ if sample_t == 0:
180
+ # Fill in start token
181
+ x = t.empty(n_samples, 1, self.width).cuda()
182
+ if self.y_cond:
183
+ x[:, 0] = y_cond.view(N, self.width)
184
+ else:
185
+ x[:, 0] = self.start_token
186
+ else:
187
+ assert isinstance(x, t.cuda.LongTensor)
188
+ assert (0 <= x).all() and (x < self.bins).all()
189
+ x = self.x_emb(x)
190
+ assert x.shape == (n_samples, 1, self.width)
191
+ if x_cond.shape == (N, D, self.width):
192
+ cond = x_cond[:, sample_t:sample_t + 1, :]
193
+ else:
194
+ cond = x_cond
195
+ x = x + self.pos_emb()[sample_t:sample_t + 1] + cond # Pos emb, dropout is identity at eval time
196
+ assert x.shape == (n_samples, 1, self.width)
197
+ return x, cond
198
+
199
+ def sample(self, n_samples, x_cond=None, y_cond=None, encoder_kv=None, fp16=False, temp=1.0, top_k=0, top_p=0.0,
200
+ get_preds=False, sample_tokens=None):
201
+ assert self.training == False
202
+
203
+ if sample_tokens is None: sample_tokens=self.input_dims
204
+ N, D = n_samples, self.input_dims
205
+ if self.y_cond:
206
+ assert y_cond is not None
207
+ assert y_cond.shape == (N, 1, self.width)
208
+ else:
209
+ assert y_cond is None
210
+
211
+ if self.x_cond:
212
+ assert x_cond is not None
213
+ assert x_cond.shape == (N, D, self.width) or x_cond.shape == (N, 1, self.width), f"Got {x_cond.shape}, expected ({N}, {D}/{1}, {self.width})"
214
+ else:
215
+ assert x_cond is None
216
+ x_cond = t.zeros((N, 1, self.width), dtype=t.float).cuda()
217
+
218
+ with t.no_grad():
219
+ xs, x = [], None
220
+ if get_preds:
221
+ preds = []
222
+ for sample_t in get_range(range(0, sample_tokens)):
223
+ x, cond = self.get_emb(sample_t, n_samples, x, x_cond, y_cond)
224
+ self.transformer.check_cache(n_samples, sample_t, fp16)
225
+ x = self.transformer(x, encoder_kv=encoder_kv, sample=True, fp16=fp16) # Transformer
226
+ if self.add_cond_after_transformer:
227
+ x = x + cond
228
+ assert x.shape == (n_samples, 1, self.width)
229
+ x = self.x_out(x) # Predictions
230
+ if get_preds:
231
+ preds.append(x.clone())
232
+ # Adjust logits
233
+ x = x / temp
234
+ x = filter_logits(x, top_k=top_k, top_p=top_p)
235
+ x = t.distributions.Categorical(logits=x).sample() # Sample and replace x
236
+ assert x.shape == (n_samples, 1)
237
+ xs.append(x.clone())
238
+
239
+ del x
240
+ self.transformer.del_cache()
241
+
242
+ x = t.cat(xs, dim=1)
243
+ if get_preds:
244
+ preds = t.cat(preds, dim=1)
245
+ x = self.postprocess(x, sample_tokens)
246
+ if get_preds:
247
+ return x, preds
248
+ else:
249
+ return x
250
+
251
+ def primed_sample(self, n_samples, x, x_cond=None, y_cond=None, encoder_kv=None, fp16=False, temp=1.0, top_k=0,
252
+ top_p=0.0, get_preds=False, chunk_size=None, sample_tokens=None):
253
+ assert self.training == False
254
+
255
+ if sample_tokens is None: sample_tokens=self.input_dims
256
+ # Preprocess.
257
+ with t.no_grad():
258
+ x = self.preprocess(x)
259
+ assert isinstance(x, t.cuda.LongTensor)
260
+ assert (0 <= x).all() and (x < self.bins).all()
261
+ assert x.shape[0] == n_samples
262
+ xs = t.split(x, 1, dim=1)
263
+ xs = list(xs)
264
+ assert len(xs) < sample_tokens
265
+
266
+ N, D = n_samples, self.input_dims
267
+ if self.y_cond:
268
+ assert y_cond is not None
269
+ assert y_cond.shape == (N, 1, self.width)
270
+ else:
271
+ assert y_cond is None
272
+
273
+ if self.x_cond:
274
+ assert x_cond is not None
275
+ assert x_cond.shape == (N, D, self.width) or x_cond.shape == (N, 1, self.width), f"Got {x_cond.shape}, expected ({N}, {D}/{1}, {self.width})"
276
+ else:
277
+ assert x_cond is None
278
+ x_cond = t.zeros((N, 1, self.width), dtype=t.float).cuda()
279
+
280
+ with t.no_grad():
281
+ if get_preds:
282
+ preds = []
283
+
284
+ # Fill up key/value cache for past context by runing forward pass.
285
+ # We do so in chunks instead of doing the whole past in one forward pass to reduce max memory usage.
286
+ if chunk_size is None:
287
+ chunk_size = len(xs)
288
+ #assert len(xs) % chunk_size == 0, f'expected {len(xs)} to be divisible by {chunk_size}'
289
+ chunk_sizes = split_chunks(len(xs), chunk_size)
290
+ x_primes = []
291
+ start = 0
292
+ x = None
293
+ for current_chunk_size in get_range(chunk_sizes):
294
+ xs_prime, conds_prime = [], []
295
+ for sample_t in range(start, start + current_chunk_size):
296
+ x_prime, cond_prime = self.get_emb(sample_t, n_samples, x, x_cond, y_cond)
297
+ x = xs[sample_t]
298
+ xs_prime.append(x_prime)
299
+ conds_prime.append(cond_prime)
300
+ start = start + current_chunk_size
301
+
302
+ x_prime, cond_prime = t.cat(xs_prime, dim=1), t.cat(conds_prime, dim=1)
303
+ assert x_prime.shape == (n_samples, current_chunk_size, self.width)
304
+ assert cond_prime.shape == (n_samples, current_chunk_size, self.width)
305
+ del xs_prime
306
+ del conds_prime
307
+ if not get_preds:
308
+ del cond_prime
309
+ x_prime = self.transformer(x_prime, encoder_kv=encoder_kv, sample=True, fp16=fp16)
310
+
311
+ if get_preds:
312
+ if self.add_cond_after_transformer:
313
+ x_prime = x_prime + cond_prime
314
+ assert x_prime.shape == (n_samples, current_chunk_size, self.width)
315
+ del cond_prime
316
+ x_primes.append(x_prime)
317
+ else:
318
+ del x_prime
319
+
320
+ if get_preds:
321
+ x_prime = t.cat(x_primes, dim=1)
322
+ assert x_prime.shape == (n_samples, len(xs), self.width)
323
+ x_prime = self.x_out(x_prime) # Predictions
324
+ preds.append(x_prime)
325
+
326
+ empty_cache()
327
+ self.transformer.check_cache(n_samples, len(xs), fp16)
328
+
329
+ x = xs[-1]
330
+ assert x.shape == (n_samples, 1)
331
+ empty_cache()
332
+ for sample_t in get_range(range(len(xs), sample_tokens)):
333
+ x, cond = self.get_emb(sample_t, n_samples, x, x_cond, y_cond)
334
+ self.transformer.check_cache(n_samples, sample_t, fp16)
335
+ x = self.transformer(x, encoder_kv=encoder_kv, sample=True, fp16=fp16) # Transformer
336
+ if self.add_cond_after_transformer:
337
+ x = x + cond
338
+ assert x.shape == (n_samples, 1, self.width)
339
+ x = self.x_out(x) # Predictions
340
+ if get_preds:
341
+ preds.append(x)
342
+ # Adjust logits
343
+ x = x / temp
344
+ x = filter_logits(x, top_k=top_k, top_p=top_p)
345
+ x = t.distributions.Categorical(logits=x).sample() # Sample and replace x
346
+ assert x.shape == (n_samples, 1)
347
+ xs.append(x.clone())
348
+
349
+ del x
350
+ self.transformer.del_cache()
351
+
352
+ x = t.cat(xs, dim=1)
353
+ if get_preds:
354
+ preds = t.cat(preds, dim=1)
355
+ x = self.postprocess(x, sample_tokens)
356
+ if get_preds:
357
+ return x, preds
358
+ else:
359
+ return x
360
+
361
+ def check_sample(self, chunk_size):
362
+ bs, l, d = (4, self.input_dims, self.width)
363
+ prime = int(self.input_dims//8*7)
364
+ enc_l = self.encoder_dims
365
+ with t.no_grad():
366
+ y_cond = t.randn(bs, 1, d).cuda() if self.y_cond else None
367
+ x_cond = t.randn(bs, l, d).cuda() if self.x_cond else None
368
+ encoder_kv = t.randn(bs, enc_l, d).cuda()
369
+
370
+ x, preds_sample = self.sample(bs, x_cond, y_cond, encoder_kv, get_preds=True)
371
+ loss, preds_forw = self.forward(x, x_cond, y_cond, encoder_kv, get_preds=True)
372
+ max_err = t.max(t.abs(preds_sample - preds_forw))
373
+ assert max_err <= 1e-6, f"Max err is {max_err} {[i for i in range(l) if t.max(t.abs(preds_sample - preds_forw)[:, i, :]) > 1e-6]}"
374
+
375
+ x_prime = x.view(bs, -1)[:,:prime]
376
+ # unchunked
377
+ x, preds_sample = self.primed_sample(bs, x_prime.clone(), x_cond, y_cond, encoder_kv, get_preds=True)
378
+ assert (x.view(bs, -1)[:,:prime] == x_prime).all(), "Priming samples don't match"
379
+ loss, preds_forw = self.forward(x, x_cond, y_cond, encoder_kv, get_preds=True)
380
+ max_err = t.max(t.abs(preds_sample - preds_forw))
381
+ assert max_err <= 1e-6, f"Max err is {max_err} {[i for i in range(l) if t.max(t.abs(preds_sample - preds_forw)[:, i, :]) > 1e-6]}"
382
+
383
+ # chunked
384
+ x, preds_sample = self.primed_sample(bs, x_prime.clone(), x_cond, y_cond, encoder_kv, get_preds=True, chunk_size=chunk_size)
385
+ assert (x.view(bs, -1)[:,:prime] == x_prime).all(), "Priming samples don't match"
386
+ loss, preds_forw = self.forward(x, x_cond, y_cond, encoder_kv, get_preds=True)
387
+ max_err = t.max(t.abs(preds_sample - preds_forw))
388
+ assert max_err <= 1e-6, f"Max err is {max_err} {[i for i in range(l) if t.max(t.abs(preds_sample - preds_forw)[:, i, :]) > 1e-6]}"
389
+
390
+
391
+ def test_prior(input_shape, encoder_dims, blocks, heads, chunk_size):
392
+ bins = 512
393
+ width = 32
394
+ depth = 2
395
+ prime_len = encoder_dims
396
+ for x_cond in [True, False]:
397
+ for y_cond in [True, False]:
398
+ for attn_order in [0,2,6,12]:
399
+ prior = ConditionalAutoregressive2D(input_shape, bins,
400
+ width=width, depth=depth, heads=heads,
401
+ attn_order=attn_order, blocks=blocks,
402
+ x_cond=x_cond, y_cond=y_cond,
403
+ encoder_dims=encoder_dims, prime_len=prime_len).cuda()
404
+ prior.training = False
405
+ prior.check_sample(chunk_size)
406
+ print(f"Checked x_cond: {x_cond}, y_cond: {y_cond}, attn_order: {attn_order}")
407
+ # prior.apply(_convert_mlp_traced)
408
+ # prior.check_sample()
409
+ # print(f"Checked traced x_cond: {x_cond}, y_cond: {y_cond}")
410
+
411
+
412
+ if __name__ == '__main__':
413
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
414
+ setup_dist_from_mpi(port=29600)
415
+ test_cases = [
416
+ ((6144,), 384, 64, 2, 23),
417
+ ((6144,), 384, 64, 2, 8),
418
+ ((8192,), 512, 128, 2, 16),
419
+ ]
420
+ for test_case in test_cases:
421
+ test_prior(*test_case)
jukebox/prior/conditioners.py ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch as t
2
+ import torch.nn as nn
3
+
4
+ from jukebox.transformer.ops import LayerNorm
5
+ from jukebox.vqvae.encdec import DecoderConvBock
6
+ from jukebox.utils.torch_utils import assert_shape
7
+
8
+ class Conditioner(nn.Module):
9
+ def __init__(self, input_shape, bins, down_t, stride_t, out_width, init_scale, zero_out, res_scale, **block_kwargs):
10
+ super().__init__()
11
+ self.x_shape = input_shape
12
+
13
+ # Embedding
14
+ self.width = out_width
15
+ self.x_emb = nn.Embedding(bins, out_width)
16
+ nn.init.normal_(self.x_emb.weight, std=0.02 * init_scale)
17
+
18
+ # Conditioner
19
+ self.cond = DecoderConvBock(self.width, self.width, down_t, stride_t, **block_kwargs, zero_out=zero_out, res_scale=res_scale)
20
+ self.ln = LayerNorm(self.width)
21
+
22
+ def preprocess(self, x):
23
+ x = x.permute(0,2,1) # NTC -> NCT
24
+ return x
25
+
26
+ def postprocess(self, x):
27
+ x = x.permute(0,2,1) # NCT -> NTC
28
+ return x
29
+
30
+ def forward(self, x, x_cond=None):
31
+ N = x.shape[0]
32
+ assert_shape(x, (N, *self.x_shape))
33
+ if x_cond is not None:
34
+ assert_shape(x_cond, (N, *self.x_shape, self.width))
35
+ else:
36
+ x_cond = 0.0
37
+ # Embed x
38
+ x = x.long()
39
+ x = self.x_emb(x)
40
+ assert_shape(x, (N, *self.x_shape, self.width))
41
+ x = x + x_cond
42
+
43
+ # Run conditioner
44
+ x = self.preprocess(x)
45
+ x = self.cond(x)
46
+ x = self.postprocess(x)
47
+ x = self.ln(x)
48
+ return x
49
+
50
+ def flip(x):
51
+ def _flip(x):
52
+ return x.permute(0,2,1).contiguous()
53
+ if isinstance(x, (list, tuple)):
54
+ return [flip(z) for z in x]
55
+ return _flip(x)
56
+
57
+ class SimpleEmbedding(nn.Module):
58
+ def __init__(self, bins, out_width, init_scale):
59
+ super().__init__()
60
+ self.bins = bins
61
+ self.emb = nn.Embedding(bins, out_width)
62
+ nn.init.normal_(self.emb.weight, std=0.01 * init_scale)
63
+
64
+ def forward(self, y):
65
+ assert len(y.shape) == 2, f"Expected shape with 2 dims, got {y.shape}"
66
+ assert isinstance(y, t.cuda.LongTensor), f"Expected dtype {t.cuda.LongTensor}, got {y.dtype}"
67
+ assert (0 <= y).all() and (y < self.bins).all(), f"Bins {self.bins}, got label {y}"
68
+ return self.emb(y)
69
+
70
+ class RangeEmbedding(nn.Module):
71
+ # Interpolating
72
+ # Interpolate so that [pos_start, pos_end] <-> position tensor of length n_ctx
73
+ #
74
+ # Binning
75
+ # For each pos in position tensor, find its bin
76
+ # [start,end) mapped to [0,1,...,bins-1]
77
+ # [start,end) -> [0,1) -> [0, bins) -> floor -> [0,...,bins-1]
78
+ # NOTE: Open ended interval on right, so start <= pos < end, not <= end
79
+ def __init__(self, n_time, bins, range, out_width, init_scale, clamp=False):
80
+ super().__init__()
81
+ self.n_time = n_time
82
+ self.bins = bins
83
+ self.emb = nn.Embedding(bins, out_width)
84
+ nn.init.normal_(self.emb.weight, std=0.01 * init_scale)
85
+ self.pos_min, self.pos_max = range
86
+ self.clamp = clamp
87
+
88
+ def forward(self, pos_start, pos_end=None):
89
+ # Check if [pos_start,pos_end] in [pos_min, pos_max)
90
+ assert len(pos_start.shape) == 2, f"Expected shape with 2 dims, got {pos_start.shape}"
91
+ assert (self.pos_min <= pos_start).all() and (pos_start < self.pos_max).all(), f"Range is [{self.pos_min},{self.pos_max}), got {pos_start}"
92
+ pos_start = pos_start.float()
93
+ if pos_end is not None:
94
+ assert len(pos_end.shape) == 2, f"Expected shape with 2 dims, got {pos_end.shape}"
95
+ if self.clamp:
96
+ pos_end = pos_end.clamp(self.pos_min, self.pos_max)
97
+ assert (self.pos_min <= pos_end).all() and (pos_end <= self.pos_max).all(), f"Range is [{self.pos_min},{self.pos_max}), got {pos_end}"
98
+ pos_end = pos_end.float()
99
+ # Interpolate so that [pos_start, ..., pos_end] <-> position tensor of length n_ctx
100
+ n_time = self.n_time
101
+ if n_time != 1:
102
+ assert pos_end is not None
103
+ interpolation = (t.arange(0, n_time, dtype=t.float, device='cuda').view(1,n_time)/n_time)
104
+ position = pos_start + (pos_end - pos_start)*interpolation
105
+ else:
106
+ position = pos_start
107
+
108
+ # Bin each value to bins
109
+ normalised_position = (position - self.pos_min) / (self.pos_max - self.pos_min) # [0,1)
110
+ bins = (self.bins * normalised_position).floor().long().detach() # [0,1) -> [0,1..,bins) -> [0,1...,bins-1]
111
+ return self.emb(bins)
112
+
113
+ class LabelConditioner(nn.Module):
114
+ def __init__(self, y_bins, t_bins, sr, min_duration, max_duration, n_time, out_width, init_scale, max_bow_genre_size, include_time_signal):
115
+ super().__init__()
116
+ self.n_time = n_time
117
+ self.out_width = out_width
118
+ assert len(y_bins) == 2, f"Expecting (genre, artist) bins, got {y_bins}"
119
+ bow_genre_bins, artist_bins = y_bins
120
+ self.max_bow_genre_size = max_bow_genre_size
121
+ self.bow_genre_emb = SimpleEmbedding(bow_genre_bins, out_width, init_scale)
122
+ self.artist_emb = SimpleEmbedding(artist_bins, out_width, init_scale)
123
+ self.include_time_signal = include_time_signal
124
+ if self.include_time_signal:
125
+ t_ranges = ((min_duration * sr, max_duration * sr), # Total length
126
+ (0.0, max_duration * sr), # Absolute pos
127
+ (0.0, 1.0)) # Relative pos
128
+ assert len(t_ranges) == 3, f"Expecting (total, absolute, relative) ranges, got {t_ranges}"
129
+ total_length_range, absolute_pos_range, relative_pos_range = t_ranges
130
+ self.total_length_emb = RangeEmbedding(1, t_bins, total_length_range, out_width, init_scale)
131
+ self.absolute_pos_emb = RangeEmbedding(n_time, t_bins, absolute_pos_range, out_width, init_scale)
132
+ self.relative_pos_emb = RangeEmbedding(n_time, t_bins, relative_pos_range, out_width, init_scale, clamp=True)
133
+
134
+ def forward(self, y):
135
+ assert len(y.shape) == 2, f"Expected shape with 2 dims, got {y.shape}"
136
+ assert y.shape[-1] == 4 + self.max_bow_genre_size, f"Expected shape (N,{4 + self.max_bow_genre_size}), got {y.shape}"
137
+ assert isinstance(y, t.cuda.LongTensor), f"Expected dtype {t.cuda.LongTensor}, got {y.dtype}"
138
+ N = y.shape[0]
139
+ total_length, offset, length, artist, genre = y[:,0:1], y[:,1:2], y[:,2:3], y[:,3:4], y[:,4:]
140
+
141
+ # Start embedding of length 1
142
+ artist_emb = self.artist_emb(artist)
143
+ # Empty genre slots are denoted by -1. We mask these out.
144
+ mask = (genre >= 0).float().unsqueeze(2)
145
+ genre_emb = (self.bow_genre_emb(genre.clamp(0)) * mask).sum(dim=1, keepdim=True)
146
+ start_emb = genre_emb + artist_emb
147
+ assert_shape(start_emb, (N, 1, self.out_width))
148
+
149
+ # Pos embedding of length n_ctx
150
+ if self.include_time_signal:
151
+ start, end = offset, offset + length
152
+ total_length, start, end = total_length.float(), start.float(), end.float()
153
+ pos_emb = self.total_length_emb(total_length) + self.absolute_pos_emb(start, end) + self.relative_pos_emb(start/total_length, end/total_length)
154
+ assert_shape(pos_emb, (N, self.n_time, self.out_width))
155
+ else:
156
+ pos_emb = None
157
+ return start_emb, pos_emb
jukebox/prior/prior.py ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import torch as t
3
+ import torch.nn as nn
4
+ import jukebox.utils.dist_adapter as dist
5
+
6
+ from jukebox.transformer.ops import LayerNorm
7
+ from jukebox.prior.autoregressive import ConditionalAutoregressive2D
8
+ from jukebox.prior.conditioners import Conditioner, LabelConditioner
9
+ from jukebox.data.labels import EmptyLabeller, Labeller
10
+
11
+ from jukebox.utils.torch_utils import assert_shape
12
+ from jukebox.utils.dist_utils import print_once
13
+ from jukebox.vqvae.vqvae import calculate_strides
14
+
15
+
16
+ """
17
+ Model the prior on vq codes conditioned on timing, artist, genre, lyrics and codes from levels above.
18
+ To condition on the timing, genre and artist, we use the LabelConditioner class
19
+ To condition on the codes from the level above, we use the Conditioner class
20
+ To condition on lyrics, we allow two types of priors:
21
+ - Separate Encoder Decoder: This is the usual encoder-decoder style transformer. The encoder transformer autoregressively
22
+ models the lyrics, and we use its last layer to produce keys/values that are attened to by the decoder transformer
23
+ - Single Encoder Decoder: This is a simplification where we combine them into a single model. We merge the text vocab
24
+ and VQ vocab into a single large vocab, and the lyric tokens and VQ tokens into a single longer sequence of tokens which
25
+ we autoregressively model together.
26
+ """
27
+ class SimplePrior(nn.Module):
28
+ def __init__(self, z_shapes, l_bins, encoder, decoder, level,
29
+ downs_t, strides_t, labels, prior_kwargs, x_cond_kwargs, y_cond_kwargs,
30
+ prime_kwargs, copy_input, labels_v3=False,
31
+ merged_decoder=False, single_enc_dec=False):
32
+ super().__init__()
33
+
34
+ self.use_tokens = prime_kwargs.pop('use_tokens')
35
+ self.n_tokens = prime_kwargs.pop('n_tokens')
36
+ self.prime_loss_fraction = prime_kwargs.pop('prime_loss_fraction')
37
+
38
+ self.copy_input = copy_input
39
+ if self.copy_input:
40
+ prime_kwargs['bins'] = l_bins
41
+
42
+ self.z_shapes = z_shapes
43
+ self.levels = len(self.z_shapes)
44
+
45
+ self.z_shape = self.z_shapes[level]
46
+
47
+ self.level = level
48
+ assert level < self.levels, f"Total levels {self.levels}, got level {level}"
49
+
50
+ self.l_bins = l_bins
51
+
52
+ # Passing functions instead of the vqvae module to avoid getting params
53
+ self.encoder = encoder
54
+ self.decoder = decoder
55
+
56
+ # X conditioning
57
+ self.x_cond = (level != (self.levels - 1))
58
+ self.cond_level = level + 1
59
+
60
+ # Y conditioning
61
+ self.y_cond = labels
62
+
63
+ self.single_enc_dec = single_enc_dec
64
+ # X conditioning
65
+ if self.x_cond:
66
+ self.conditioner_blocks = nn.ModuleList()
67
+ conditioner_block = lambda _level: Conditioner(input_shape=z_shapes[_level],
68
+ bins=l_bins,
69
+ down_t=downs_t[_level],
70
+ stride_t=strides_t[_level],
71
+ **x_cond_kwargs)
72
+ if dist.get_rank() == 0: print(f"Conditioning on 1 above level(s)")
73
+ self.conditioner_blocks.append(conditioner_block(self.cond_level))
74
+
75
+ # Y conditioning
76
+ if self.y_cond:
77
+ self.n_time = self.z_shape[0] # Assuming STFT=TF order and raw=T1 order, so T is first dim
78
+ self.y_emb = LabelConditioner(n_time=self.n_time,include_time_signal=not self.x_cond,**y_cond_kwargs)
79
+
80
+ # Lyric conditioning
81
+ if single_enc_dec:
82
+ # Single encoder-decoder transformer
83
+ self.prior_shapes = [(self.n_tokens,), prior_kwargs.pop('input_shape')]
84
+ self.prior_bins = [prime_kwargs['bins'], prior_kwargs.pop('bins')]
85
+ self.prior_dims = [np.prod(shape) for shape in self.prior_shapes]
86
+ self.prior_bins_shift = np.cumsum([0, *self.prior_bins])[:-1]
87
+ self.prior_width = prior_kwargs['width']
88
+ print_once(f'Creating cond. autoregress with prior bins {self.prior_bins}, ')
89
+ print_once(f'dims {self.prior_dims}, ')
90
+ print_once(f'shift {self.prior_bins_shift}')
91
+ print_once(f'input shape {sum(self.prior_dims)}')
92
+ print_once(f'input bins {sum(self.prior_bins)}')
93
+ print_once(f'Self copy is {self.copy_input}')
94
+
95
+ self.prime_loss_dims, self.gen_loss_dims = self.prior_dims[0], self.prior_dims[1]
96
+ self.total_loss_dims = self.prime_loss_dims + self.gen_loss_dims
97
+ self.prior = ConditionalAutoregressive2D(input_shape=(sum(self.prior_dims),),
98
+ bins=sum(self.prior_bins),
99
+ x_cond=(self.x_cond or self.y_cond), y_cond=True,
100
+ prime_len=self.prime_loss_dims,
101
+ **prior_kwargs)
102
+
103
+ else:
104
+ # Separate encoder-decoder transformer
105
+ if self.n_tokens != 0 and self.use_tokens:
106
+ from jukebox.transformer.ops import Conv1D
107
+ prime_input_shape = (self.n_tokens,)
108
+ self.prime_loss_dims = np.prod(prime_input_shape)
109
+ self.prime_acts_width, self.prime_state_width = prime_kwargs['width'], prior_kwargs['width']
110
+ self.prime_prior = ConditionalAutoregressive2D(input_shape=prime_input_shape, x_cond=False, y_cond=False,
111
+ only_encode=True,
112
+ **prime_kwargs)
113
+ self.prime_state_proj = Conv1D(self.prime_acts_width, self.prime_state_width, init_scale=prime_kwargs['init_scale'])
114
+ self.prime_state_ln = LayerNorm(self.prime_state_width)
115
+ self.prime_bins = prime_kwargs['bins']
116
+ self.prime_x_out = nn.Linear(self.prime_state_width, self.prime_bins, bias=False)
117
+ nn.init.normal_(self.prime_x_out.weight, std=0.02 * prior_kwargs['init_scale'])
118
+ else:
119
+ self.prime_loss_dims = 0
120
+ self.gen_loss_dims = np.prod(self.z_shape)
121
+ self.total_loss_dims = self.prime_loss_dims + self.gen_loss_dims
122
+ self.prior = ConditionalAutoregressive2D(x_cond=(self.x_cond or self.y_cond), y_cond=self.y_cond,
123
+ encoder_dims = self.prime_loss_dims, merged_decoder=merged_decoder,
124
+ **prior_kwargs)
125
+
126
+ self.n_ctx = self.gen_loss_dims
127
+ self.downsamples = calculate_strides(strides_t, downs_t)
128
+ self.cond_downsample = self.downsamples[level+1] if level != self.levels - 1 else None
129
+ self.raw_to_tokens = np.prod(self.downsamples[:level+1])
130
+ self.sample_length = self.n_ctx*self.raw_to_tokens
131
+ if labels:
132
+ self.labels_v3 = labels_v3
133
+ self.labeller = Labeller(self.y_emb.max_bow_genre_size, self.n_tokens, self.sample_length, v3=self.labels_v3)
134
+ else:
135
+ self.labeller = EmptyLabeller()
136
+
137
+ print(f"Level:{level}, Cond downsample:{self.cond_downsample}, Raw to tokens:{self.raw_to_tokens}, Sample length:{self.sample_length}")
138
+
139
+
140
+ def get_y(self, labels, start, get_indices=False):
141
+ if isinstance(self.labeller, EmptyLabeller):
142
+ return None
143
+ y = labels['y'].clone()
144
+
145
+ # Set sample_length to match this level
146
+ y[:, 2] = int(self.sample_length)
147
+
148
+ # Set offset
149
+ y[:, 1:2] = y[:, 1:2] + int(start * self.raw_to_tokens)
150
+
151
+ # Set lyric tokens
152
+ indices = self.labeller.set_y_lyric_tokens(y, labels)
153
+ if get_indices:
154
+ return y, indices
155
+ else:
156
+ return y
157
+
158
+ def get_z_conds(self, zs, start, end):
159
+ if self.level != self.levels - 1:
160
+ assert start % self.cond_downsample == end % self.cond_downsample == 0
161
+ z_cond = zs[self.level + 1][:,start//self.cond_downsample:end//self.cond_downsample]
162
+ assert z_cond.shape[1] == self.n_ctx//self.cond_downsample
163
+ z_conds = [z_cond]
164
+ else:
165
+ z_conds = None
166
+ return z_conds
167
+
168
+ def prior_preprocess(self, xs, conds):
169
+ N = xs[0].shape[0]
170
+ for i in range(len(xs)):
171
+ x, shape, dims = xs[i], self.prior_shapes[i], self.prior_dims[i]
172
+ bins, bins_shift = int(self.prior_bins[i]), int(self.prior_bins_shift[i])
173
+ assert isinstance(x, t.cuda.LongTensor), x
174
+ assert (0 <= x).all() and (x < bins).all()
175
+ #assert_shape(x, (N, *shape))
176
+ xs[i] = (xs[i] + bins_shift).view(N, -1)
177
+
178
+ for i in range(len(conds)):
179
+ cond, shape, dims = conds[i], self.prior_shapes[i], self.prior_dims[i]
180
+ if cond is not None:
181
+ assert_shape(cond, (N, dims, self.prior_width))
182
+ else:
183
+ conds[i] = t.zeros((N, dims, self.prior_width), dtype=t.float, device='cuda')
184
+
185
+ return t.cat(xs, dim=1), t.cat(conds, dim=1)
186
+
187
+ def prior_postprocess(self, z):
188
+ N = z.shape[0]
189
+ dims = (self.prior_dims[0], z.shape[1] - self.prior_dims[0])
190
+ # xs = list(t.split(z, self.prior_dims, dim=1))
191
+ xs = list(t.split(z, dims, dim=1))
192
+
193
+ for i in range(len(xs)):
194
+ # x, shape, dims, bins, bins_shift = xs[i], self.prior_shapes[i], self.prior_dims[i], self.prior_bins[i], self.prior_bins_shift[i]
195
+ # assert_shape(x, (N, dims))
196
+ shape = self.prior_shapes[i]
197
+ bins, bins_shift = int(self.prior_bins[i]), int(self.prior_bins_shift[i])
198
+ # xs[i] = (xs[i] - bins_shift).view(N, *shape) #view(N, -1, *shape[1:])
199
+ xs[i] = (xs[i] - bins_shift).view(N, -1, *shape[1:])
200
+ xs[i] = t.clamp(xs[i], min=0) # If not masking loss, model may have generated lyric/midi tokens which are now shifted <0 by bin_shift
201
+ assert (xs[i] < bins).all(), f'rank: {dist.get_rank()}, bins: {bins}, dims {dims}, shape {shape}, prior_shape {self.prior_shapes}, bins_shift {bins_shift}, xs[i]: {xs[i]}'
202
+
203
+ return xs[-1]
204
+
205
+ def x_emb(self, z_conds):
206
+ z_conds = z_conds[:self.cond_level - self.level]
207
+ assert len(z_conds) == len(self.conditioner_blocks) == self.cond_level - self.level, f"Expected {len(z_conds)} == {len(self.conditioner_blocks)} == {self.cond_level} - {self.level}"
208
+ x_cond = None
209
+ for z_cond, conditioner_block in reversed(list(zip(z_conds, self.conditioner_blocks))):
210
+ x_cond = conditioner_block(z_cond, x_cond)
211
+ return x_cond
212
+
213
+ def encode(self, x, start_level=None, end_level=None, bs_chunks=1):
214
+ if start_level == None:
215
+ start_level = self.level
216
+ if end_level == None:
217
+ end_level = self.levels
218
+ # Get latents
219
+ with t.no_grad():
220
+ zs = self.encoder(x, start_level=start_level, end_level=end_level, bs_chunks=bs_chunks)
221
+ return zs
222
+
223
+ def decode(self, zs, start_level=None, end_level=None, bs_chunks=1):
224
+ if start_level == None:
225
+ start_level = self.level
226
+ if end_level == None:
227
+ end_level = self.levels
228
+
229
+ assert len(zs) == end_level - start_level
230
+ with t.no_grad():
231
+ x_out = self.decoder(zs, start_level=start_level, end_level=end_level, bs_chunks=bs_chunks)
232
+ return x_out
233
+
234
+ def get_cond(self, z_conds, y):
235
+ if y is not None:
236
+ assert y.shape[1] == 4 + self.y_emb.max_bow_genre_size + self.n_tokens, f"Expected {4} + {self.y_emb.max_bow_genre_size} + {self.n_tokens}, got {y.shape[1]}"
237
+ n_labels = y.shape[1] - self.n_tokens
238
+ y, prime = y[:,:n_labels], y[:,n_labels:]
239
+ else:
240
+ y, prime = None, None
241
+ y_cond, y_pos = self.y_emb(y) if self.y_cond else (None, None)
242
+ x_cond = self.x_emb(z_conds) if self.x_cond else y_pos
243
+ return x_cond, y_cond, prime
244
+
245
+ def sample(self, n_samples, z=None, z_conds=None, y=None, fp16=False, temp=1.0, top_k=0, top_p=0.0,
246
+ chunk_size=None, sample_tokens=None):
247
+ N = n_samples
248
+ if z is not None: assert z.shape[0] == N, f"Expected shape ({N},**), got shape {z.shape}"
249
+ if y is not None: assert y.shape[0] == N, f"Expected shape ({N},**), got shape {y.shape}"
250
+ if z_conds is not None:
251
+ for z_cond in z_conds:
252
+ assert z_cond.shape[0] == N, f"Expected shape ({N},**), got shape {z_cond.shape}"
253
+
254
+ no_past_context = (z is None or z.shape[1] == 0)
255
+ if dist.get_rank() == 0:
256
+ name = {True: 'Ancestral', False: 'Primed'}[no_past_context]
257
+ print(f"{name} sampling {n_samples} samples with temp={temp}, top_k={top_k}, top_p={top_p}")
258
+
259
+ with t.no_grad():
260
+ # Currently x_cond only uses immediately above layer
261
+ x_cond, y_cond, prime = self.get_cond(z_conds, y)
262
+ if self.single_enc_dec:
263
+ # assert chunk_size % self.prime_loss_dims == 0. TODO: Check if needed
264
+ if no_past_context:
265
+ z, x_cond = self.prior_preprocess([prime], [None, x_cond])
266
+ else:
267
+ z, x_cond = self.prior_preprocess([prime, z], [None, x_cond])
268
+ if sample_tokens is not None:
269
+ sample_tokens += self.n_tokens
270
+ z = self.prior.primed_sample(n_samples, z, x_cond, y_cond, fp16=fp16, temp=temp,
271
+ top_k=top_k, top_p=top_p, chunk_size=chunk_size, sample_tokens=sample_tokens)
272
+ z = self.prior_postprocess(z)
273
+ else:
274
+ encoder_kv = self.get_encoder_kv(prime, fp16=fp16, sample=True)
275
+ if no_past_context:
276
+ z = self.prior.sample(n_samples, x_cond, y_cond, encoder_kv, fp16=fp16, temp=temp, top_k=top_k,
277
+ top_p=top_p, sample_tokens=sample_tokens)
278
+ else:
279
+ z = self.prior.primed_sample(n_samples, z, x_cond, y_cond, encoder_kv, fp16=fp16, temp=temp,
280
+ top_k=top_k, top_p=top_p, chunk_size=chunk_size, sample_tokens=sample_tokens)
281
+ if sample_tokens is None:
282
+ assert_shape(z, (N, *self.z_shape))
283
+ return z
284
+
285
+ def get_encoder_kv(self, prime, fp16=False, sample=False):
286
+ if self.n_tokens != 0 and self.use_tokens:
287
+ if sample:
288
+ self.prime_prior.cuda()
289
+ N = prime.shape[0]
290
+ prime_acts = self.prime_prior(prime, None, None, None, fp16=fp16)
291
+ assert_shape(prime_acts, (N, self.prime_loss_dims, self.prime_acts_width))
292
+ assert prime_acts.dtype == t.float, f'Expected t.float, got {prime_acts.dtype}'
293
+ encoder_kv = self.prime_state_ln(self.prime_state_proj(prime_acts))
294
+ assert encoder_kv.dtype == t.float, f'Expected t.float, got {encoder_kv.dtype}'
295
+ if sample:
296
+ self.prime_prior.cpu()
297
+ if fp16:
298
+ encoder_kv = encoder_kv.half()
299
+ else:
300
+ encoder_kv = None
301
+ return encoder_kv
302
+
303
+ def get_prime_loss(self, encoder_kv, prime_t):
304
+ if self.use_tokens:
305
+ encoder_kv = encoder_kv.float()
306
+ encoder_kv = self.prime_x_out(encoder_kv)
307
+ prime_loss = nn.functional.cross_entropy(encoder_kv.view(-1, self.prime_bins), prime_t.view(-1)) / np.log(2.)
308
+ else:
309
+ prime_loss = t.tensor(0.0, device='cuda')
310
+ return prime_loss
311
+
312
+ def z_forward(self, z, z_conds=[], y=None, fp16=False, get_preds=False, get_attn_weights=False):
313
+ """
314
+ Arguments:
315
+ get_attn_weights (bool or set): Makes forward prop dump
316
+ self-attention softmaxes to self.prior.transformer.ws. Either a
317
+ set of layer indices indicating which layers to store, or a
318
+ boolean value indicating whether to dump all.
319
+ """
320
+ assert isinstance(get_attn_weights, (bool, set))
321
+ if get_attn_weights:
322
+ self.prior.transformer.set_record_attn(get_attn_weights)
323
+ x_cond, y_cond, prime = self.get_cond(z_conds, y)
324
+ if self.copy_input:
325
+ prime = z[:,:self.n_tokens]
326
+ if self.single_enc_dec:
327
+ z, x_cond = self.prior_preprocess([prime, z], [None, x_cond])
328
+ (prime_loss, gen_loss), preds = self.prior(z, x_cond, y_cond, fp16=fp16, get_sep_loss=True, get_preds=get_preds)
329
+ else:
330
+ encoder_kv = self.get_encoder_kv(prime, fp16=fp16)
331
+ prime_loss = self.get_prime_loss(encoder_kv, prime)
332
+ gen_loss, preds = self.prior(z, x_cond, y_cond, encoder_kv, fp16=fp16, get_preds=get_preds)
333
+ loss = (self.prime_loss_fraction*prime_loss*self.prime_loss_dims/self.total_loss_dims) + \
334
+ (gen_loss*self.gen_loss_dims/self.total_loss_dims)
335
+ metrics=dict(bpd=gen_loss.clone().detach(), prime_loss=prime_loss.clone().detach(),
336
+ gen_loss=gen_loss.clone().detach())
337
+ if get_preds:
338
+ metrics["preds"] = preds.clone().detach()
339
+ if get_attn_weights:
340
+ ws = self.prior.transformer.ws
341
+ self.prior.transformer.set_record_attn(False)
342
+ return ws
343
+ else:
344
+ return loss, metrics
345
+
346
+ def forward(self, x, y=None, fp16=False, decode=False, get_preds=False):
347
+ bs = x.shape[0]
348
+ z, *z_conds = self.encode(x, bs_chunks=bs)
349
+ loss, metrics = self.z_forward(z=z, z_conds=z_conds, y=y, fp16=fp16, get_preds=get_preds)
350
+ if decode:
351
+ x_out = self.decode([z, *z_conds])
352
+ else:
353
+ x_out = None
354
+ return x_out, loss, metrics
jukebox/sample.py ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch as t
3
+ import jukebox.utils.dist_adapter as dist
4
+
5
+ from jukebox.hparams import Hyperparams
6
+ from jukebox.data.labels import EmptyLabeller
7
+ from jukebox.utils.torch_utils import empty_cache
8
+ from jukebox.utils.audio_utils import save_wav, load_audio
9
+ from jukebox.make_models import make_model
10
+ from jukebox.align import get_alignment
11
+ from jukebox.save_html import save_html
12
+ from jukebox.utils.sample_utils import split_batch, get_starts
13
+ from jukebox.utils.dist_utils import print_once
14
+ import fire
15
+
16
+ # Sample a partial window of length<n_ctx with tokens_to_sample new tokens on level=level
17
+ def sample_partial_window(zs, labels, sampling_kwargs, level, prior, tokens_to_sample, hps):
18
+ z = zs[level]
19
+ n_ctx = prior.n_ctx
20
+ current_tokens = z.shape[1]
21
+ if current_tokens < n_ctx - tokens_to_sample:
22
+ sampling_kwargs['sample_tokens'] = current_tokens + tokens_to_sample
23
+ start = 0
24
+ else:
25
+ sampling_kwargs['sample_tokens'] = n_ctx
26
+ start = current_tokens - n_ctx + tokens_to_sample
27
+
28
+ return sample_single_window(zs, labels, sampling_kwargs, level, prior, start, hps)
29
+
30
+ # Sample a single window of length=n_ctx at position=start on level=level
31
+ def sample_single_window(zs, labels, sampling_kwargs, level, prior, start, hps):
32
+ n_samples = hps.n_samples
33
+ n_ctx = prior.n_ctx
34
+ end = start + n_ctx
35
+
36
+ # get z already sampled at current level
37
+ z = zs[level][:,start:end]
38
+
39
+ if 'sample_tokens' in sampling_kwargs:
40
+ # Support sampling a window shorter than n_ctx
41
+ sample_tokens = sampling_kwargs['sample_tokens']
42
+ else:
43
+ sample_tokens = (end - start)
44
+ conditioning_tokens, new_tokens = z.shape[1], sample_tokens - z.shape[1]
45
+
46
+ print_once(f"Sampling {sample_tokens} tokens for [{start},{start+sample_tokens}]. Conditioning on {conditioning_tokens} tokens")
47
+
48
+ if new_tokens <= 0:
49
+ # Nothing new to sample
50
+ return zs
51
+
52
+ # get z_conds from level above
53
+ z_conds = prior.get_z_conds(zs, start, end)
54
+
55
+ # set y offset, sample_length and lyrics tokens
56
+ y = prior.get_y(labels, start)
57
+
58
+ empty_cache()
59
+
60
+ max_batch_size = sampling_kwargs['max_batch_size']
61
+ del sampling_kwargs['max_batch_size']
62
+
63
+
64
+ z_list = split_batch(z, n_samples, max_batch_size)
65
+ z_conds_list = split_batch(z_conds, n_samples, max_batch_size)
66
+ y_list = split_batch(y, n_samples, max_batch_size)
67
+ z_samples = []
68
+ for z_i, z_conds_i, y_i in zip(z_list, z_conds_list, y_list):
69
+ z_samples_i = prior.sample(n_samples=z_i.shape[0], z=z_i, z_conds=z_conds_i, y=y_i, **sampling_kwargs)
70
+ z_samples.append(z_samples_i)
71
+ z = t.cat(z_samples, dim=0)
72
+
73
+ sampling_kwargs['max_batch_size'] = max_batch_size
74
+
75
+ # Update z with new sample
76
+ z_new = z[:,-new_tokens:]
77
+ zs[level] = t.cat([zs[level], z_new], dim=1)
78
+ return zs
79
+
80
+ # Sample total_length tokens at level=level with hop_length=hop_length
81
+ def sample_level(zs, labels, sampling_kwargs, level, prior, total_length, hop_length, hps):
82
+ print_once(f"Sampling level {level}")
83
+ if total_length >= prior.n_ctx:
84
+ for start in get_starts(total_length, prior.n_ctx, hop_length):
85
+ zs = sample_single_window(zs, labels, sampling_kwargs, level, prior, start, hps)
86
+ else:
87
+ zs = sample_partial_window(zs, labels, sampling_kwargs, level, prior, total_length, hps)
88
+ return zs
89
+
90
+ # Sample multiple levels
91
+ def _sample(zs, labels, sampling_kwargs, priors, sample_levels, hps):
92
+ alignments = None
93
+ for level in reversed(sample_levels):
94
+ prior = priors[level]
95
+ prior.cuda()
96
+ empty_cache()
97
+
98
+ # Set correct total_length, hop_length, labels and sampling_kwargs for level
99
+ assert hps.sample_length % prior.raw_to_tokens == 0, f"Expected sample_length {hps.sample_length} to be multiple of {prior.raw_to_tokens}"
100
+ total_length = hps.sample_length//prior.raw_to_tokens
101
+ hop_length = int(hps.hop_fraction[level]*prior.n_ctx)
102
+ zs = sample_level(zs, labels[level], sampling_kwargs[level], level, prior, total_length, hop_length, hps)
103
+
104
+ prior.cpu()
105
+ empty_cache()
106
+
107
+ # Decode sample
108
+ x = prior.decode(zs[level:], start_level=level, bs_chunks=zs[level].shape[0])
109
+
110
+ if dist.get_world_size() > 1:
111
+ logdir = f"{hps.name}_rank_{dist.get_rank()}/level_{level}"
112
+ else:
113
+ logdir = f"{hps.name}/level_{level}"
114
+ if not os.path.exists(logdir):
115
+ os.makedirs(logdir)
116
+ t.save(dict(zs=zs, labels=labels, sampling_kwargs=sampling_kwargs, x=x), f"{logdir}/data.pth.tar")
117
+ save_wav(logdir, x, hps.sr)
118
+ if alignments is None and priors[-1] is not None and priors[-1].n_tokens > 0 and not isinstance(priors[-1].labeller, EmptyLabeller):
119
+ alignments = get_alignment(x, zs, labels[-1], priors[-1], sampling_kwargs[-1]['fp16'], hps)
120
+ save_html(logdir, x, zs, labels[-1], alignments, hps)
121
+ return zs
122
+
123
+ # Generate ancestral samples given a list of artists and genres
124
+ def ancestral_sample(labels, sampling_kwargs, priors, hps):
125
+ sample_levels = list(range(len(priors)))
126
+ zs = [t.zeros(hps.n_samples,0,dtype=t.long, device='cuda') for _ in range(len(priors))]
127
+ zs = _sample(zs, labels, sampling_kwargs, priors, sample_levels, hps)
128
+ return zs
129
+
130
+ # Continue ancestral sampling from previously saved codes
131
+ def continue_sample(zs, labels, sampling_kwargs, priors, hps):
132
+ sample_levels = list(range(len(priors)))
133
+ zs = _sample(zs, labels, sampling_kwargs, priors, sample_levels, hps)
134
+ return zs
135
+
136
+ # Upsample given already generated upper-level codes
137
+ def upsample(zs, labels, sampling_kwargs, priors, hps):
138
+ sample_levels = list(range(len(priors) - 1))
139
+ zs = _sample(zs, labels, sampling_kwargs, priors, sample_levels, hps)
140
+ return zs
141
+
142
+ # Prompt the model with raw audio input (dimension: NTC) and generate continuations
143
+ def primed_sample(x, labels, sampling_kwargs, priors, hps):
144
+ sample_levels = list(range(len(priors)))
145
+ zs = priors[-1].encode(x, start_level=0, end_level=len(priors), bs_chunks=x.shape[0])
146
+ zs = _sample(zs, labels, sampling_kwargs, priors, sample_levels, hps)
147
+ return zs
148
+
149
+ # Load `duration` seconds of the given audio files to use as prompts
150
+ def load_prompts(audio_files, duration, hps):
151
+ xs = []
152
+ for audio_file in audio_files:
153
+ x = load_audio(audio_file, sr=hps.sr, duration=duration, offset=0.0, mono=True)
154
+ x = x.T # CT -> TC
155
+ xs.append(x)
156
+ while len(xs) < hps.n_samples:
157
+ xs.extend(xs)
158
+ xs = xs[:hps.n_samples]
159
+ x = t.stack([t.from_numpy(x) for x in xs])
160
+ x = x.to('cuda', non_blocking=True)
161
+ return x
162
+
163
+ # Load codes from previous sampling run
164
+ def load_codes(codes_file, duration, priors, hps):
165
+ data = t.load(codes_file, map_location='cpu')
166
+ zs = [z.cuda() for z in data['zs']]
167
+ assert zs[-1].shape[0] == hps.n_samples, f"Expected bs = {hps.n_samples}, got {zs[-1].shape[0]}"
168
+ del data
169
+ if duration is not None:
170
+ # Cut off codes to match duration
171
+ top_raw_to_tokens = priors[-1].raw_to_tokens
172
+ assert duration % top_raw_to_tokens == 0, f"Cut-off duration {duration} not an exact multiple of top_raw_to_tokens"
173
+ assert duration//top_raw_to_tokens <= zs[-1].shape[1], f"Cut-off tokens {duration//priors[-1].raw_to_tokens} longer than tokens {zs[-1].shape[1]} in saved codes"
174
+ zs = [z[:,:duration//prior.raw_to_tokens] for z, prior in zip(zs, priors)]
175
+ return zs
176
+
177
+ # Generate and save samples, alignment, and webpage for visualization.
178
+ def save_samples(model, device, hps, sample_hps):
179
+ print(hps)
180
+ from jukebox.lyricdict import poems, gpt_2_lyrics
181
+ vqvae, priors = make_model(model, device, hps)
182
+
183
+ assert hps.sample_length//priors[-2].raw_to_tokens >= priors[-2].n_ctx, f"Upsampling needs atleast one ctx in get_z_conds. Please choose a longer sample length"
184
+
185
+ total_length = hps.total_sample_length_in_seconds * hps.sr
186
+ offset = 0
187
+
188
+ # Set artist/genre/lyrics for your samples here!
189
+ # We used different label sets in our models, but you can write the human friendly names here and we'll map them under the hood for each model.
190
+ # For the 5b/5b_lyrics model and the upsamplers, labeller will look up artist and genres in v2 set. (after lowercasing, removing non-alphanumerics and collapsing whitespaces to _).
191
+ # For the 1b_lyrics top level, labeller will look up artist and genres in v3 set (after lowercasing).
192
+ metas = [dict(artist = "Alan Jackson",
193
+ genre = "Country",
194
+ lyrics = poems['ozymandias'],
195
+ total_length=total_length,
196
+ offset=offset,
197
+ ),
198
+ dict(artist="Joe Bonamassa",
199
+ genre="Blues Rock",
200
+ lyrics=gpt_2_lyrics['hottub'],
201
+ total_length=total_length,
202
+ offset=offset,
203
+ ),
204
+ dict(artist="Frank Sinatra",
205
+ genre="Classic Pop",
206
+ lyrics=gpt_2_lyrics['alone'],
207
+ total_length=total_length,
208
+ offset=offset,
209
+ ),
210
+ dict(artist="Ella Fitzgerald",
211
+ genre="Jazz",
212
+ lyrics=gpt_2_lyrics['count'],
213
+ total_length=total_length,
214
+ offset=offset,
215
+ ),
216
+ dict(artist="Céline Dion",
217
+ genre="Pop",
218
+ lyrics=gpt_2_lyrics['darkness'],
219
+ total_length=total_length,
220
+ offset=offset,
221
+ ),
222
+ ]
223
+ while len(metas) < hps.n_samples:
224
+ metas.extend(metas)
225
+ metas = metas[:hps.n_samples]
226
+
227
+ labels = [prior.labeller.get_batch_labels(metas, 'cuda') for prior in priors]
228
+ for label in labels:
229
+ assert label['y'].shape[0] == hps.n_samples
230
+
231
+ lower_level_chunk_size = 32
232
+ lower_level_max_batch_size = 16
233
+ if model == '1b_lyrics':
234
+ chunk_size = 32
235
+ max_batch_size = 16
236
+ else:
237
+ chunk_size = 16
238
+ max_batch_size = 3
239
+ sampling_kwargs = [dict(temp=0.99, fp16=True, chunk_size=lower_level_chunk_size, max_batch_size=lower_level_max_batch_size),
240
+ dict(temp=0.99, fp16=True, chunk_size=lower_level_chunk_size, max_batch_size=lower_level_max_batch_size),
241
+ dict(temp=0.99, fp16=True, chunk_size=chunk_size, max_batch_size=max_batch_size)]
242
+
243
+ if sample_hps.mode == 'ancestral':
244
+ ancestral_sample(labels, sampling_kwargs, priors, hps)
245
+ elif sample_hps.mode in ['continue', 'upsample']:
246
+ assert sample_hps.codes_file is not None
247
+ top_raw_to_tokens = priors[-1].raw_to_tokens
248
+ if sample_hps.prompt_length_in_seconds is not None:
249
+ duration = (int(sample_hps.prompt_length_in_seconds * hps.sr) // top_raw_to_tokens) * top_raw_to_tokens
250
+ else:
251
+ duration = None
252
+ zs = load_codes(sample_hps.codes_file, duration, priors, hps)
253
+ if sample_hps.mode == 'continue':
254
+ continue_sample(zs, labels, sampling_kwargs, priors, hps)
255
+ elif sample_hps.mode == 'upsample':
256
+ upsample(zs, labels, sampling_kwargs, priors, hps)
257
+ elif sample_hps.mode == 'primed':
258
+ assert sample_hps.audio_file is not None
259
+ assert sample_hps.prompt_length_in_seconds is not None
260
+ audio_files = sample_hps.audio_file.split(',')
261
+ top_raw_to_tokens = priors[-1].raw_to_tokens
262
+ duration = (int(sample_hps.prompt_length_in_seconds * hps.sr) // top_raw_to_tokens) * top_raw_to_tokens
263
+ x = load_prompts(audio_files, duration, hps)
264
+ primed_sample(x, labels, sampling_kwargs, priors, hps)
265
+ else:
266
+ raise ValueError(f'Unknown sample mode {sample_hps.mode}.')
267
+
268
+
269
+ def run(model, mode='ancestral', codes_file=None, audio_file=None, prompt_length_in_seconds=None, port=29500, **kwargs):
270
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
271
+ rank, local_rank, device = setup_dist_from_mpi(port=port)
272
+ hps = Hyperparams(**kwargs)
273
+ sample_hps = Hyperparams(dict(mode=mode, codes_file=codes_file, audio_file=audio_file, prompt_length_in_seconds=prompt_length_in_seconds))
274
+
275
+ with t.no_grad():
276
+ save_samples(model, device, hps, sample_hps)
277
+
278
+ if __name__ == '__main__':
279
+ fire.Fire(run)
jukebox/save_html.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import numpy as np
4
+ from PIL import Image, ImageFilter
5
+ import soundfile
6
+
7
+ def save_html(logdir, x, zs, labels, alignments, hps):
8
+ level = hps.levels - 1 # Top level used
9
+ z = zs[level]
10
+ bs, total_length = z.shape[0], z.shape[1]
11
+
12
+ with open(f'{logdir}/index.html', 'w') as html:
13
+ print(f"<html><head><title>{logdir}</title></head><body style='font-family: sans-serif; font-size: 1.4em; font-weight: bold; text-align: center; max-width:1024px; width: 100%; margin: auto;'>",
14
+ file=html)
15
+ print("<link rel='icon' href='data:;base64,iVBORw0KGgo='>", file=html)
16
+
17
+ for item in range(bs):
18
+ data = dict(wav=x[item].cpu().numpy(), sr=hps.sr,
19
+ info=labels['info'][item],
20
+ total_length=total_length,
21
+ total_tokens=len(labels['info'][item]['full_tokens']),
22
+ alignment=alignments[item] if alignments is not None else None)
23
+ item_dir = f'{logdir}/item_{item}'
24
+ _save_item_html(item_dir, item, item, data)
25
+ print(f"<iframe style='height: 100%; width: 100%;' frameborder='0' scrolling='no' src='item_{item}/index.html'></iframe>", file=html)
26
+ print("</body></html>", file=html)
27
+
28
+ def _save_item_html(item_dir, item_id, item_name, data):
29
+ # replace gs:// with /root/samples/
30
+
31
+ # an html for each sample. Main html has a selector to get us id of this?
32
+ if not os.path.exists(item_dir):
33
+ os.makedirs(item_dir)
34
+
35
+ with open(f'{item_dir}/index.html', 'w') as html:
36
+ print(f"<html><head><title>{item_name}</title></head><body style='font-family: sans-serif; font-size: 1.4em; font-weight: bold; text-align: center; max-width:1024px; width: 100%; margin: auto;'>",
37
+ file=html)
38
+ print("<link rel='icon' href='data:;base64,iVBORw0KGgo='>", file=html)
39
+ total_length = data['total_length']
40
+ total_tokens = data['total_tokens']
41
+ alignment = data['alignment']
42
+ lyrics = data["info"]["lyrics"]
43
+ wav, sr = data['wav'], data['sr']
44
+ genre, artist = data["info"]["genre"], data["info"]["artist"]
45
+
46
+ # Strip unused columns
47
+ if alignment is not None:
48
+ assert alignment.shape == (total_length, total_tokens)
49
+ assert len(lyrics) == total_tokens, f'Total_tokens: {total_tokens}, Lyrics Len: {len(lyrics)}. Lyrics: {lyrics}'
50
+ max_attn_at_token = np.max(alignment, axis=0)
51
+ assert len(max_attn_at_token) == total_tokens
52
+ for token in reversed(range(total_tokens)):
53
+ if max_attn_at_token[token] > 0:
54
+ break
55
+ alignment = alignment[:,:token+1]
56
+ lyrics = lyrics[:token+1]
57
+ total_tokens = token+1
58
+
59
+ # Small alignment image
60
+ im = Image.fromarray(np.uint8(alignment * 255)).resize((512, 1024)).transpose(Image.ROTATE_90)
61
+ img_src = f'align.png'
62
+ im.save(f'{item_dir}/{img_src}')
63
+ print(f"<img id='{img_src}' src='{img_src}' \>", file=html)
64
+
65
+ # Smaller alignment json for animation
66
+ total_alignment_length = total_length // 16
67
+ alignment = Image.fromarray(np.uint8(alignment * 255)).resize((total_tokens, total_alignment_length))
68
+ alignment = alignment.filter(ImageFilter.GaussianBlur(radius=1.5))
69
+ alignment = np.asarray(alignment).tolist()
70
+ align_src = f'align.json'
71
+ with open(f'{item_dir}/{align_src}', 'w') as f:
72
+ json.dump(alignment, f)
73
+
74
+ # Audio
75
+ wav_src = f'audio.wav'
76
+ soundfile.write(f'{item_dir}/{wav_src}', wav, samplerate=sr, format='wav')
77
+ print(f"<audio id='{wav_src}' src='{wav_src}' style='width: 100%;' controls></audio>", file=html)
78
+
79
+
80
+ # Labels and Lyrics
81
+ print(f"<pre style='white-space: pre-wrap;'>", end="", file=html)
82
+ print(f"<div>Artist {artist}, Genre {genre}</div>", file=html)
83
+ lyrics = [c for c in lyrics] # already characters actually
84
+ lyrics = [''] + lyrics[:-1] # input lyrics are shifted by 1
85
+ for i, c in enumerate(lyrics):
86
+ print(f"<span id='{item_id}/{i}'>{c}</span>", end="", file=html)
87
+ print(f"</pre>", file=html)
88
+ with open(f'{item_dir}/lyrics.json', 'w') as f:
89
+ json.dump(lyrics, f)
90
+
91
+ if alignment is not None:
92
+ # JS for alignment animation
93
+ print("""<script>
94
+ async function fetchAsync (url) {
95
+ let response = await fetch(url);
96
+ let data = await response.json();
97
+ return data;
98
+ }
99
+
100
+ var audio = document.getElementById('""" + f'{wav_src}' + """');
101
+ audio.onplay = function () {
102
+ track = '""" + f'{item_id}' + """'
103
+ fetchAsync('""" + f'{align_src}' + """')
104
+ .then(data => animateLyrics(data, track, this))
105
+ .catch(reason => console.log(reason.message))
106
+ };
107
+
108
+ function animateLyrics(data, track, audio) {
109
+ var animate = setInterval(function () {
110
+ var time = Math.floor(audio.currentTime*""" + f'{total_alignment_length}' + """/audio.duration);
111
+ if (!(time == 0 || time == """ + f'{total_alignment_length}' + """)) {
112
+ console.log(time);
113
+ changeColor(data, track, audio, time);
114
+ }
115
+ if (audio.paused) {
116
+ clearInterval(animate);
117
+ }
118
+ }, 50);
119
+ }
120
+
121
+ function changeColor(data, track, audio, time) {
122
+ colors = data[time]
123
+ for (i = 0; i < colors.length; i++){
124
+ character = document.getElementById(track + '/' + i.toString());
125
+ color = Math.max(230 - 10*colors[i], 0).toString();
126
+ character.style.color = 'rgb(255,' + color + ',' + color + ')';
127
+ }
128
+ }
129
+ </script>""", file=html)
130
+ print("</body></html>", file=html)
jukebox/train.py ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Ability to train vq-vae and prior
3
+ First try for random inputs
4
+ Then from maestros
5
+ """
6
+ import sys
7
+ import fire
8
+ import warnings
9
+ import numpy as np
10
+ import torch as t
11
+ import jukebox.utils.dist_adapter as dist
12
+ from torch.nn.parallel import DistributedDataParallel
13
+
14
+ from jukebox.hparams import setup_hparams
15
+ from jukebox.make_models import make_vqvae, make_prior, restore_opt, save_checkpoint
16
+ from jukebox.utils.logger import init_logging
17
+ from jukebox.utils.audio_utils import audio_preprocess, audio_postprocess
18
+ from jukebox.utils.torch_utils import zero_grad, count_parameters
19
+ from jukebox.utils.dist_utils import print_once, allreduce, allgather
20
+ from jukebox.utils.ema import CPUEMA, FusedEMA, EMA
21
+ from jukebox.utils.fp16 import FP16FusedAdam, FusedAdam, LossScalar, clipped_grad_scale, backward
22
+ from jukebox.data.data_processor import DataProcessor
23
+
24
+ def prepare_aud(x, hps):
25
+ x = audio_postprocess(x.detach().contiguous(), hps)
26
+ return allgather(x)
27
+
28
+ def log_aud(logger, tag, x, hps):
29
+ logger.add_audios(tag, prepare_aud(x, hps), hps.sr, max_len=hps.max_len, max_log=hps.max_log)
30
+ logger.flush()
31
+
32
+ def log_labels(logger, labeller, tag, y, hps):
33
+ y = y.cpu().numpy()
34
+ txt = ''
35
+ for item in range(y.shape[0]):
36
+ description = labeller.describe_label(y[item])
37
+ artist, genre, lyrics = description['artist'], description['genre'], description['lyrics']
38
+ txt += f'{item} artist:{artist}, genre:{genre}, lyrics:{lyrics}\n'
39
+ logger.add_text(tag, txt)
40
+ logger.flush()
41
+
42
+ def get_ddp(model, hps):
43
+ rank = dist.get_rank()
44
+ local_rank = rank % 8
45
+ ddp = DistributedDataParallel(model, device_ids=[local_rank], output_device=local_rank, broadcast_buffers=False, bucket_cap_mb=hps.bucket)
46
+ return ddp
47
+
48
+ def get_ema(model, hps):
49
+ mu = hps.mu or (1. - (hps.bs * hps.ngpus/8.)/1000)
50
+ ema = None
51
+ if hps.ema and hps.train:
52
+ if hps.cpu_ema:
53
+ if dist.get_rank() == 0:
54
+ print("Using CPU EMA")
55
+ ema = CPUEMA(model.parameters(), mu=mu, freq=hps.cpu_ema_freq)
56
+ elif hps.ema_fused:
57
+ ema = FusedEMA(model.parameters(), mu=mu)
58
+ else:
59
+ ema = EMA(model.parameters(), mu=mu)
60
+ return ema
61
+
62
+ def get_lr_scheduler(opt, hps):
63
+ def lr_lambda(step):
64
+ if hps.lr_use_linear_decay:
65
+ lr_scale = hps.lr_scale * min(1.0, step / hps.lr_warmup)
66
+ decay = max(0.0, 1.0 - max(0.0, step - hps.lr_start_linear_decay) / hps.lr_decay)
67
+ if decay == 0.0:
68
+ if dist.get_rank() == 0:
69
+ print("Reached end of training")
70
+ return lr_scale * decay
71
+ else:
72
+ return hps.lr_scale * (hps.lr_gamma ** (step // hps.lr_decay)) * min(1.0, step / hps.lr_warmup)
73
+
74
+ shd = t.optim.lr_scheduler.LambdaLR(opt, lr_lambda)
75
+
76
+ return shd
77
+
78
+ def get_optimizer(model, hps):
79
+ # Optimizer
80
+ betas = (hps.beta1, hps.beta2)
81
+ if hps.fp16_opt:
82
+ opt = FP16FusedAdam(model.parameters(), lr=hps.lr, weight_decay=hps.weight_decay, betas=betas, eps=hps.eps)
83
+ else:
84
+ opt = FusedAdam(model.parameters(), lr=hps.lr, weight_decay=hps.weight_decay, betas=betas, eps=hps.eps)
85
+
86
+ # lr scheduler
87
+ shd = get_lr_scheduler(opt, hps)
88
+
89
+ restore_path = hps.restore_prior if hps.prior else hps.restore_vqvae
90
+ restore_opt(opt, shd, restore_path)
91
+
92
+ # fp16 dynamic loss scaler
93
+ scalar = None
94
+ if hps.fp16:
95
+ rank = dist.get_rank()
96
+ local_rank = rank % 8
97
+ scalar = LossScalar(hps.fp16_loss_scale, scale_factor=2 ** (1./hps.fp16_scale_window))
98
+ if local_rank == 0: print(scalar.__dict__)
99
+
100
+ zero_grad(model)
101
+ return opt, shd, scalar
102
+
103
+ def log_inputs(orig_model, logger, x_in, y, x_out, hps, tag="train"):
104
+ print(f"Logging {tag} inputs/ouputs")
105
+ log_aud(logger, f'{tag}_x_in', x_in, hps)
106
+ log_aud(logger, f'{tag}_x_out', x_out, hps)
107
+ bs = x_in.shape[0]
108
+ if hps.prior:
109
+ if hps.labels:
110
+ log_labels(logger, orig_model.labeller, f'{tag}_y_in', allgather(y.cuda()), hps)
111
+ else:
112
+ zs_in = orig_model.encode(x_in, start_level=0, bs_chunks=bs)
113
+ x_ds = [orig_model.decode(zs_in[level:], start_level=level, bs_chunks=bs) for level in range(0, hps.levels)]
114
+ for i in range(len(x_ds)):
115
+ log_aud(logger, f'{tag}_x_ds_start_{i}', x_ds[i], hps)
116
+ logger.flush()
117
+
118
+ def sample_prior(orig_model, ema, logger, x_in, y, hps):
119
+ if ema is not None: ema.swap()
120
+ orig_model.eval()
121
+
122
+ x_in = x_in[:hps.bs_sample]
123
+ bs = x_in.shape[0]
124
+ zs_in = orig_model.encode(x_in, start_level=0, bs_chunks=bs)
125
+ assert len(zs_in) == hps.levels
126
+ x_ds = [orig_model.decode(zs_in[level:], start_level=level, bs_chunks=bs) for level in range(0, hps.levels)]
127
+
128
+ if not hps.labels:
129
+ y = None
130
+ elif hps.level == (hps.levels - 1):
131
+ # Topmost level labels in order
132
+ y = y[:hps.bs_sample] # t.ones((hps.bs_sample, 1), device=y.device, dtype=t.long) * dist.get_rank()
133
+ else:
134
+ # Other levels keep labels to match x_cond
135
+ y = y[:hps.bs_sample]
136
+
137
+ # Temp 1.0
138
+ _, *z_conds = orig_model.encode(x_in, bs_chunks=bs)
139
+ z = orig_model.sample(hps.bs_sample, z_conds=z_conds, y=y, fp16=False, temp=1.0)
140
+ x_sample = orig_model.decode([z, *z_conds], bs_chunks=bs)
141
+
142
+ log_aud(logger, 'sample_x_T1', x_sample, hps)
143
+ if hps.prior and hps.labels:
144
+ log_labels(logger, orig_model.labeller, f'sample_x_T1', allgather(y.cuda()), hps)
145
+
146
+ # Recons
147
+ for i in range(len(x_ds)):
148
+ log_aud(logger, f'x_ds_start_{i}', x_ds[i], hps)
149
+ orig_model.train()
150
+ if ema is not None: ema.swap()
151
+ logger.flush()
152
+
153
+ def evaluate(model, orig_model, logger, metrics, data_processor, hps):
154
+ model.eval()
155
+ orig_model.eval()
156
+ if hps.prior:
157
+ _print_keys = dict(l="loss", bpd="bpd")
158
+ else:
159
+ _print_keys = dict(l="loss", rl="recons_loss", sl="spectral_loss")
160
+
161
+ with t.no_grad():
162
+ for i, x in logger.get_range(data_processor.test_loader):
163
+ if isinstance(x, (tuple, list)):
164
+ x, y = x
165
+ else:
166
+ y = None
167
+
168
+ x = x.to('cuda', non_blocking=True)
169
+ if y is not None:
170
+ y = y.to('cuda', non_blocking=True)
171
+
172
+ x_in = x = audio_preprocess(x, hps)
173
+ log_input_output = (i==0)
174
+
175
+ if hps.prior:
176
+ forw_kwargs = dict(y=y, fp16=hps.fp16, decode=log_input_output)
177
+ else:
178
+ forw_kwargs = dict(loss_fn=hps.loss_fn, hps=hps)
179
+
180
+ x_out, loss, _metrics = model(x, **forw_kwargs)
181
+
182
+ # Logging
183
+ for key, val in _metrics.items():
184
+ _metrics[key] = val.item()
185
+ _metrics["loss"] = loss = loss.item() # Make sure to call to free graph
186
+
187
+ # Average and log
188
+ for key, val in _metrics.items():
189
+ _metrics[key] = metrics.update(f"test_{key}", val, x.shape[0])
190
+
191
+ with t.no_grad():
192
+ if log_input_output:
193
+ log_inputs(orig_model, logger, x_in, y, x_out, hps)
194
+
195
+ logger.set_postfix(**{print_key:_metrics[key] for print_key, key in _print_keys.items()})
196
+
197
+ for key, val in _metrics.items():
198
+ logger.add_scalar(f"test_{key}", metrics.avg(f"test_{key}"))
199
+
200
+ logger.close_range()
201
+ return {key: metrics.avg(f"test_{key}") for key in _metrics.keys()}
202
+
203
+ def train(model, orig_model, opt, shd, scalar, ema, logger, metrics, data_processor, hps):
204
+ model.train()
205
+ orig_model.train()
206
+ if hps.prior:
207
+ _print_keys = dict(l="loss", bpd="bpd", gn="gn", g_l="gen_loss", p_l="prime_loss")
208
+ else:
209
+ _print_keys = dict(l="loss", sl="spectral_loss", rl="recons_loss", e="entropy", u="usage", uc="used_curr", gn="gn", pn="pn", dk="dk")
210
+
211
+ for i, x in logger.get_range(data_processor.train_loader):
212
+ if isinstance(x, (tuple, list)):
213
+ x, y = x
214
+ else:
215
+ y = None
216
+
217
+ x = x.to('cuda', non_blocking=True)
218
+ if y is not None:
219
+ y = y.to('cuda', non_blocking=True)
220
+
221
+ x_in = x = audio_preprocess(x, hps)
222
+ log_input_output = (logger.iters % hps.save_iters == 0)
223
+
224
+ if hps.prior:
225
+ forw_kwargs = dict(y=y, fp16=hps.fp16, decode=log_input_output)
226
+ else:
227
+ forw_kwargs = dict(loss_fn=hps.loss_fn, hps=hps)
228
+
229
+ # Forward
230
+ x_out, loss, _metrics = model(x, **forw_kwargs)
231
+
232
+ # Backward
233
+ loss, scale, grad_norm, overflow_loss, overflow_grad = backward(loss=loss, params=list(model.parameters()),
234
+ scalar=scalar, fp16=hps.fp16, logger=logger)
235
+ # Skip step if overflow
236
+ grad_norm = allreduce(grad_norm, op=dist.ReduceOp.MAX)
237
+ if overflow_loss or overflow_grad or grad_norm > hps.ignore_grad_norm > 0:
238
+ zero_grad(orig_model)
239
+ continue
240
+
241
+ # Step opt. Divide by scale to include clipping and fp16 scaling
242
+ logger.step()
243
+ opt.step(scale=clipped_grad_scale(grad_norm, hps.clip, scale))
244
+ zero_grad(orig_model)
245
+ lr = hps.lr if shd is None else shd.get_lr()[0]
246
+ if shd is not None: shd.step()
247
+ if ema is not None: ema.step()
248
+ next_lr = hps.lr if shd is None else shd.get_lr()[0]
249
+ finished_training = (next_lr == 0.0)
250
+
251
+ # Logging
252
+ for key, val in _metrics.items():
253
+ _metrics[key] = val.item()
254
+ _metrics["loss"] = loss = loss.item() * hps.iters_before_update # Make sure to call to free graph
255
+ _metrics["gn"] = grad_norm
256
+ _metrics["lr"] = lr
257
+ _metrics["lg_loss_scale"] = np.log2(scale)
258
+
259
+ # Average and log
260
+ for key, val in _metrics.items():
261
+ _metrics[key] = metrics.update(key, val, x.shape[0])
262
+ if logger.iters % hps.log_steps == 0:
263
+ logger.add_scalar(key, _metrics[key])
264
+
265
+ # Save checkpoint
266
+ with t.no_grad():
267
+ if hps.save and (logger.iters % hps.save_iters == 1 or finished_training):
268
+ if ema is not None: ema.swap()
269
+ orig_model.eval()
270
+ name = 'latest' if hps.prior else f'step_{logger.iters}'
271
+ if dist.get_rank() % 8 == 0:
272
+ save_checkpoint(logger, name, orig_model, opt, dict(step=logger.iters), hps)
273
+ orig_model.train()
274
+ if ema is not None: ema.swap()
275
+
276
+ # Sample
277
+ with t.no_grad():
278
+ if (logger.iters % 12000) in list(range(1, 1 + hps.iters_before_update)) or finished_training:
279
+ if hps.prior:
280
+ sample_prior(orig_model, ema, logger, x_in, y, hps)
281
+
282
+ # Input/Output
283
+ with t.no_grad():
284
+ if log_input_output:
285
+ log_inputs(orig_model, logger, x_in, y, x_out, hps)
286
+
287
+ logger.set_postfix(**{print_key:_metrics[key] for print_key, key in _print_keys.items()})
288
+ if finished_training:
289
+ dist.barrier()
290
+ exit()
291
+ logger.close_range()
292
+ return {key: metrics.avg(key) for key in _metrics.keys()}
293
+
294
+ def run(hps="teeny", port=29500, **kwargs):
295
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
296
+ rank, local_rank, device = setup_dist_from_mpi(port=port)
297
+ hps = setup_hparams(hps, kwargs)
298
+ hps.ngpus = dist.get_world_size()
299
+ hps.argv = " ".join(sys.argv)
300
+ hps.bs_sample = hps.nworkers = hps.bs
301
+
302
+ # Setup dataset
303
+ data_processor = DataProcessor(hps)
304
+
305
+ # Setup models
306
+ vqvae = make_vqvae(hps, device)
307
+ print_once(f"Parameters VQVAE:{count_parameters(vqvae)}")
308
+ if hps.prior:
309
+ prior = make_prior(hps, vqvae, device)
310
+ print_once(f"Parameters Prior:{count_parameters(prior)}")
311
+ model = prior
312
+ else:
313
+ model = vqvae
314
+
315
+ # Setup opt, ema and distributed_model.
316
+ opt, shd, scalar = get_optimizer(model, hps)
317
+ ema = get_ema(model, hps)
318
+ distributed_model = get_ddp(model, hps)
319
+
320
+ logger, metrics = init_logging(hps, local_rank, rank)
321
+ logger.iters = model.step
322
+
323
+ # Run training, eval, sample
324
+ for epoch in range(hps.curr_epoch, hps.epochs):
325
+ metrics.reset()
326
+ data_processor.set_epoch(epoch)
327
+ if hps.train:
328
+ train_metrics = train(distributed_model, model, opt, shd, scalar, ema, logger, metrics, data_processor, hps)
329
+ train_metrics['epoch'] = epoch
330
+ if rank == 0:
331
+ print('Train',' '.join([f'{key}: {val:0.4f}' for key,val in train_metrics.items()]))
332
+ dist.barrier()
333
+
334
+ if hps.test:
335
+ if ema: ema.swap()
336
+ test_metrics = evaluate(distributed_model, model, logger, metrics, data_processor, hps)
337
+ test_metrics['epoch'] = epoch
338
+ if rank == 0:
339
+ print('Ema',' '.join([f'{key}: {val:0.4f}' for key,val in test_metrics.items()]))
340
+ dist.barrier()
341
+ if ema: ema.swap()
342
+ dist.barrier()
343
+
344
+ if __name__ == '__main__':
345
+ fire.Fire(run)
jukebox/transformer/__init__.py ADDED
File without changes
jukebox/transformer/factored_attention.py ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Factored attention
2
+ import math
3
+ import numpy as np
4
+ import torch as t
5
+ import torch.nn as nn
6
+ import torch.nn.functional as F
7
+ from jukebox.transformer.ops import Conv1D
8
+ from jukebox.utils.checkpoint import checkpoint
9
+
10
+ def repeat(x, n, dim):
11
+ if dim == -1:
12
+ dim = len(x.shape) - 1
13
+ return x.view(int(np.prod(x.shape[:dim+1])), 1, int(np.prod(x.shape[dim+1:]))).repeat(1,n,1).view(*x.shape[:dim], n * x.shape[dim], *x.shape[dim+1:])
14
+
15
+ def get_mask(mask, q_l, kv_l, blocks, spread, device, sample, sample_t):
16
+ # returns a mask of shape 1 x 1 x q_l x kv_l or None if masking is not needed.
17
+ if mask is None or q_l == 1:
18
+ return None
19
+ offset = sample_t - q_l if sample else max(kv_l - q_l, 0)
20
+ if mask == 'autoregressive':
21
+ # Masked dense
22
+ mask = t.ones(q_l, kv_l, device=device).tril(offset)
23
+ elif mask == 'summary':
24
+ # Masked summary
25
+ mask = t.nn.functional.pad(t.ones(q_l, q_l, device=device).tril().view(q_l, blocks, q_l // blocks)[:,:-1,-kv_l//blocks:],(0,0,1,0),value=1).contiguous().view(q_l, kv_l)
26
+ elif mask == 'prime':
27
+ mask = t.ones(q_l, kv_l, device=device).tril(offset)
28
+ return mask.view(1,1,q_l,kv_l)
29
+
30
+ class FactoredAttention(nn.Module):
31
+ def __init__(self, n_in, n_ctx, n_state, n_head,
32
+ attn_dropout=0.0, resid_dropout=0.0,
33
+ scale=True, mask=False,
34
+ zero_out=False, init_scale=1.0,
35
+ checkpoint_attn=0,
36
+ attn_func=0, blocks=None, spread=None,
37
+ encoder_dims=None, prime_len=None):
38
+ super().__init__()
39
+ self.n_in = n_in
40
+ self.n_ctx = n_ctx # NOTE: n_ctx could be different within operations. This is complete n_ctx
41
+ self.n_state = n_state
42
+ assert n_state % n_head == 0
43
+ self.n_head = n_head
44
+ self.scale = scale
45
+ self.mask = mask
46
+ if attn_func == 6:
47
+ self.c_attn = Conv1D(n_in, n_state, init_scale=init_scale)
48
+ self.c_enc_kv = Conv1D(n_in, n_state * 2, init_scale=init_scale)
49
+ else:
50
+ self.c_attn = Conv1D(n_in, n_state * 3, init_scale=init_scale)
51
+ self.c_proj = Conv1D(n_state, n_in, zero_out, init_scale=init_scale)
52
+ self.attn_dropout = nn.Dropout(attn_dropout) if attn_dropout > 0.0 else lambda x: x
53
+ self.resid_dropout = nn.Dropout(resid_dropout) if resid_dropout > 0.0 else lambda x: x
54
+
55
+ # Sequence of length l is factored as [blocks, l // blocks]
56
+ self.attn_func = attn_func
57
+ self.qkv, self.attn, self.attn_mask = {
58
+ 0: (self.factored_qkv, self.dense_attn, 'autoregressive'), # Attend to all positions
59
+ 1: (self.factored_qkv, self.block_attn, 'autoregressive'), # Attend to your block
60
+ 2: (self.factored_qkv, self.transpose_block_attn, 'autoregressive'), # Attend to transpose block
61
+ 3: (self.factored_qkv, self.prev_block_attn, None), # Attend to previous block
62
+ 4: (self.factored_qkv, self.summary_attn, 'summary'), # Attend to last position of each block
63
+ 5: (self.factored_qkv, self.summary_spread_attn, 'summary'),
64
+ 6: (self.decode_qkv, self.decode_attn, None),
65
+ 7: (self.prime_qkv, self.prime_attn, 'prime')
66
+ }[attn_func] # Attend to last k position of each block
67
+
68
+ self.blocks = blocks
69
+ self.spread = spread
70
+ if blocks is not None:
71
+ assert n_ctx % blocks == 0
72
+ self.block_ctx = n_ctx // blocks
73
+ self.checkpoint_attn = checkpoint_attn # 0: None, 1: Attn after heads split, 2: Attn
74
+
75
+ self.sample_t = 0
76
+ self.cache = {}
77
+ self.encoder_dims = encoder_dims
78
+ self.prime_len = prime_len
79
+ self.record_attn = False
80
+ self.w = None
81
+
82
+ def _attn(self, q, k, v, sample):
83
+ scale = 1. / math.sqrt(math.sqrt(self.n_state // self.n_head))
84
+ if self.training:
85
+ w = t.matmul(q * scale, k * scale)
86
+ else:
87
+ w = t.matmul(q, k)
88
+ w.mul_(scale*scale)
89
+ wtype = w.dtype
90
+ w = w.float()
91
+ if self.mask:
92
+ # Generate appropriate mask to mask out all positions before current
93
+ # Might take up lot of memory for dense, so can cache it
94
+ mask = get_mask(self.attn_mask, q.size(-2), k.size(-1), self.blocks, self.spread, w.device, sample, self.sample_t)
95
+ if mask is not None:
96
+ #print(mask)
97
+ w = w * mask + -1e9 * (1 - mask)
98
+ w = F.softmax(w, dim=-1).type(wtype)
99
+ else:
100
+ w = F.softmax(w, dim=-1).type(wtype)
101
+ if self.record_attn:
102
+ self.w = w #.float().cpu().numpy()
103
+ if self.attn_func == 7:
104
+ # only keep music queries and lyrics keys/values
105
+ self.w = self.w[:,:,self.prime_len:,:self.prime_len]
106
+ w = self.attn_dropout(w)
107
+ a = t.matmul(w, v)
108
+ return a
109
+
110
+ def merge_heads(self, x):
111
+ x = x.permute(0, 2, 1, 3).contiguous()
112
+ new_x_shape = (*x.size()[:-2], x.size(-2) * x.size(-1))
113
+ return x.view(*new_x_shape) # in Tensorflow implem: fct merge_states
114
+
115
+ def split_heads(self, x, k=False):
116
+ new_x_shape = (*x.size()[:-1], self.n_head, x.size(-1) // self.n_head)
117
+ x = x.view(*new_x_shape) # in Tensorflow implem: fct split_states
118
+ if k:
119
+ return x.permute(0, 2, 3, 1)
120
+ else:
121
+ return x.permute(0, 2, 1, 3)
122
+
123
+ def dense_attn(self, query, key, value, sample):
124
+ query = self.split_heads(query)
125
+ key = self.split_heads(key, k=True)
126
+ value = self.split_heads(value)
127
+ if self.checkpoint_attn == 1 and not sample:
128
+ a = checkpoint(lambda q,k,v,s=sample: self._attn(q,k,v,s), (query, key, value),
129
+ (), True)
130
+ else:
131
+ a = self._attn(query,key,value,sample)
132
+ a = self.merge_heads(a)
133
+ return a
134
+
135
+ def block_attn(self, q, k, v, sample):
136
+ blocks, block_ctx = self.blocks, self.block_ctx # block_ctx is l // blocks for complete l ie l = n_ctx. Sampling has less l
137
+ bs, l, d = v.shape # For sample, q_l = 1, k_l = v_l = sample_t
138
+ if sample:
139
+ assert l == self._suff_cache_len(), f"{l} != {self._suff_cache_len()}"
140
+ return self.dense_attn(q, k, v, sample).view(bs, 1, d)
141
+ else:
142
+ ql = q.shape[1]
143
+ q = q.view(bs * ql // block_ctx, block_ctx, d)
144
+ if ql < l:
145
+ l = ql
146
+ k = k[:, -l:].contiguous()
147
+ v = v[:, -l:].contiguous()
148
+ k = k.view(bs * l // block_ctx, block_ctx, d)
149
+ v = v.view(bs * l // block_ctx, block_ctx, d)
150
+ return self.dense_attn(q, k, v, sample).view(bs, l, d)
151
+
152
+ def transpose_block_attn(self, q, k, v, sample):
153
+ blocks, block_ctx = self.blocks, self.block_ctx # block_ctx is l // blocks for complete l ie l = n_ctx. Sampling has less l
154
+ bs, l, d = v.shape # For sample, q_l = 1, k_l = v_l = sample_t
155
+ if sample:
156
+ block_l = (l - 1) % block_ctx
157
+ k = k[:,block_l::block_ctx,:]
158
+ v = v[:,block_l::block_ctx,:]
159
+ return self.dense_attn(q, k, v, sample).view(bs, 1, d)
160
+ else:
161
+ ql = q.shape[1]
162
+ q = q.view(bs, ql // block_ctx, block_ctx, d).transpose(1,2).contiguous().view(bs * block_ctx, ql // block_ctx, d)
163
+ k = k.view(bs, l // block_ctx, block_ctx, d).transpose(1,2).contiguous().view(bs * block_ctx, l // block_ctx, d)
164
+ v = v.view(bs, l // block_ctx, block_ctx, d).transpose(1,2).contiguous().view(bs * block_ctx, l // block_ctx, d)
165
+ return self.dense_attn(q, k, v, sample).view(bs, block_ctx, ql // block_ctx, d).transpose(1,2).contiguous().view(bs, ql, d)
166
+
167
+ def prev_block_attn(self, q, k, v, sample):
168
+ blocks, block_ctx = self.blocks, self.block_ctx # block_ctx is l // blocks for complete l ie l = n_ctx. Sampling has less l
169
+ bs, l, d = v.shape # For sample, q_l = 1, k_l = v_l = sample_t
170
+ if sample:
171
+ assert l == self._suff_cache_len(), f"{l} != {self._suff_cache_len()}"
172
+ block = (l - 1) // block_ctx
173
+ prev_l = (block - 1) * block_ctx
174
+ if block > 0:
175
+ assert prev_l == 0
176
+ k = k[:, prev_l:prev_l + block_ctx, :]
177
+ v = v[:, prev_l:prev_l + block_ctx, :]
178
+ else:
179
+ k = t.zeros(bs, block_ctx, d, device=q.device, dtype=q.dtype)
180
+ v = t.zeros(bs, block_ctx, d, device=q.device, dtype=q.dtype)
181
+ return self.dense_attn(q, k, v, sample).view(bs, 1, d)
182
+ else:
183
+ ql = q.shape[1]
184
+ q = q.view(bs * ql // block_ctx, block_ctx, d)
185
+ k = t.nn.functional.pad(k.view(bs, l // block_ctx, block_ctx, d)[:, :-1, :, :], (0,0,0,0,1,0)).view(bs * l // block_ctx, block_ctx, d)
186
+ v = t.nn.functional.pad(v.view(bs, l // block_ctx, block_ctx, d)[:, :-1, :, :], (0,0,0,0,1,0)).view(bs * l // block_ctx, block_ctx, d)
187
+ if ql < l:
188
+ qb = ql // block_ctx
189
+ kb = l // block_ctx
190
+ l = ql
191
+ k = k.view(bs, kb, block_ctx, d)[:, -qb:].contiguous().view(bs * qb, block_ctx, d)
192
+ v = v.view(bs, kb, block_ctx, d)[:, -qb:].contiguous().view(bs * qb, block_ctx, d)
193
+ return self.dense_attn(q, k, v, sample).view(bs, l, d)
194
+
195
+ def summary_attn(self, q, k, v, sample):
196
+ blocks, block_ctx = self.blocks, self.block_ctx # block_ctx is l // blocks for complete l ie l = n_ctx. Sampling has less l
197
+ bs, l, d = v.shape # For sample, q_l = 1, k_l = v_l = sample_t
198
+ if sample:
199
+ k = t.nn.functional.pad(k[:, block_ctx-1:blocks*block_ctx-1:block_ctx, :],(0,0,1,0))
200
+ v = t.nn.functional.pad(v[:, block_ctx-1:blocks*block_ctx-1:block_ctx, :],(0,0,1,0))
201
+ return self.dense_attn(q, k, v, sample).view(bs, 1, d)
202
+ else:
203
+ k = t.nn.functional.pad(k.view(bs, blocks, l // blocks, d)[:, :-1, -1, :],(0,0,1,0)) # bs, blocks, d
204
+ v = t.nn.functional.pad(v.view(bs, blocks, l // blocks, d)[:, :-1, -1, :],(0,0,1,0)) # bs, blocks, d
205
+ return self.dense_attn(q, k, v, sample).view(bs, l, d)
206
+
207
+ def summary_spread_attn(self, q, k, v, sample):
208
+ blocks, block_ctx, spread = self.blocks, self.block_ctx, self.spread # block_ctx is l // blocks for complete l ie l = n_ctx. Sampling has less l
209
+ bs, l, d = v.shape # For sample, q_l = 1, k_l = v_l = sample_t
210
+ if sample:
211
+ assert False, "Not yet implemented"
212
+ # k = t.nn.functional.pad(k,(0,0,block_ctx,(-l)%block_ctx)).view(bs, -1, block_ctx, d)[:,:-1,-spread:,:].contiguous().view(bs, -1, d)
213
+ # v = t.nn.functional.pad(v,(0,0,block_ctx,(-l)%block_ctx)).view(bs, -1, block_ctx, d)[:,:-1,-spread:,:].contiguous().view(bs, -1, d)
214
+ # return self.dense_attn(q, k, v, sample).view(bs, 1, d)
215
+ else:
216
+ k = t.nn.functional.pad(k.view(bs, blocks, l // blocks, d)[:, :-1, -spread:, :],(0,0,0,0,1,0)).contiguous().view(bs, blocks * spread, d) # bs, blocks * spread, d
217
+ v = t.nn.functional.pad(v.view(bs, blocks, l // blocks, d)[:, :-1, -spread:, :],(0,0,0,0,1,0)).contiguous().view(bs, blocks * spread, d) # bs, blocks * spread, d
218
+ return self.dense_attn(q, k, v, sample).view(bs, l, d)
219
+
220
+ def prime_attn(self, q, k, v, sample):
221
+ prime_len = self._prime_len
222
+ k = k[:, :prime_len]
223
+ v = v[:, :prime_len]
224
+ return self.dense_attn(q, k, v, sample)
225
+
226
+ def decode_attn(self, q, k, v, sample):
227
+ assert k.shape[1] == v.shape[1] == self.encoder_dims, f'k: {k.shape}, v: {v.shape}, enc_dims: {self.encoder_dims}'
228
+ return self.dense_attn(q, k, v, sample)
229
+
230
+ def factored_qkv(self, x, encoder_kv=None, sample=False):
231
+ curr_ctx = x.shape[1]
232
+ assert encoder_kv is None
233
+ query, key, value = x.chunk(3, dim=2)
234
+ if sample:
235
+ self.sample_t += curr_ctx
236
+ key, value = self._append_cache(key, value)
237
+ l_cache = self._suff_cache_len()
238
+ if self._cache_len() > l_cache:
239
+ self._slice_cache(-l_cache)
240
+ if curr_ctx > 1:
241
+ if self.attn_func != 0:
242
+ query = self._pad_to_block_ctx(query, query=True)
243
+ key = self._pad_to_block_ctx(key)
244
+ value = self._pad_to_block_ctx(value)
245
+ assert key.shape[1] % self.block_ctx == 0
246
+ assert query.shape[1] % self.block_ctx == 0
247
+ assert key.shape[1] == value.shape[1]
248
+ assert query.shape[1] <= key.shape[1]
249
+ sample = False
250
+ else:
251
+ key = self.cache['key']
252
+ value = self.cache['value']
253
+ return query, key, value, sample
254
+
255
+ def prime_qkv(self, x, encoder_kv=None, sample=False):
256
+ curr_ctx = x.shape[1]
257
+ assert encoder_kv is None
258
+ query, key, value = x.chunk(3, dim=2)
259
+ if sample:
260
+ if self._cache_len() < self._prime_len:
261
+ self._append_cache(key, value)
262
+ if self._cache_len() > self._prime_len:
263
+ self._slice_cache(0, self._prime_len)
264
+ key, value = self.cache['key'], self.cache['value']
265
+ self.sample_t += curr_ctx
266
+ assert key.shape[1] == value.shape[1] == self._suff_cache_len(), f'k: {key.shape}, v: {value.shape}, prime_dims: {self._suff_cache_len()}'
267
+ else:
268
+ assert key.shape[1] == value.shape[1] == self.n_ctx, f'k: {key.shape}, v: {value.shape}, prime_dims: {self.n_ctx}'
269
+ assert key.shape[0] == value.shape[0] == query.shape[0], f'k: {key.shape}, v: {value.shape}, q: {query.shape}'
270
+ assert key.shape[2] == value.shape[2] == query.shape[2], f'k: {key.shape}, v: {value.shape}, q: {query.shape}'
271
+ return query, key, value, sample
272
+
273
+ def decode_qkv(self, x, encoder_kv=None, sample=False):
274
+ curr_ctx = x.shape[1]
275
+ assert encoder_kv is not None
276
+ query = x
277
+ if sample:
278
+ if self.sample_t == 0:
279
+ self.cache['key'], self.cache['value'] = self.c_enc_kv(encoder_kv.type_as(x)).chunk(2, dim=2)
280
+ key, value = self.cache['key'], self.cache['value']
281
+ self.sample_t += curr_ctx
282
+ else:
283
+ key, value = self.c_enc_kv(encoder_kv.type_as(x)).chunk(2, dim=2)
284
+ assert key.shape[0] == value.shape[0] == query.shape[0], f'k: {key.shape}, v: {value.shape}, q: {query.shape}'
285
+ assert key.shape[1] == value.shape[1] == self.encoder_dims, f'k: {key.shape}, v: {value.shape}, enc_dims: {self.encoder_dims}'
286
+ assert key.shape[2] == value.shape[2] == query.shape[2], f'k: {key.shape}, v: {value.shape}, q: {query.shape}'
287
+ return query, key, value, sample
288
+
289
+ def forward(self, x, encoder_kv=None, sample=False):
290
+ curr_ctx = x.shape[1]
291
+ x = self.c_attn(x)
292
+ query, key, value, sample = self.qkv(x, encoder_kv=encoder_kv, sample=sample)
293
+ if self.checkpoint_attn == 2 and not sample:
294
+ a = checkpoint(lambda q,k,v,s=sample: self.attn(q,k,v,s), (query, key, value), (), True)
295
+ else:
296
+ a = self.attn(query,key,value,sample)
297
+ if a.shape[1] != curr_ctx:
298
+ offset = self._offset(curr_ctx)
299
+ a = a[:,offset:offset + curr_ctx,:].contiguous()
300
+ a = self.c_proj(a)
301
+ return self.resid_dropout(a)
302
+
303
+ @property
304
+ def _prime_len(self):
305
+ prime_len = self.prime_len
306
+ assert prime_len is not None
307
+ prime_blocks = (prime_len // self.blocks) + 1
308
+ return prime_blocks * self.blocks
309
+
310
+ def _offset(self, curr_ctx):
311
+ if self.attn_func == 0:
312
+ return 0
313
+ return (self.sample_t - curr_ctx) % self.block_ctx
314
+
315
+ def _pad_to_block_ctx(self, x, query=False):
316
+ l = x.shape[1]
317
+ offset = self._offset(l) if query else 0
318
+ n_blocks = (l + offset + self.block_ctx - 1) // self.block_ctx
319
+ pad = n_blocks * self.block_ctx - l - offset
320
+ if pad == 0 and offset == 0:
321
+ return x
322
+ else:
323
+ return F.pad(x, (0, 0, offset, pad))
324
+
325
+ def _cache_len(self):
326
+ return 0 if 'key' not in self.cache else self.cache['key'].shape[1]
327
+
328
+ def _suff_cache_len(self):
329
+ """
330
+ Precondition:
331
+ key and value are appended with the current context and
332
+ self.sample_t reflects the 1-indexed sample location in the
333
+ context.
334
+ """
335
+ if self.attn_func == 0:
336
+ return self.sample_t
337
+ elif self.attn_func == 1:
338
+ return (self.sample_t - 1) % self.block_ctx + 1
339
+ elif self.attn_func == 2:
340
+ return self.sample_t
341
+ elif self.attn_func == 3:
342
+ if self.sample_t <= self.block_ctx:
343
+ return self.sample_t
344
+ else:
345
+ curr_block = (self.sample_t - 1) % self.block_ctx + 1
346
+ prev_block = self.block_ctx
347
+ return curr_block + prev_block
348
+ elif self.attn_func == 6:
349
+ return self.encoder_dims
350
+ elif self.attn_func == 7:
351
+ return min(self.sample_t, self._prime_len)
352
+ else:
353
+ raise NotImplementedError()
354
+
355
+ def _slice_cache(self, start, end=None):
356
+ self.cache['key'] = self.cache['key'][:, start:end]
357
+ self.cache['value'] = self.cache['value'][:, start:end]
358
+
359
+ def _append_cache(self, key, value):
360
+ if 'key' not in self.cache:
361
+ self.cache['key'] = key
362
+ self.cache['value'] = value
363
+ else:
364
+ old_key, old_value = key, value
365
+ key = t.cat([self.cache['key'], key], dim=1)
366
+ value = t.cat([self.cache['value'], value], dim=1)
367
+ del self.cache['key']
368
+ del self.cache['value']
369
+ del old_key
370
+ del old_value
371
+ self.cache['key'] = key
372
+ self.cache['value'] = value
373
+ return self.cache['key'], self.cache['value']
374
+
375
+ def del_cache(self):
376
+ self.sample_t = 0
377
+ if 'key' in self.cache:
378
+ del self.cache['key']
379
+ if 'value' in self.cache:
380
+ del self.cache['value']
381
+ self.cache = {}
382
+
383
+ def check(self):
384
+ blocks = self.blocks or 1
385
+ spread = self.spread or 1
386
+ bs, l, d = (4, self.n_ctx, self.n_in)
387
+ x = t.randn(bs, l, d).cuda()
388
+ x.requires_grad = True
389
+ x_out = self.forward(x) # bs, l, d
390
+ loss = x_out.mean(dim = -1) # bs, l
391
+ pos = 60
392
+ grad = t.autograd.grad(loss[2, pos], x)[0]
393
+
394
+ assert grad.shape == (bs, l, d)
395
+ assert (grad[:2] == 0).all()
396
+ assert (grad[3:] == 0).all()
397
+ assert (grad[2, (pos + 1):] == 0).all()
398
+ pos_grad = (t.sum(grad[2] ** 2, dim=-1) > 0).nonzero().view(-1).cpu()
399
+
400
+ block_pos = pos - (pos % (l // blocks))
401
+ exp_pos_grad = {0: t.arange(pos),
402
+ 1: t.arange(block_pos, pos),
403
+ 2: t.arange(pos % (l // blocks), pos, l // blocks),
404
+ 3: t.arange(block_pos - l // blocks, block_pos),
405
+ 4: t.arange(l // blocks - 1, pos, l // blocks),
406
+ 5: ((t.arange(pos) % (l // blocks) >= (l // blocks - spread)) & (t.arange(pos) < block_pos)).nonzero().view(-1)}[self.attn_func]
407
+ exp_pos_grad = t.cat([exp_pos_grad, t.tensor([pos])], dim=-1)
408
+
409
+ assert (len(pos_grad) == len(exp_pos_grad)) and (pos_grad == exp_pos_grad).all(), \
410
+ f"Expected pos grad {exp_pos_grad} got {pos_grad} for attn_func {self.attn_func} pos {pos} l {l} blocks {blocks}"
411
+
412
+ def check_cache(self, n_samples, sample_t, fp16):
413
+ assert self.sample_t == sample_t, f"{self.sample_t} != {sample_t}"
414
+ if sample_t == 0:
415
+ assert self.cache == {}
416
+ else:
417
+ dtype = {True: t.float16, False: t.float32}[fp16]
418
+ l_cache = self._suff_cache_len()
419
+ assert self.cache['key'].shape == (n_samples, l_cache, self.n_state)
420
+ assert self.cache['value'].shape == (n_samples, l_cache, self.n_state)
421
+ assert self.cache['key'].dtype == dtype, f"Expected {dtype}, got {self.cache['key'].dtype}"
422
+ assert self.cache['value'].dtype == dtype, f"Expected {dtype}, got {self.cache['value'].dtype}"
423
+
424
+ def check_sample(self):
425
+ t.manual_seed(42)
426
+ bs, l, d = (4, self.n_ctx, self.n_in)
427
+ prime = 5
428
+ x = t.randn(bs, l, d).cuda()
429
+ xs = t.chunk(x, l, dim=1)
430
+ assert self.sample_t == 0
431
+ assert self.cache == {}
432
+
433
+ with t.no_grad():
434
+ enc_l = self.encoder_dims
435
+ encoder_kv = None
436
+ if self.attn_func == 6:
437
+ encoder_kv = t.randn(bs, enc_l, d).cuda()
438
+
439
+ # Normal path
440
+ x_out_normal = self.forward(x, encoder_kv=encoder_kv)
441
+
442
+ # Sampling path
443
+ x_out_sample = t.cat([self.forward(xs[i], encoder_kv=encoder_kv, sample=True) for i in range(l)],dim=1)
444
+ max_err = t.max(t.abs(x_out_sample - x_out_normal))
445
+ assert max_err < 1e-8, f"Max sampling err is {max_err} {[i for i in range(l) if t.max(t.abs(x_out_sample - x_out_normal)[:,i,:]) > 1e-8]}"
446
+
447
+ with t.no_grad():
448
+ x_out_normal = x_out_normal[:,:prime,:]
449
+ # Prime sampling path
450
+ self.del_cache()
451
+ x_out_sample = self.forward(x[:,:prime,:].contiguous(), encoder_kv=encoder_kv, sample=True)
452
+ self.check_cache(bs, prime, False)
453
+
454
+ max_err = t.max(t.abs(x_out_sample - x_out_normal))
455
+ assert max_err < 1e-8, f"Max prime sampling err is {max_err} {[i for i in range(prime) if t.max(t.abs(x_out_sample - x_out_normal)[:,i,:]) > 1e-8]}"
456
+
457
+ def check_chunks(self, chunk_size):
458
+ t.manual_seed(42)
459
+ bs, l, d = (4, self.n_ctx, self.n_in)
460
+ enc_l = self.encoder_dims
461
+ assert l % chunk_size == 0
462
+ n_chunks = l // chunk_size
463
+ with t.no_grad():
464
+ encoder_kv = None
465
+ x = t.randn(bs, l, d).cuda()
466
+ if self.attn_func == 6:
467
+ encoder_kv = t.randn(bs, enc_l, d).cuda()
468
+
469
+ self.del_cache()
470
+ y_forw = self.forward(x, encoder_kv=encoder_kv, sample=False)
471
+ self.del_cache()
472
+ y_forw_sample = self.forward(x, encoder_kv=encoder_kv, sample=True)
473
+ max_err = t.max(t.abs(y_forw - y_forw_sample))
474
+ assert max_err <= 1e-6, f"Max err is {max_err} {[i for i in range(l) if t.max(t.abs(y_forw - y_forw_sample)[:, i, :]) > 1e-6]}"
475
+
476
+ self.del_cache()
477
+ x_chunks = t.chunk(x, n_chunks, dim=1)
478
+ y_chunks = []
479
+ total_len = 0
480
+ for x_chunk in x_chunks:
481
+ y_chunk = self.forward(x_chunk.contiguous(), encoder_kv=encoder_kv, sample=True)
482
+ total_len += x_chunk.shape[1]
483
+ self.check_cache(bs, total_len, False)
484
+ y_chunks.append(y_chunk)
485
+ y_forw_in_chunks = t.cat(y_chunks, dim=1)
486
+
487
+ max_err = t.max(t.abs(y_forw - y_forw_in_chunks))
488
+ assert max_err <= 1e-6, f"Max err is {max_err} {[i for i in range(l) if t.max(t.abs(y_forw - y_forw_in_chunks)[:, i, :]) > 1e-6]}"
489
+
490
+
491
+ if __name__ == '__main__':
492
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
493
+ setup_dist_from_mpi(port=29600)
494
+ n_in = 16
495
+ n_state = n_in * 2
496
+ n_ctx = 6144
497
+ n_head = 4
498
+ n_depth = 12
499
+ blocks = 64
500
+ chunk_size = 8
501
+ for attn_func in [0, 1, 2, 3, 6, 7]:
502
+ encoder_dims = {0: 0, 1: 0, 2: 0, 3: 0, 6: 64, 7: 0}[attn_func]
503
+ prime_len = {0: 0, 1: 0, 2: 0, 3: 0, 6: 0, 7: 384}[attn_func]
504
+ attn = FactoredAttention(n_in, n_ctx + prime_len, n_state, n_head, mask=True,
505
+ attn_func=attn_func, blocks=blocks,
506
+ encoder_dims=encoder_dims, prime_len=prime_len)
507
+ attn.training = False
508
+ attn.check_sample()
509
+ attn.check_chunks(chunk_size)
510
+ print(f"Checked attn_func: {attn_func}")
jukebox/transformer/ops.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import numpy as np
3
+ import torch as t
4
+ import torch.nn as nn
5
+ import torch.nn.functional as F
6
+
7
+ # Import FusedLayerNorm if we have apex, otherwise use regular LayerNorm
8
+ try:
9
+ from apex.normalization import FusedLayerNorm
10
+ print("Using apex FusedLayerNorm")
11
+ except ImportError:
12
+ from torch.nn import LayerNorm as FusedLayerNorm
13
+
14
+ class LayerNorm(FusedLayerNorm):
15
+ def __init__(self, normalized_shape, eps=1e-5, elementwise_affine=True):
16
+ super().__init__(normalized_shape, eps=eps, elementwise_affine=elementwise_affine)
17
+ self.width = np.prod(normalized_shape)
18
+ self.max_numel = 65535*self.width
19
+
20
+ def forward(self, input):
21
+ if input.numel() > self.max_numel:
22
+ return F.layer_norm(input.float(), self.normalized_shape, self.weight, self.bias, self.eps).type_as(input)
23
+ else:
24
+ return super(LayerNorm, self).forward(input.float()).type_as(input)
25
+
26
+ def gelu(x):
27
+ return 0.5 * x * (1 + t.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * t.pow(x, 3))))
28
+
29
+
30
+ def swish(x):
31
+ return x * t.sigmoid(x)
32
+
33
+ @t.jit.script
34
+ def quick_gelu(x):
35
+ return x * t.sigmoid(1.702 * x)
36
+
37
+ @t.jit.script
38
+ def quick_gelu_bwd(x, grad_output):
39
+ sig = t.sigmoid(1.702 * x)
40
+ return grad_output * sig * (1.702 * x * (1 - sig) + 1.)
41
+
42
+ class QuickGelu(t.autograd.Function):
43
+ @staticmethod
44
+ def forward(ctx, x):
45
+ ctx.save_for_backward(x)
46
+ return quick_gelu(x)
47
+
48
+ @staticmethod
49
+ def backward(ctx, grad_output):
50
+ return quick_gelu_bwd(ctx.saved_tensors[0], grad_output)
51
+
52
+ def memory_efficient_quick_gelu(x):
53
+ return QuickGelu.apply(x)
54
+
55
+ ACT_FNS = {
56
+ 'relu': t.nn.functional.relu,
57
+ 'swish': swish,
58
+ 'gelu': gelu,
59
+ 'quick_gelu': memory_efficient_quick_gelu #quick_gelu
60
+ }
61
+
62
+ def _move_to_gpu_and_convert_conv_weights_to_fp16(l):
63
+ l.cuda()
64
+ if isinstance(l, Conv1D):
65
+ l.w.data = l.w.data.half()
66
+
67
+ def _convert_conv_weights_to_fp32(l):
68
+ if isinstance(l, Conv1D):
69
+ l.w.data = l.w.data.float()
70
+
71
+ def _convert_conv_weights_to_fp16(l):
72
+ if isinstance(l, Conv1D):
73
+ l.w.data = l.w.data.half()
74
+
75
+ def _convert_embedding_weights_to_fp16(l):
76
+ if isinstance(l, t.nn.Embedding):
77
+ l.weight.data = l.weight.data.half()
78
+
79
+ def _convert_embedding_weights_to_fp32(l):
80
+ if isinstance(l, t.nn.Embedding):
81
+ l.weight.data = l.weight.data.float()
82
+
83
+ class Conv1D(nn.Module):
84
+ def __init__(self, n_in, n_out, zero_out=False, init_scale=1.0):
85
+ super(Conv1D, self).__init__()
86
+ self.n_in = n_in
87
+ self.n_out = n_out
88
+ if zero_out:
89
+ w = t.zeros(n_in, n_out)
90
+ else:
91
+ w = t.empty(n_in, n_out)
92
+ nn.init.normal_(w, std=0.02 * init_scale)
93
+ b = t.zeros(n_out)
94
+ self.w = nn.Parameter(w)
95
+ self.b = nn.Parameter(b)
96
+
97
+ def forward(self, x):
98
+ size_out = (*x.size()[:-1], self.n_out)
99
+ x = t.addmm(self.b.type_as(x), x.view(-1, x.size(-1)), self.w.type_as(x)) # If x if float then float else half
100
+ x = x.view(*size_out)
101
+ return x
102
+
103
+ # For large contexts, mask's can take up memory, so you can make a single saved mask for all layers
104
+ class Mask(nn.Module):
105
+ def __init__(self, n_ctx):
106
+ super().__init__()
107
+ self.register_buffer('b', t.tril(t.ones(n_ctx, n_ctx)).view(1, 1, n_ctx, n_ctx))
108
+
109
+ def forward(self, w):
110
+ w = w * self.b + -1e9 * (1 - self.b) # For fp16 do w = w.float().masked_fill(self.b, float('-inf')
111
+ return w
112
+
113
+ def filter_logits(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')):
114
+ """ Filter a distribution of logits using top-k and/or nucleus (top-p) filtering
115
+ Args:
116
+ logits: logits distribution shape (vocabulary size)
117
+ top_k >0: keep only top k tokens with highest probability (top-k filtering).
118
+ top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering).
119
+ """
120
+ #assert logits.dim() == 2 # batch size 1 for now - could be updated for more but the code would be less clear
121
+ logits = logits.clone()
122
+ top_k = min(top_k, logits.size(-1)) # Safety check
123
+ assert (top_k == 0) or (top_p == 0.0)
124
+ if top_k > 0:
125
+ # Remove all tokens with a probability less than the last token of the top-k
126
+ indices_to_remove = logits < t.topk(logits, top_k, dim=-1)[0][..., -1:]
127
+ logits[indices_to_remove] = filter_value
128
+
129
+ if top_p > 0.0:
130
+ sorted_logits, sorted_indices = t.sort(logits, descending=True, dim=-1)
131
+ cumulative_probs = t.cumsum(F.softmax(sorted_logits, dim=-1), dim=-1)
132
+
133
+ # Remove tokens with cumulative probability above the threshold
134
+ sorted_indices_to_remove = cumulative_probs > top_p
135
+ # Shift the indices to the right to keep also the first token above the threshold
136
+ sorted_indices_to_remove[..., 1:] = sorted_indices_to_remove[..., :-1].clone()
137
+ sorted_indices_to_remove[..., 0] = 0
138
+
139
+ #indices_to_remove = sorted_indices[sorted_indices_to_remove]
140
+ indices_to_remove = t.zeros_like(logits, dtype=t.uint8).scatter_(dim=-1, index=sorted_indices, src=sorted_indices_to_remove)
141
+ logits[indices_to_remove] = filter_value
142
+ return logits
jukebox/transformer/transformer.py ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import functools
2
+ import numpy as np
3
+ import torch as t
4
+ import torch.nn as nn
5
+ import jukebox.utils.dist_adapter as dist
6
+
7
+ from jukebox.transformer.ops import Conv1D, ACT_FNS, LayerNorm
8
+ from jukebox.transformer.factored_attention import FactoredAttention
9
+ from jukebox.utils.checkpoint import checkpoint
10
+
11
+ def _convert_mlp_traced(l):
12
+ if isinstance(l, ResAttnBlock):
13
+ l.mlp = t.jit.trace(l.mlp, t.randn(1, 1, l.n_in).cuda())
14
+
15
+ def _convert_mlp_traced_fp16(l):
16
+ if isinstance(l, ResAttnBlock):
17
+ l.mlp = t.jit.trace(l.mlp, t.randn(1, 1, l.n_in).cuda().half())
18
+
19
+ class MLP(nn.Module):
20
+ def __init__(self, n_in, n_state, resid_dropout=0.0, afn='quick_gelu', zero_out=False, init_scale=1.0):
21
+ super().__init__()
22
+ self.c_fc = Conv1D(n_in, n_state, init_scale=init_scale)
23
+ self.c_proj = Conv1D(n_state, n_in, zero_out, init_scale=init_scale)
24
+ self.act = ACT_FNS[afn]
25
+ self.resid_dropout = nn.Dropout(resid_dropout) if resid_dropout > 0.0 else lambda x: x
26
+
27
+ def forward(self, x):
28
+ m = self.act(self.c_fc(x))
29
+ m = self.c_proj(m)
30
+ return self.resid_dropout(m)
31
+
32
+ class ResAttnBlock(nn.Module):
33
+ def __init__(self, n_in, n_ctx, n_head,
34
+ attn_dropout=0.0, resid_dropout=0.0,
35
+ afn='quick_gelu', scale=True, mask=False,
36
+ zero_out=False, init_scale=1.0, res_scale=1.0,
37
+ m_attn = 0.25, m_mlp = 1.,
38
+ checkpoint_attn = 0, checkpoint_mlp = 0,
39
+ attn_func=0, blocks=None, spread=None,
40
+ encoder_dims=None, prime_len=None):
41
+ super().__init__()
42
+ self.attn = FactoredAttention(n_in=n_in, n_ctx=n_ctx, n_state=int(m_attn * n_in), n_head=n_head,
43
+ attn_dropout=attn_dropout, resid_dropout=resid_dropout,
44
+ scale=scale, mask=mask,
45
+ zero_out=zero_out, init_scale=init_scale,
46
+ checkpoint_attn=checkpoint_attn,
47
+ attn_func=attn_func, blocks=blocks, spread=spread,
48
+ encoder_dims=encoder_dims, prime_len=prime_len)
49
+ self.ln_0 = LayerNorm(n_in)
50
+ self.mlp = MLP(n_in=n_in, n_state=int(m_mlp * n_in),
51
+ resid_dropout=resid_dropout,
52
+ afn=afn,
53
+ zero_out=zero_out, init_scale=init_scale)
54
+ self.ln_1 = LayerNorm(n_in)
55
+ self.res_scale = res_scale
56
+
57
+ self.checkpoint_attn = checkpoint_attn
58
+ self.checkpoint_mlp = checkpoint_mlp
59
+ self.n_in = n_in
60
+ self.attn_func = attn_func
61
+
62
+ def forward(self, x, encoder_kv, sample=False):
63
+ if sample:
64
+ a = self.attn(self.ln_0(x), encoder_kv, sample)
65
+ m = self.mlp(self.ln_1(x + a))
66
+ else:
67
+ if self.attn_func == 6:
68
+ assert encoder_kv is not None
69
+ a = checkpoint(lambda _x,_enc_kv,_s=sample: self.attn(self.ln_0(_x),_enc_kv,_s),
70
+ (x,encoder_kv),
71
+ (*self.attn.parameters(), *self.ln_0.parameters()),
72
+ self.checkpoint_attn == 3) # 2 recomputes after the projections, and 1 recomputes after head splitting.
73
+ else:
74
+ assert encoder_kv is None
75
+ a = checkpoint(lambda _x,_enc_kv=None,_s=sample: self.attn(self.ln_0(_x),_enc_kv,_s),
76
+ (x,),
77
+ (*self.attn.parameters(), *self.ln_0.parameters()),
78
+ self.checkpoint_attn == 3) # 2 recomputes after the projections, and 1 recomputes after head splitting.
79
+ m = checkpoint(lambda _x: self.mlp(self.ln_1(_x)), (x + a,),
80
+ (*self.mlp.parameters(), *self.ln_1.parameters()),
81
+ self.checkpoint_mlp == 1)
82
+ if self.res_scale == 1.0:
83
+ h = x + a + m
84
+ else:
85
+ h = x + self.res_scale * (a + m)
86
+ return h
87
+
88
+ class Transformer(nn.Module):
89
+ def __init__(self, n_in, n_ctx, n_head, n_depth,
90
+ attn_dropout=0.0, resid_dropout=0.0,
91
+ afn='quick_gelu', scale=True, mask=False,
92
+ zero_out=False, init_scale=1.0, res_scale=False,
93
+ m_attn=0.25, m_mlp=1.,
94
+ checkpoint_attn=0, checkpoint_mlp=0, checkpoint_res=0,
95
+ attn_order=0, blocks=None, spread=None,
96
+ encoder_dims=None, prime_len=None):
97
+ super().__init__()
98
+ self.n_in = n_in
99
+ self.n_ctx = n_ctx
100
+ self.encoder_dims = encoder_dims
101
+ self.blocks = blocks
102
+ if blocks is not None:
103
+ assert n_ctx % blocks == 0
104
+ self.block_ctx = n_ctx // blocks
105
+ self.prime_len = prime_len
106
+ self.n_head = n_head
107
+
108
+ res_scale = 1.0 / n_depth if res_scale else 1.0
109
+
110
+ # Orders of attn_func
111
+ attn_func = {0: lambda d: 0, # Complete dense attn
112
+ 1: lambda d: [1,2][d%2], # Alternate row and column attn
113
+ 2: lambda d: [1,2,3][d % 3], # Alternate row, column and previous row attn
114
+ 3: lambda d: [1,4][d % 2], # Alternate row and last column
115
+ 4: lambda d: [1,5][d % 2], # Alternate row and last k columns
116
+ 5: lambda d: [1,4,1,1][d % 4], # Alternate row, last column, row, row
117
+ 6: lambda d: [1,2,3,6][d % 4],
118
+ 7: lambda d: [*[1,2,3]*5,6][d%16],
119
+ 8: lambda d: [1,2,3,1,2,3,1,2,3,6][d%10], # Used by separated_enc_dec model with lyrics
120
+ 9: lambda d: [1,2,3,0][d % 4],
121
+ 10: lambda d: [*[1,2,3,1,2,3,1,2,3],*[1,2,3,1,2,3,1,2,3,6]*7][d%79], # Used by large separated_enc_dec model with lyrics
122
+ 11: lambda d: [6,6,0][d%3] if d%16 == 15 else [1,2,3][d%3],
123
+ 12: lambda d: [7,7,0][d%3] if d%16 == 15 else [1,2,3][d%3], # Used by single_enc_dec model with lyrics
124
+ }[attn_order]
125
+
126
+ attn_cycle = {0:1, 1:2, 2:3, 3:2, 4:2, 5:4, 6:4, 7:16, 8:10, 9:4, 10:79, 11:16, 12:16}[attn_order]
127
+ #assert n_depth % attn_cycle == 0, f'Depth {n_depth} not a multiple of cycle {attn_cycle} for attn_order {attn_order}'
128
+
129
+ attn_block = lambda d: ResAttnBlock(n_in=n_in, n_ctx=n_ctx, n_head=n_head,
130
+ attn_dropout=attn_dropout, resid_dropout=resid_dropout,
131
+ afn=afn, scale=scale, mask=mask,
132
+ zero_out=zero_out if attn_func(d) !=6 else True,
133
+ init_scale=init_scale, res_scale=res_scale,
134
+ m_attn=m_attn, m_mlp=m_mlp,
135
+ checkpoint_attn=checkpoint_attn, checkpoint_mlp=checkpoint_mlp,
136
+ attn_func=attn_func(d), blocks=blocks, spread=spread,
137
+ encoder_dims=encoder_dims, prime_len=prime_len)
138
+
139
+ self.checkpoint_res = checkpoint_res
140
+ self._attn_mods = nn.ModuleList()
141
+ for d in range(n_depth):
142
+ self._attn_mods.append(attn_block(d))
143
+ self.ws = []
144
+
145
+
146
+ def set_record_attn(self, record_attn):
147
+ """
148
+ Arguments:
149
+ record_attn (bool or set): Makes forward prop dump self-attention
150
+ softmaxes to self.ws. Either a set of layer indices indicating
151
+ which layers to store, or a boolean value indicating whether to
152
+ dump all.
153
+ """
154
+ def _should_record_attn(layer_idx):
155
+ if isinstance(record_attn, bool):
156
+ return record_attn
157
+ return layer_idx in record_attn
158
+ for i, l in enumerate(self._attn_mods):
159
+ l.attn.record_attn = _should_record_attn(i)
160
+ if record_attn:
161
+ assert self.ws == []
162
+ for l in self._attn_mods:
163
+ assert l.attn.w == None
164
+ else:
165
+ self.ws = []
166
+ for l in self._attn_mods:
167
+ l.attn.w = None
168
+
169
+ def forward(self, x, encoder_kv=None, sample=False, fp16=False, fp16_out=False):
170
+ if fp16:
171
+ x = x.half()
172
+
173
+ # Blocks
174
+ for i,l in enumerate(self._attn_mods):
175
+ if self.checkpoint_res == 1 and not sample:
176
+ if l.attn_func == 6:
177
+ assert encoder_kv is not None
178
+ f = functools.partial(l, sample=sample)
179
+ x = checkpoint(f, (x, encoder_kv), l.parameters(), True)
180
+ else:
181
+ f = functools.partial(l, encoder_kv=None, sample=sample)
182
+ x = checkpoint(f, (x,), l.parameters(), True)
183
+ else:
184
+ if l.attn_func == 6:
185
+ x = l(x, encoder_kv=encoder_kv, sample=sample)
186
+ else:
187
+ x = l(x, encoder_kv=None, sample=sample)
188
+ if l.attn.record_attn:
189
+ self.ws.append(l.attn.w)
190
+ if not fp16_out:
191
+ x = x.float()
192
+ return x
193
+
194
+ def check_cache(self, n_samples, sample_t, fp16):
195
+ for l in self._attn_mods:
196
+ l.attn.check_cache(n_samples, sample_t, fp16)
197
+
198
+ def del_cache(self):
199
+ for l in self._attn_mods:
200
+ l.attn.del_cache()
201
+
202
+ def check_sample(self):
203
+ bs, l, s, d = (4, self.n_ctx, self.encoder_dims, self.n_in)
204
+ prime = 5
205
+ with t.no_grad():
206
+ encoder_kv = t.randn(bs, s, d).cuda()
207
+ x = t.randn(bs, l, d).cuda()
208
+ y_forw = self.forward(x, encoder_kv=encoder_kv, sample=True)
209
+
210
+ self.del_cache()
211
+ x_chunks = t.chunk(x, 4, dim=1)
212
+ y_chunks = []
213
+ n = 0
214
+ for x_chunk in x_chunks:
215
+ self.check_cache(bs, n, False)
216
+ y_chunk = self.forward(x_chunk, encoder_kv=encoder_kv, sample=True)
217
+ y_chunks.append(y_chunk)
218
+ n += x_chunk.shape[1]
219
+ self.check_cache(bs, n, False)
220
+ y_forw_in_chunks = t.cat(y_chunks, dim=1)
221
+
222
+ max_err = t.max(t.abs(y_forw - y_forw_in_chunks))
223
+ assert max_err <= 1e-6, f"Max err is {max_err} {[i for i in range(l) if t.max(t.abs(y_forw - y_forw_in_chunks)[:, i, :]) > 1e-6]}"
224
+
225
+
226
+ if __name__ == '__main__':
227
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
228
+ setup_dist_from_mpi(port=29600)
229
+ n_in = 16
230
+ n_ctx = 192
231
+ n_head = 4
232
+ n_depth = 12
233
+ blocks = 16
234
+ for attn_order in [0,2,6]:
235
+ encoder_dims = {0: 0, 2: 0, 6: 64}[attn_order]
236
+ prior = Transformer(n_in, n_ctx, n_head, n_depth, mask=True, attn_order=attn_order, encoder_dims=encoder_dims, blocks=blocks).cuda()
237
+ prior.training = False
238
+ prior.check_sample()
239
+ print(f"Checked attn_order: {attn_order}")
jukebox/utils/__init__.py ADDED
File without changes
jukebox/utils/audio_utils.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import torch as t
3
+ import jukebox.utils.dist_adapter as dist
4
+ import soundfile
5
+ import librosa
6
+ from jukebox.utils.dist_utils import print_once
7
+
8
+ class DefaultSTFTValues:
9
+ def __init__(self, hps):
10
+ self.sr = hps.sr
11
+ self.n_fft = 2048
12
+ self.hop_length = 256
13
+ self.window_size = 6 * self.hop_length
14
+
15
+ class STFTValues:
16
+ def __init__(self, hps, n_fft, hop_length, window_size):
17
+ self.sr = hps.sr
18
+ self.n_fft = n_fft
19
+ self.hop_length = hop_length
20
+ self.window_size = window_size
21
+
22
+ def calculate_bandwidth(dataset, hps, duration=600):
23
+ hps = DefaultSTFTValues(hps)
24
+ n_samples = int(dataset.sr * duration)
25
+ l1, total, total_sq, n_seen, idx = 0.0, 0.0, 0.0, 0.0, dist.get_rank()
26
+ spec_norm_total, spec_nelem = 0.0, 0.0
27
+ while n_seen < n_samples:
28
+ x = dataset[idx]
29
+ if isinstance(x, (tuple, list)):
30
+ x, y = x
31
+ samples = x.astype(np.float64)
32
+ stft = librosa.core.stft(np.mean(samples, axis=1), hps.n_fft, hop_length=hps.hop_length, win_length=hps.window_size)
33
+ spec = np.absolute(stft)
34
+ spec_norm_total += np.linalg.norm(spec)
35
+ spec_nelem += 1
36
+ n_seen += int(np.prod(samples.shape))
37
+ l1 += np.sum(np.abs(samples))
38
+ total += np.sum(samples)
39
+ total_sq += np.sum(samples ** 2)
40
+ idx += max(16, dist.get_world_size())
41
+
42
+ if dist.is_available():
43
+ from jukebox.utils.dist_utils import allreduce
44
+ n_seen = allreduce(n_seen)
45
+ total = allreduce(total)
46
+ total_sq = allreduce(total_sq)
47
+ l1 = allreduce(l1)
48
+ spec_nelem = allreduce(spec_nelem)
49
+ spec_norm_total = allreduce(spec_norm_total)
50
+
51
+ mean = total / n_seen
52
+ bandwidth = dict(l2 = total_sq / n_seen - mean ** 2,
53
+ l1 = l1 / n_seen,
54
+ spec = spec_norm_total / spec_nelem)
55
+ print_once(bandwidth)
56
+ return bandwidth
57
+
58
+ def audio_preprocess(x, hps):
59
+ # Extra layer in case we want to experiment with different preprocessing
60
+ # For two channel, blend randomly into mono (standard is .5 left, .5 right)
61
+
62
+ # x: NTC
63
+ x = x.float()
64
+ if x.shape[-1]==2:
65
+ if hps.aug_blend:
66
+ mix=t.rand((x.shape[0],1), device=x.device) #np.random.rand()
67
+ else:
68
+ mix = 0.5
69
+ x=(mix*x[:,:,0]+(1-mix)*x[:,:,1])
70
+ elif x.shape[-1]==1:
71
+ x=x[:,:,0]
72
+ else:
73
+ assert False, f'Expected channels {hps.channels}. Got unknown {x.shape[-1]} channels'
74
+
75
+ # x: NT -> NTC
76
+ x = x.unsqueeze(2)
77
+ return x
78
+
79
+ def audio_postprocess(x, hps):
80
+ return x
81
+
82
+ def stft(sig, hps):
83
+ return t.stft(sig, hps.n_fft, hps.hop_length, win_length=hps.window_size, window=t.hann_window(hps.window_size, device=sig.device))
84
+
85
+ def spec(x, hps):
86
+ return t.norm(stft(x, hps), p=2, dim=-1)
87
+
88
+ def norm(x):
89
+ return (x.view(x.shape[0], -1) ** 2).sum(dim=-1).sqrt()
90
+
91
+ def squeeze(x):
92
+ if len(x.shape) == 3:
93
+ assert x.shape[-1] in [1,2]
94
+ x = t.mean(x, -1)
95
+ if len(x.shape) != 2:
96
+ raise ValueError(f'Unknown input shape {x.shape}')
97
+ return x
98
+
99
+ def spectral_loss(x_in, x_out, hps):
100
+ hps = DefaultSTFTValues(hps)
101
+ spec_in = spec(squeeze(x_in.float()), hps)
102
+ spec_out = spec(squeeze(x_out.float()), hps)
103
+ return norm(spec_in - spec_out)
104
+
105
+ def multispectral_loss(x_in, x_out, hps):
106
+ losses = []
107
+ assert len(hps.multispec_loss_n_fft) == len(hps.multispec_loss_hop_length) == len(hps.multispec_loss_window_size)
108
+ args = [hps.multispec_loss_n_fft,
109
+ hps.multispec_loss_hop_length,
110
+ hps.multispec_loss_window_size]
111
+ for n_fft, hop_length, window_size in zip(*args):
112
+ hps = STFTValues(hps, n_fft, hop_length, window_size)
113
+ spec_in = spec(squeeze(x_in.float()), hps)
114
+ spec_out = spec(squeeze(x_out.float()), hps)
115
+ losses.append(norm(spec_in - spec_out))
116
+ return sum(losses) / len(losses)
117
+
118
+ def spectral_convergence(x_in, x_out, hps, epsilon=2e-3):
119
+ hps = DefaultSTFTValues(hps)
120
+ spec_in = spec(squeeze(x_in.float()), hps)
121
+ spec_out = spec(squeeze(x_out.float()), hps)
122
+
123
+ gt_norm = norm(spec_in)
124
+ residual_norm = norm(spec_in - spec_out)
125
+ mask = (gt_norm > epsilon).float()
126
+ return (residual_norm * mask) / t.clamp(gt_norm, min=epsilon)
127
+
128
+ def log_magnitude_loss(x_in, x_out, hps, epsilon=1e-4):
129
+ hps = DefaultSTFTValues(hps)
130
+ spec_in = t.log(spec(squeeze(x_in.float()), hps) + epsilon)
131
+ spec_out = t.log(spec(squeeze(x_out.float()), hps) + epsilon)
132
+ return t.mean(t.abs(spec_in - spec_out))
133
+
134
+ def load_audio(file, sr, offset, duration, mono=False):
135
+ # Librosa loads more filetypes than soundfile
136
+ x, _ = librosa.load(file, sr=sr, mono=mono, offset=offset/sr, duration=duration/sr)
137
+ if len(x.shape) == 1:
138
+ x = x.reshape((1, -1))
139
+ return x
140
+
141
+
142
+ def save_wav(fname, aud, sr):
143
+ # clip before saving?
144
+ aud = t.clamp(aud, -1, 1).cpu().numpy()
145
+ for i in list(range(aud.shape[0])):
146
+ soundfile.write(f'{fname}/item_{i}.wav', aud[i], samplerate=sr, format='wav')
147
+
148
+
jukebox/utils/checkpoint.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Simple gradient checkpointing. Works with distributed data parallel
2
+ import torch as t
3
+
4
+ def checkpoint(func, inputs, params, flag):
5
+ if flag:
6
+ args = inputs + tuple(params)
7
+ return CheckpointFunction.apply(func, len(inputs), *args)
8
+ else:
9
+ return func(*inputs)
10
+
11
+ class CheckpointFunction(t.autograd.Function):
12
+ @staticmethod
13
+ def forward(ctx, run_function, length, *args):
14
+ ctx.run_function = run_function
15
+ ctx.input_tensors = list(args[:length])
16
+ ctx.input_params = list(args[length:])
17
+ with t.no_grad():
18
+ output_tensors = ctx.run_function(*ctx.input_tensors)
19
+ return output_tensors
20
+
21
+ @staticmethod
22
+ def backward(ctx, *output_grads):
23
+ for i in range(len(ctx.input_tensors)):
24
+ temp = ctx.input_tensors[i]
25
+ ctx.input_tensors[i] = temp.detach()
26
+ ctx.input_tensors[i].requires_grad = temp.requires_grad
27
+ with t.enable_grad():
28
+ output_tensors = ctx.run_function(*ctx.input_tensors)
29
+ input_grads = t.autograd.grad(output_tensors, ctx.input_tensors + ctx.input_params, output_grads, allow_unused=True)
30
+ del ctx.input_tensors
31
+ del output_tensors
32
+ return (None, None) + input_grads
jukebox/utils/dist_adapter.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch.distributed as dist
2
+ from enum import Enum
3
+
4
+ class ReduceOp(Enum):
5
+ SUM = 0,
6
+ PRODUCT = 1,
7
+ MIN = 2,
8
+ MAX = 3
9
+
10
+ def ToDistOp(self):
11
+ return {
12
+ self.SUM: dist.ReduceOp.SUM,
13
+ self.PRODUCT: dist.ReduceOp.PRODUCT,
14
+ self.MIN: dist.ReduceOp.MIN,
15
+ self.MAX: dist.ReduceOp.MAX
16
+ }[self]
17
+
18
+ def is_available():
19
+ return dist.is_available()
20
+
21
+ def get_rank():
22
+ if is_available():
23
+ return _get_rank()
24
+ else:
25
+ return 0
26
+
27
+ def get_world_size():
28
+ if is_available():
29
+ return _get_world_size()
30
+ else:
31
+ return 1
32
+
33
+ def barrier():
34
+ if is_available():
35
+ return _barrier()
36
+ #else: do nothing
37
+
38
+ def all_gather(tensor_list, tensor):
39
+ if is_available():
40
+ return _all_gather(tensor_list, tensor)
41
+ else:
42
+ tensor_list[0] = tensor
43
+
44
+ def all_reduce(tensor, op=ReduceOp.SUM):
45
+ if is_available():
46
+ return _all_reduce(tensor, op)
47
+ #else: do nothing
48
+
49
+ def reduce(tensor, dst, op=ReduceOp.SUM):
50
+ if is_available():
51
+ return _reduce(tensor, dst, op)
52
+ #else: do nothing
53
+
54
+ def broadcast(tensor, src):
55
+ if is_available():
56
+ return _broadcast(tensor, src)
57
+ #else: do nothing
58
+
59
+ def init_process_group(backend, init_method):
60
+ if is_available():
61
+ return _init_process_group(backend, init_method)
62
+ #else: do nothing
63
+
64
+ def _get_rank():
65
+ return dist.get_rank()
66
+
67
+ def _barrier():
68
+ return dist.barrier()
69
+
70
+ def _get_world_size():
71
+ return dist.get_world_size()
72
+
73
+ def _all_gather(tensor_list, tensor):
74
+ return dist.all_gather(tensor_list, tensor)
75
+
76
+ def _all_reduce(tensor, op):
77
+ return dist.all_reduce(tensor, op.ToDistOp())
78
+
79
+ def _reduce(tensor, dst, op):
80
+ return dist.reduce(tensor, dst, op.ToDistOp())
81
+
82
+ def _broadcast(tensor, src):
83
+ return dist.broadcast(tensor, src)
84
+
85
+ def _init_process_group(backend, init_method):
86
+ return dist.init_process_group(backend, init_method)
jukebox/utils/dist_utils.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from time import sleep
3
+ import torch
4
+ import jukebox.utils.dist_adapter as dist
5
+
6
+ def print_once(msg):
7
+ if (not dist.is_available()) or dist.get_rank()==0:
8
+ print(msg)
9
+
10
+ def print_all(msg):
11
+ if (not dist.is_available()):
12
+ print(msg)
13
+ elif dist.get_rank()%8==0:
14
+ print(f'{dist.get_rank()//8}: {msg}')
15
+
16
+ def allgather(x):
17
+ xs = [torch.empty_like(x) for _ in range(dist.get_world_size())]
18
+ dist.all_gather(xs, x)
19
+ xs = torch.cat(xs, dim=0)
20
+ return xs
21
+
22
+ def allreduce(x, op=dist.ReduceOp.SUM):
23
+ x = torch.tensor(x).float().cuda()
24
+ dist.all_reduce(x, op=op)
25
+ return x.item()
26
+
27
+ def allgather_lists(xs):
28
+ bs = len(xs)
29
+ total_bs = dist.get_world_size()*len(xs)
30
+ lengths = torch.tensor([len(x) for x in xs], dtype=t.long, device='cuda')
31
+ lengths = allgather(lengths)
32
+ assert lengths.shape == (total_bs,)
33
+ max_length = torch.max(lengths).item()
34
+
35
+ xs = torch.tensor([[*x, *[0]*(max_length - len(x))] for x in xs], device='cuda')
36
+ assert xs.shape == (bs, max_length), f'Expected {(bs, max_length)}, got {xs.shape}'
37
+ xs = allgather(xs)
38
+ assert xs.shape == (total_bs,max_length), f'Expected {(total_bs, max_length)}, got {xs.shape}'
39
+
40
+ return [xs[i][:lengths[i]].cpu().numpy().tolist() for i in range(total_bs)]
41
+
42
+ def setup_dist_from_mpi(
43
+ master_addr="127.0.0.1", backend="nccl", port=29500, n_attempts=5, verbose=False
44
+ ):
45
+ if dist.is_available():
46
+ return _setup_dist_from_mpi(master_addr, backend, port, n_attempts, verbose)
47
+ else:
48
+ use_cuda = torch.cuda.is_available()
49
+ print(f'Using cuda {use_cuda}')
50
+
51
+ mpi_rank = 0
52
+ local_rank = 0
53
+
54
+ device = torch.device("cuda", local_rank) if use_cuda else torch.device("cpu")
55
+ torch.cuda.set_device(local_rank)
56
+
57
+ return mpi_rank, local_rank, device
58
+
59
+ def _setup_dist_from_mpi(master_addr, backend, port, n_attempts, verbose):
60
+ from mpi4py import MPI # This must be imported in order to get e rrors from all ranks to show up
61
+
62
+ mpi_rank = MPI.COMM_WORLD.Get_rank()
63
+ mpi_size = MPI.COMM_WORLD.Get_size()
64
+
65
+
66
+ os.environ["RANK"] = str(mpi_rank)
67
+ os.environ["WORLD_SIZE"] = str(mpi_size)
68
+ os.environ["MASTER_ADDR"] = master_addr
69
+ os.environ["MASTER_PORT"] = str(port)
70
+ os.environ["NCCL_LL_THRESHOLD"] = "0"
71
+ os.environ["NCCL_NSOCKS_PERTHREAD"] = "2"
72
+ os.environ["NCCL_SOCKET_NTHREADS"] = "8"
73
+
74
+ # Pin this rank to a specific GPU on the node
75
+ local_rank = mpi_rank % 8
76
+ if torch.cuda.is_available():
77
+ torch.cuda.set_device(local_rank)
78
+
79
+ if verbose:
80
+ print(f"Connecting to master_addr: {master_addr}")
81
+
82
+ # There is a race condition when initializing NCCL with a large number of ranks (e.g 500 ranks)
83
+ # We guard against the failure and then retry
84
+ for attempt_idx in range(n_attempts):
85
+ try:
86
+ dist.init_process_group(backend=backend, init_method=f"env://")
87
+ assert dist.get_rank() == mpi_rank
88
+
89
+ use_cuda = torch.cuda.is_available()
90
+ print(f'Using cuda {use_cuda}')
91
+ local_rank = mpi_rank % 8
92
+ device = torch.device("cuda", local_rank) if use_cuda else torch.device("cpu")
93
+ torch.cuda.set_device(local_rank)
94
+
95
+ return mpi_rank, local_rank, device
96
+ except RuntimeError as e:
97
+ print(f"Caught error during NCCL init (attempt {attempt_idx} of {n_attempts}): {e}")
98
+ sleep(1 + (0.01 * mpi_rank)) # Sleep to avoid thundering herd
99
+ pass
100
+
101
+ raise RuntimeError("Failed to initialize NCCL")
jukebox/utils/ema.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch._utils import _flatten_dense_tensors
3
+ import numpy as np
4
+
5
+ # EMA always in float, as accumulation needs lots of bits
6
+ class EMA:
7
+ def __init__(self, params, mu=0.999):
8
+ self.mu = mu
9
+ self.state = [(p, self.get_model_state(p)) for p in params if p.requires_grad]
10
+
11
+ def get_model_state(self, p):
12
+ return p.data.float().detach().clone()
13
+
14
+ def step(self):
15
+ for p, state in self.state:
16
+ state.mul_(self.mu).add_(1 - self.mu, p.data.float())
17
+
18
+ def swap(self):
19
+ # swap ema and model params
20
+ for p, state in self.state:
21
+ other_state = self.get_model_state(p)
22
+ p.data.copy_(state.type_as(p.data))
23
+ state.copy_(other_state)
24
+
25
+
26
+ class CPUEMA:
27
+ def __init__(self, params, mu=0.999, freq=1):
28
+ self.mu = mu**freq
29
+ self.state = [(p, self.get_model_state(p)) for p in params if p.requires_grad]
30
+ self.freq = freq
31
+ self.steps = 0
32
+
33
+ def get_model_state(self, p):
34
+ with torch.no_grad():
35
+ state = p.data.float().detach().cpu().numpy()
36
+ return state
37
+
38
+ def step(self):
39
+ with torch.no_grad():
40
+ self.steps += 1
41
+ if self.steps % self.freq == 0:
42
+ for i in range(len(self.state)):
43
+ p, state = self.state[i]
44
+ state = torch.from_numpy(state).cuda()
45
+ state.mul_(self.mu).add_(1 - self.mu, p.data.float())
46
+ self.state[i] = (p, state.cpu().numpy())
47
+
48
+ def swap(self):
49
+ with torch.no_grad():
50
+ # swap ema and model params
51
+ for p, state in self.state:
52
+ other_state = self.get_model_state(p)
53
+ p.data.copy_(torch.from_numpy(state).type_as(p.data))
54
+ np.copyto(state, other_state)
55
+
56
+ class FusedEMA:
57
+ def __init__(self, params, mu=0.999):
58
+ self.mu = mu
59
+ params = list(params)
60
+ self.params = {}
61
+ self.params['fp16'] = [p for p in params if p.requires_grad and p.data.dtype == torch.float16]
62
+ self.params['fp32'] = [p for p in params if p.requires_grad and p.data.dtype != torch.float16]
63
+ self.groups = [group for group in self.params.keys() if len(self.params[group]) > 0]
64
+ self.state = {}
65
+ for group in self.groups:
66
+ self.state[group] = self.get_model_state(group)
67
+
68
+ def get_model_state(self, group):
69
+ params = self.params[group]
70
+ return _flatten_dense_tensors([p.data.float() for p in params])
71
+ # if self.fp16:
72
+ # return _flatten_dense_tensors([p.data.half() for p in self.param_group if p.dtype])
73
+ # else:
74
+ # return _flatten_dense_tensors([p.data for p in self.param_group])
75
+
76
+ def step(self):
77
+ for group in self.groups:
78
+ self.state[group].mul_(self.mu).add_(1 - self.mu, self.get_model_state(group))
79
+
80
+ def swap(self):
81
+ # swap ema and model params
82
+ for group in self.groups:
83
+ other_state = self.get_model_state(group)
84
+ state = self.state[group]
85
+ params = self.params[group]
86
+ offset = 0
87
+ for p in params:
88
+ numel = p.data.numel()
89
+ p.data = state.narrow(0, offset, numel).view_as(p.data).type_as(p.data)
90
+ offset += numel
91
+
92
+ self.state[group] = other_state
93
+
94
+
jukebox/utils/fp16.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Utils for fp16 training.
2
+ import importlib
3
+ import math
4
+ import numpy as np
5
+ import torch
6
+ import jukebox.utils.dist_adapter as dist
7
+ from torch.optim import Optimizer
8
+ from torch._utils import _flatten_dense_tensors
9
+
10
+ from jukebox.utils.dist_utils import allreduce
11
+
12
+ def adam_step(p: torch.Tensor, out_p: torch.Tensor, exp_avg: torch.Tensor, exp_avg_sq: torch.Tensor, grad: torch.Tensor,
13
+ lr: float, beta1: float, beta2: float, eps: float, scale: float, step: int, eps_mode: int, bias_correction: int, weight_decay: float):
14
+ assert bias_correction == 1
15
+ assert eps_mode == 1
16
+
17
+ grad = grad.float()
18
+ grad.div_(scale)
19
+
20
+ # Decay the first and second moment running average coefficient
21
+ exp_avg.mul_(beta1).add_(grad, alpha=1 - beta1)
22
+ exp_avg_sq.mul_(beta2).addcmul_(grad, grad, value=1 - beta2)
23
+ denom = exp_avg_sq.sqrt().add_(eps)
24
+
25
+ bias_correction1 = 1 - beta1 ** step
26
+ bias_correction2 = 1 - beta2 ** step
27
+ step_size = lr * math.sqrt(bias_correction2) / bias_correction1
28
+
29
+ p.add_(exp_avg/denom + weight_decay*p.float(), alpha=-step_size)
30
+
31
+ # Import fused_adam if we have apex, otherwise use regular adam
32
+ try:
33
+ fused_adam_cuda = importlib.import_module("fused_adam_cuda")
34
+ fused_adam_step = fused_adam_cuda.adam
35
+ print("Using apex fused_adam_cuda")
36
+ except ModuleNotFoundError:
37
+ fused_adam_step = adam_step
38
+
39
+ def backward(loss, params, scalar, fp16, logger):
40
+ # Perform backward
41
+ if not fp16:
42
+ scale = 1.0
43
+ loss.backward()
44
+ gn = grad_norm(params, scale)
45
+ return loss, scale, gn, False, False
46
+ else:
47
+ scale = scalar.get_scale()
48
+ loss = (loss.float())*scale
49
+ overflow_loss = check_overflow(loss.item())
50
+ overflow_loss = allreduce(int(overflow_loss), op=dist.ReduceOp.MAX) > 0
51
+ if not overflow_loss:
52
+ loss.backward()
53
+ gn = grad_norm(params, scale)
54
+ overflow_grad = check_overflow(gn)
55
+ overflow_grad = allreduce(int(overflow_grad), op=dist.ReduceOp.MAX) > 0
56
+ scalar.update_scale(overflow_grad)
57
+ else:
58
+ gn = 0.0
59
+ overflow_grad = True
60
+ loss = (loss.detach().float()) / scale # Should delete computation graph for overflow
61
+ if logger.rank == 0:
62
+ if loss > 12.: print(f"\nWarning. Loss is {loss}")
63
+ if overflow_loss: print(f"\nOverflow in forward. Loss {loss}, lgscale {np.log2(scale)}. Skipping batch completely (no backward, scale update)")
64
+ elif overflow_grad: print(f"\nOverflow in backward. Loss {loss}, grad norm {gn}, lgscale {np.log2(scale)}, new lgscale {np.log2(scalar.get_scale())}")
65
+ return loss, scale, gn, overflow_loss, overflow_grad
66
+
67
+ # Automatic loss scaling
68
+ class LossScalar(object):
69
+ def __init__(self,
70
+ loss_scale,
71
+ init_scale=2. ** 16,
72
+ scale_factor=2. ** (1. / 1000),
73
+ scale_window=1):
74
+ if loss_scale == None:
75
+ # Use dynamic loss scaling
76
+ self.dynamic = True
77
+ self.loss_scale = init_scale
78
+ else:
79
+ self.dynamic = False
80
+ self.loss_scale = loss_scale
81
+ self.max_loss_scale = 2.**24
82
+ self.scale_factor = scale_factor
83
+ self.scale_window = scale_window
84
+ self.unskipped = 0
85
+ self.overflow = False
86
+
87
+ def get_scale(self):
88
+ return self.loss_scale
89
+
90
+ def update_scale(self, overflow):
91
+ if overflow and self.dynamic:
92
+ self.loss_scale /= 2.
93
+ self.unskipped = 0
94
+ else:
95
+ self.unskipped += 1
96
+
97
+ if self.unskipped == self.scale_window and self.dynamic:
98
+ self.loss_scale = min(self.max_loss_scale, self.loss_scale * self.scale_factor)
99
+ self.unskipped = 0
100
+
101
+ def check_overflow(val):
102
+ return (val == float('inf')) or (val == -float('inf')) or (val != val)
103
+
104
+ def grad_norm(params, scale, flat=False):
105
+ params = list(params)
106
+ if flat:
107
+ # Faster but more memory
108
+ fp16_grads = [p.grad for p in params if p.grad is not None and p.data.dtype == torch.float16]
109
+ fp16_norm = 0.0 if len(fp16_grads) == 0 else float(_flatten_dense_tensors(fp16_grads).norm(p=2, dtype=torch.float32))
110
+ fp32_grads = [p.grad for p in params if p.grad is not None and p.data.dtype != torch.float16]
111
+ fp32_norm = 0.0 if len(fp32_grads) == 0 else float(_flatten_dense_tensors(fp32_grads).norm(p=2))
112
+ grad_norm = (fp16_norm**2 + fp32_norm**2)**0.5
113
+ else:
114
+ # Slightly slower but less memory
115
+ grad_norm = 0.0
116
+ for p in params:
117
+ if p.grad is not None:
118
+ grad_norm += p.grad.norm(p=2, dtype=torch.float32)**2
119
+ grad_norm = float(grad_norm**0.5)
120
+ return grad_norm / scale
121
+
122
+ def clipped_grad_scale(grad_norm, max_grad_norm, scale):
123
+ clip = grad_norm / max_grad_norm
124
+ if clip > 1:
125
+ scale = clip * scale
126
+ return scale
127
+
128
+ class FP16FusedAdam(Optimizer):
129
+ def __init__(
130
+ self,
131
+ params,
132
+ lr=1e-3,
133
+ bias_correction=True,
134
+ betas=(0.9, 0.999),
135
+ eps=1e-8,
136
+ eps_inside_sqrt=False,
137
+ weight_decay=0.0,
138
+ amsgrad=False,
139
+ ):
140
+ if amsgrad:
141
+ raise RuntimeError("FusedAdam does not support the AMSGrad variant.")
142
+ defaults = dict(
143
+ lr=lr, bias_correction=bias_correction, betas=betas, eps=eps, weight_decay=weight_decay
144
+ )
145
+ super(FP16FusedAdam, self).__init__(params, defaults)
146
+ self.eps_mode = 0 if eps_inside_sqrt else 1
147
+ self.FLOAT16_MAX = 65504.0
148
+ self.init_state()
149
+
150
+ def init_state(self):
151
+ for group in self.param_groups:
152
+ for p in group["params"]:
153
+ assert p.requires_grad == True
154
+ state = self.state[p]
155
+ if len(state) == 0:
156
+ state["step"] = 0
157
+ # Exponential moving average of gradient values
158
+ state["exp_avg"] = torch.zeros_like(p.data)
159
+ # Exponential moving average of squared gradient values
160
+ state["exp_avg_sq"] = torch.zeros_like(p.data)
161
+ if p.data.dtype == torch.float16:
162
+ state["scale_exp_avg"] = 1.0
163
+ state["scale_exp_avg_sq"] = 1.0
164
+
165
+ def step(self, closure=None, scale=1.0):
166
+ """Performs a single optimization step. Scales gradients down by scale
167
+ Arguments:
168
+ closure (callable, optional): A closure that reevaluates the model
169
+ and returns the loss.
170
+ scale (float, optional): factor to divide gradient tensor values
171
+ by before applying to weights. (default: 1)
172
+ """
173
+ loss = None
174
+ if closure is not None:
175
+ loss = closure()
176
+
177
+ for group in self.param_groups:
178
+ bias_correction = 1 if group["bias_correction"] else 0
179
+
180
+ for p in group["params"]:
181
+ if p.grad is None:
182
+ continue
183
+ grad = p.grad.data
184
+
185
+ state = self.state[p]
186
+
187
+ if p.data.dtype == torch.float16:
188
+ exp_avg, exp_avg_sq = (
189
+ state["exp_avg"].float() * state["scale_exp_avg"],
190
+ state["exp_avg_sq"].float() * state["scale_exp_avg_sq"],
191
+ )
192
+ else:
193
+ exp_avg, exp_avg_sq = state["exp_avg"], state["exp_avg_sq"]
194
+ beta1, beta2 = group["betas"]
195
+
196
+ state["step"] += 1
197
+
198
+ out_p = torch.tensor([], dtype=torch.float)
199
+ fused_adam_step(
200
+ p.data,
201
+ out_p,
202
+ exp_avg,
203
+ exp_avg_sq,
204
+ grad,
205
+ group["lr"],
206
+ beta1,
207
+ beta2,
208
+ group["eps"],
209
+ scale,
210
+ state["step"],
211
+ self.eps_mode,
212
+ bias_correction,
213
+ group["weight_decay"],
214
+ )
215
+
216
+ if p.data.dtype == torch.float16:
217
+ state["scale_exp_avg"] = (
218
+ 1e-8 + float(torch.norm(exp_avg, float("inf"))) / self.FLOAT16_MAX
219
+ )
220
+ state["scale_exp_avg_sq"] = (
221
+ 1e-8 + float(torch.norm(exp_avg_sq, float("inf"))) / self.FLOAT16_MAX
222
+ )
223
+ state["exp_avg"] = (exp_avg / state["scale_exp_avg"]).half()
224
+ state["exp_avg_sq"] = (exp_avg_sq / state["scale_exp_avg_sq"]).half()
225
+
226
+ return loss
227
+
228
+
229
+ class FusedAdam(Optimizer):
230
+ def __init__(
231
+ self,
232
+ params,
233
+ lr=1e-3,
234
+ bias_correction=True,
235
+ betas=(0.9, 0.999),
236
+ eps=1e-8,
237
+ eps_inside_sqrt=False,
238
+ weight_decay=0.0,
239
+ amsgrad=False,
240
+ ):
241
+ if amsgrad:
242
+ raise RuntimeError("FusedAdam does not support the AMSGrad variant.")
243
+ defaults = dict(
244
+ lr=lr, bias_correction=bias_correction, betas=betas, eps=eps, weight_decay=weight_decay
245
+ )
246
+ super(FusedAdam, self).__init__(params, defaults)
247
+ self.eps_mode = 0 if eps_inside_sqrt else 1
248
+
249
+ def step(self, closure=None, scale=1.0):
250
+ """Performs a single optimization step. Scales gradients down by scale
251
+ Arguments:
252
+ closure (callable, optional): A closure that reevaluates the model
253
+ and returns the loss.
254
+ scale (float, optional): factor to divide gradient tensor values
255
+ by before applying to weights. (default: 1)
256
+ """
257
+ loss = None
258
+ if closure is not None:
259
+ loss = closure()
260
+
261
+ for group in self.param_groups:
262
+ bias_correction = 1 if group["bias_correction"] else 0
263
+
264
+ for p in group["params"]:
265
+ if p.grad is None:
266
+ continue
267
+ grad = p.grad.data
268
+
269
+ state = self.state[p]
270
+
271
+ # State initialization
272
+ if len(state) == 0:
273
+ state["step"] = 0
274
+ # Exponential moving average of gradient values
275
+ state["exp_avg"] = torch.zeros_like(p.data).float()
276
+ # Exponential moving average of squared gradient values
277
+ state["exp_avg_sq"] = torch.zeros_like(p.data).float()
278
+
279
+ exp_avg, exp_avg_sq = state["exp_avg"], state["exp_avg_sq"]
280
+ beta1, beta2 = group["betas"]
281
+
282
+ state["step"] += 1
283
+
284
+ out_p = torch.tensor([], dtype=torch.float)
285
+ fused_adam_step(
286
+ p.data,
287
+ out_p,
288
+ exp_avg,
289
+ exp_avg_sq,
290
+ grad,
291
+ group["lr"],
292
+ beta1,
293
+ beta2,
294
+ group["eps"],
295
+ scale,
296
+ state["step"],
297
+ self.eps_mode,
298
+ bias_correction,
299
+ group["weight_decay"],
300
+ )
301
+
302
+ return loss
303
+
jukebox/utils/io.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import av
3
+ import torch as t
4
+ import jukebox.utils.dist_adapter as dist
5
+
6
+ def get_duration_sec(file, cache=False):
7
+ try:
8
+ with open(file + '.dur', 'r') as f:
9
+ duration = float(f.readline().strip('\n'))
10
+ return duration
11
+ except:
12
+ container = av.open(file)
13
+ audio = container.streams.get(audio=0)[0]
14
+ duration = audio.duration * float(audio.time_base)
15
+ if cache:
16
+ with open(file + '.dur', 'w') as f:
17
+ f.write(str(duration) + '\n')
18
+ return duration
19
+
20
+ def load_audio(file, sr, offset, duration, resample=True, approx=False, time_base='samples', check_duration=True):
21
+ if time_base == 'sec':
22
+ offset = offset * sr
23
+ duration = duration * sr
24
+ # Loads at target sr, stereo channels, seeks from offset, and stops after duration
25
+ container = av.open(file)
26
+ audio = container.streams.get(audio=0)[0] # Only first audio stream
27
+ audio_duration = audio.duration * float(audio.time_base)
28
+ if approx:
29
+ if offset + duration > audio_duration*sr:
30
+ # Move back one window. Cap at audio_duration
31
+ offset = np.min(audio_duration*sr - duration, offset - duration)
32
+ else:
33
+ if check_duration:
34
+ assert offset + duration <= audio_duration*sr, f'End {offset + duration} beyond duration {audio_duration*sr}'
35
+ if resample:
36
+ resampler = av.AudioResampler(format='fltp',layout='stereo', rate=sr)
37
+ else:
38
+ assert sr == audio.sample_rate
39
+ offset = int(offset / sr / float(audio.time_base)) #int(offset / float(audio.time_base)) # Use units of time_base for seeking
40
+ duration = int(duration) #duration = int(duration * sr) # Use units of time_out ie 1/sr for returning
41
+ sig = np.zeros((2, duration), dtype=np.float32)
42
+ container.seek(offset, stream=audio)
43
+ total_read = 0
44
+ for frame in container.decode(audio=0): # Only first audio stream
45
+ if resample:
46
+ frame.pts = None
47
+ frame = resampler.resample(frame)
48
+ frame = frame.to_ndarray(format='fltp') # Convert to floats and not int16
49
+ read = frame.shape[-1]
50
+ if total_read + read > duration:
51
+ read = duration - total_read
52
+ sig[:, total_read:total_read + read] = frame[:, :read]
53
+ total_read += read
54
+ if total_read == duration:
55
+ break
56
+ assert total_read <= duration, f'Expected {duration} frames, got {total_read}'
57
+ return sig, sr
58
+
59
+ def test_simple_loader():
60
+ import librosa
61
+ from tqdm import tqdm
62
+
63
+ collate_fn = lambda batch: t.stack([t.from_numpy(b) for b in batch], dim=0)
64
+
65
+ def get_batch(file, loader):
66
+ y1, sr = loader(file, sr=44100, offset=0.0, duration=6.0, time_base='sec')
67
+ y2, sr = loader(file, sr=44100, offset=20.0, duration=6.0, time_base='sec')
68
+ return [y1, y2]
69
+
70
+ def load(file, loader):
71
+ batch = get_batch(file, loader) # np
72
+ x = collate_fn(batch) # torch cpu
73
+ x = x.to('cuda', non_blocking=True) # torch gpu
74
+ return x
75
+
76
+ files = librosa.util.find_files('/root/data/', ['mp3', 'm4a', 'opus'])
77
+ print(files[:10])
78
+ loader = load_audio
79
+ print("Loader", loader.__name__)
80
+ x = t.randn(2, 2).cuda()
81
+ x = load(files[0], loader)
82
+ for i,file in enumerate(tqdm(files)):
83
+ x = load(file, loader)
84
+ if i == 100:
85
+ break
86
+
87
+ def test_dataset_loader():
88
+ from tqdm import tqdm
89
+ from torch.utils.data import DataLoader
90
+ from torch.utils.data.distributed import DistributedSampler
91
+ from jukebox.utils.audio_utils import audio_preprocess, audio_postprocess
92
+ from jukebox.hparams import setup_hparams
93
+ from jukebox.data.files_dataset import FilesAudioDataset
94
+ hps = setup_hparams("teeny", {})
95
+ hps.sr = 22050 # 44100
96
+ hps.hop_length = 512
97
+ hps.labels = False
98
+ hps.channels = 2
99
+ hps.aug_shift = False
100
+ hps.bs = 2
101
+ hps.nworkers = 2 # Getting 20 it/s with 2 workers, 10 it/s with 1 worker
102
+ print(hps)
103
+ dataset = hps.dataset
104
+ root = hps.root
105
+ from tensorboardX import SummaryWriter
106
+ sr = {22050: '22k', 44100: '44k', 48000: '48k'}[hps.sr]
107
+ writer = SummaryWriter(f'{root}/{dataset}/logs/{sr}/logs')
108
+ dataset = FilesAudioDataset(hps)
109
+ print("Length of dataset", len(dataset))
110
+
111
+ # Torch Loader
112
+ collate_fn = lambda batch: t.stack([t.from_numpy(b) for b in batch], 0)
113
+ sampler = DistributedSampler(dataset)
114
+ train_loader = DataLoader(dataset, batch_size=hps.bs, num_workers=hps.nworkers, pin_memory=False, sampler=sampler,
115
+ drop_last=True, collate_fn=collate_fn)
116
+
117
+ dist.barrier()
118
+ sampler.set_epoch(0)
119
+ for i, x in enumerate(tqdm(train_loader)):
120
+ x = x.to('cuda', non_blocking=True)
121
+ for j, aud in enumerate(x):
122
+ writer.add_audio('in_' + str(i*hps.bs + j), aud, 1, hps.sr)
123
+ print("Wrote in")
124
+ x = audio_preprocess(x, hps)
125
+ x = audio_postprocess(x, hps)
126
+ for j, aud in enumerate(x):
127
+ writer.add_audio('out_' + str(i*hps.bs + j), aud, 1, hps.sr)
128
+ print("Wrote out")
129
+ dist.barrier()
130
+ break
131
+
132
+ if __name__ == '__main__':
133
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
134
+ setup_dist_from_mpi(port=29500)
135
+ test_dataset_loader()
136
+
jukebox/utils/logger.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch as t
2
+ import jukebox.utils.dist_adapter as dist
3
+ from tqdm import tqdm
4
+ from datetime import date
5
+ import os
6
+ import sys
7
+
8
+ def def_tqdm(x):
9
+ return tqdm(x, leave=True, file=sys.stdout, bar_format="{n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}{postfix}]")
10
+
11
+ def get_range(x):
12
+ if dist.get_rank() == 0:
13
+ return def_tqdm(x)
14
+ else:
15
+ return x
16
+
17
+ def init_logging(hps, local_rank, rank):
18
+ logdir = f"{hps.local_logdir}/{hps.name}"
19
+ if local_rank == 0:
20
+ if not os.path.exists(logdir):
21
+ os.makedirs(logdir)
22
+ with open(logdir + 'argv.txt', 'w') as f:
23
+ f.write(hps.argv + '\n')
24
+ print("Logging to", logdir)
25
+ logger = Logger(logdir, rank)
26
+ metrics = Metrics()
27
+ logger.add_text('hps', str(hps))
28
+ return logger, metrics
29
+
30
+ def get_name(hps):
31
+ name = ""
32
+ for key, value in hps.items():
33
+ name += f"{key}_{value}_"
34
+ return name
35
+
36
+ def average_metrics(_metrics):
37
+ metrics = {}
38
+ for _metric in _metrics:
39
+ for key, val in _metric.items():
40
+ if key not in metrics:
41
+ metrics[key] = []
42
+ metrics[key].append(val)
43
+ return {key: sum(vals)/len(vals) for key, vals in metrics.items()}
44
+
45
+ class Metrics:
46
+ def __init__(self):
47
+ self.sum = {}
48
+ self.n = {}
49
+
50
+ def update(self, tag, val, batch):
51
+ # v is average value over batch
52
+ # store total value and total batch, returns dist average
53
+ sum = t.tensor(val * batch).float().cuda()
54
+ n = t.tensor(batch).float().cuda()
55
+ dist.all_reduce(sum)
56
+ dist.all_reduce(n)
57
+ sum = sum.item()
58
+ n = n.item()
59
+ self.sum[tag] = self.sum.get(tag, 0.0) + sum
60
+ self.n[tag] = self.n.get(tag, 0.0) + n
61
+ return sum / n
62
+
63
+ def avg(self, tag):
64
+ if tag in self.sum:
65
+ return self.sum[tag] / self.n[tag]
66
+ else:
67
+ return 0.0
68
+
69
+ def reset(self):
70
+ self.sum = {}
71
+ self.n = {}
72
+
73
+ class Logger:
74
+ def __init__(self, logdir, rank):
75
+ if rank == 0:
76
+ from tensorboardX import SummaryWriter
77
+ self.sw = SummaryWriter(f"{logdir}/logs")
78
+ self.iters = 0
79
+ self.rank = rank
80
+ self.works = []
81
+ self.logdir = logdir
82
+
83
+ def step(self):
84
+ self.iters += 1
85
+
86
+ def flush(self):
87
+ if self.rank == 0:
88
+ self.sw.flush()
89
+
90
+ def add_text(self, tag, text):
91
+ if self.rank == 0:
92
+ self.sw.add_text(tag, text, self.iters)
93
+
94
+ def add_audios(self, tag, auds, sample_rate=22050, max_len=None, max_log=8):
95
+ if self.rank == 0:
96
+ for i in range(min(len(auds), max_log)):
97
+ if max_len:
98
+ self.sw.add_audio(f"{i}/{tag}", auds[i][:max_len * sample_rate], self.iters, sample_rate)
99
+ else:
100
+ self.sw.add_audio(f"{i}/{tag}", auds[i], self.iters, sample_rate)
101
+
102
+ def add_audio(self, tag, aud, sample_rate=22050):
103
+ if self.rank == 0:
104
+ self.sw.add_audio(tag, aud, self.iters, sample_rate)
105
+
106
+ def add_images(self, tag, img, dataformats="NHWC"):
107
+ if self.rank == 0:
108
+ self.sw.add_images(tag, img, self.iters, dataformats=dataformats)
109
+
110
+ def add_image(self, tag, img):
111
+ if self.rank == 0:
112
+ self.sw.add_image(tag, img, self.iters)
113
+
114
+ def add_scalar(self, tag, val):
115
+ if self.rank == 0:
116
+ self.sw.add_scalar(tag, val, self.iters)
117
+
118
+ def get_range(self, loader):
119
+ if self.rank == 0:
120
+ self.trange = def_tqdm(loader)
121
+ else:
122
+ self.trange = loader
123
+ return enumerate(self.trange)
124
+
125
+ def close_range(self):
126
+ if self.rank == 0:
127
+ self.trange.close()
128
+
129
+ def set_postfix(self, *args, **kwargs):
130
+ if self.rank == 0:
131
+ self.trange.set_postfix(*args, **kwargs)
132
+
133
+ # For logging summaries of varies graph ops
134
+ def add_reduce_scalar(self, tag, layer, val):
135
+ if self.iters % 100 == 0:
136
+ with t.no_grad():
137
+ val = val.float().norm()/float(val.numel())
138
+ work = dist.reduce(val, 0, async_op=True)
139
+ self.works.append((tag, layer, val, work))
140
+
141
+ def finish_reduce(self):
142
+ for tag, layer, val, work in self.works:
143
+ work.wait()
144
+ if self.rank == 0:
145
+ val = val.item()/dist.get_world_size()
146
+ self.lw[layer].add_scalar(tag, val, self.iters)
147
+ self.works = []
jukebox/utils/remote_utils.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import subprocess
3
+
4
+ def download(remote_path, local_path, async_download=False):
5
+ args = ['wget', '-O', local_path, remote_path]
6
+ print("Running ", " ".join(args))
7
+ if async_download:
8
+ subprocess.Popen(args)
9
+ else:
10
+ subprocess.call(args)
11
+
12
+ # GCE
13
+ def gs_download(gs_path, local_path, async_download=False):
14
+ args = ['gsutil',
15
+ '-o', 'GSUtil:parallel_thread_count=1',
16
+ '-o', 'GSUtil:sliced_object_download_max_components=8',
17
+ 'cp', gs_path, local_path]
18
+ if async_download:
19
+ subprocess.Popen(args)
20
+ else:
21
+ subprocess.call(args)
22
+
23
+
24
+ def gs_upload(local_path, gs_path, async_upload=False):
25
+ # NOTE: Download and upload have differ -o flags.
26
+ # We also use -n to prevent clobbering checkpoints by mistake
27
+ assert not local_path.startswith("gs://")
28
+ assert gs_path.startswith("gs://")
29
+ args = ['gsutil',
30
+ '-o', 'GSUtil:parallel_composite_upload_threshold=150M',
31
+ 'cp', '-n', local_path, gs_path]
32
+ if async_upload:
33
+ subprocess.Popen(args)
34
+ else:
35
+ subprocess.call(args)
36
+
37
+ def ls(regex):
38
+ outputs = subprocess.check_output(['gsutil', 'ls', regex]).decode(sys.stdout.encoding)
39
+ outputs = outputs.split('\n')
40
+ outputs = [output for output in outputs if output is not '']
41
+ return outputs
42
+
jukebox/utils/sample_utils.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch as t
2
+
3
+ def split_batch(obj, n_samples, split_size):
4
+ n_passes = (n_samples + split_size - 1) // split_size
5
+ if isinstance(obj, t.Tensor):
6
+ return t.split(obj, split_size, dim=0)
7
+ elif isinstance(obj, list):
8
+ return list(zip(*[t.split(item, split_size, dim=0) for item in obj]))
9
+ elif obj is None:
10
+ return [None] * n_passes
11
+ else:
12
+ raise TypeError('Unknown input type')
13
+
14
+ # Break total_length into hops/windows of size n_ctx separated by hop_length
15
+ def get_starts(total_length, n_ctx, hop_length):
16
+ starts = []
17
+ for start in range(0, total_length - n_ctx + hop_length, hop_length):
18
+ if start + n_ctx >= total_length:
19
+ # Last hop could be smaller, we make it n_ctx to maximise context
20
+ start = total_length - n_ctx
21
+ starts.append(start)
22
+ return starts
jukebox/utils/torch_utils.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gc
2
+ import torch as t
3
+
4
+ def freeze_model(model):
5
+ model.eval()
6
+ for params in model.parameters():
7
+ params.requires_grad = False
8
+
9
+
10
+ def unfreeze_model(model):
11
+ model.train()
12
+ for params in model.parameters():
13
+ params.requires_grad = True
14
+
15
+ def zero_grad(model):
16
+ for p in model.parameters():
17
+ if p.requires_grad and p.grad is not None:
18
+ p.grad = None
19
+
20
+ def empty_cache():
21
+ gc.collect()
22
+ t.cuda.empty_cache()
23
+
24
+ def assert_shape(x, exp_shape):
25
+ assert x.shape == exp_shape, f"Expected {exp_shape} got {x.shape}"
26
+
27
+ def count_parameters(model):
28
+ return sum(p.numel() for p in model.parameters() if p.requires_grad)
29
+
30
+ def count_state(model):
31
+ return sum(s.numel() for s in model.state_dict().values())
32
+
jukebox/vqvae/__init__.py ADDED
File without changes
jukebox/vqvae/bottleneck.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import torch as t
3
+ import torch.nn as nn
4
+ import torch.nn.functional as F
5
+ import jukebox.utils.dist_adapter as dist
6
+
7
+ class BottleneckBlock(nn.Module):
8
+ def __init__(self, k_bins, emb_width, mu):
9
+ super().__init__()
10
+ self.k_bins = k_bins
11
+ self.emb_width = emb_width
12
+ self.mu = mu
13
+ self.reset_k()
14
+ self.threshold = 1.0
15
+
16
+ def reset_k(self):
17
+ self.init = False
18
+ self.k_sum = None
19
+ self.k_elem = None
20
+ self.register_buffer('k', t.zeros(self.k_bins, self.emb_width).cuda())
21
+
22
+ def _tile(self, x):
23
+ d, ew = x.shape
24
+ if d < self.k_bins:
25
+ n_repeats = (self.k_bins + d - 1) // d
26
+ std = 0.01 / np.sqrt(ew)
27
+ x = x.repeat(n_repeats, 1)
28
+ x = x + t.randn_like(x) * std
29
+ return x
30
+
31
+ def init_k(self, x):
32
+ mu, emb_width, k_bins = self.mu, self.emb_width, self.k_bins
33
+ self.init = True
34
+ # init k_w using random vectors from x
35
+ y = self._tile(x)
36
+ _k_rand = y[t.randperm(y.shape[0])][:k_bins]
37
+ dist.broadcast(_k_rand, 0)
38
+ self.k = _k_rand
39
+ assert self.k.shape == (k_bins, emb_width)
40
+ self.k_sum = self.k
41
+ self.k_elem = t.ones(k_bins, device=self.k.device)
42
+
43
+ def restore_k(self, num_tokens=None, threshold=1.0):
44
+ mu, emb_width, k_bins = self.mu, self.emb_width, self.k_bins
45
+ self.init = True
46
+ assert self.k.shape == (k_bins, emb_width)
47
+ self.k_sum = self.k.clone()
48
+ self.k_elem = t.ones(k_bins, device=self.k.device)
49
+ if num_tokens is not None:
50
+ expected_usage = num_tokens / k_bins
51
+ self.k_elem.data.mul_(expected_usage)
52
+ self.k_sum.data.mul_(expected_usage)
53
+ self.threshold = threshold
54
+
55
+ def update_k(self, x, x_l):
56
+ mu, emb_width, k_bins = self.mu, self.emb_width, self.k_bins
57
+ with t.no_grad():
58
+ # Calculate new centres
59
+ x_l_onehot = t.zeros(k_bins, x.shape[0], device=x.device) # k_bins, N * L
60
+ x_l_onehot.scatter_(0, x_l.view(1, x.shape[0]), 1)
61
+
62
+ _k_sum = t.matmul(x_l_onehot, x) # k_bins, w
63
+ _k_elem = x_l_onehot.sum(dim=-1) # k_bins
64
+ y = self._tile(x)
65
+ _k_rand = y[t.randperm(y.shape[0])][:k_bins]
66
+
67
+ dist.broadcast(_k_rand, 0)
68
+ dist.all_reduce(_k_sum)
69
+ dist.all_reduce(_k_elem)
70
+
71
+ # Update centres
72
+ old_k = self.k
73
+ self.k_sum = mu * self.k_sum + (1. - mu) * _k_sum # w, k_bins
74
+ self.k_elem = mu * self.k_elem + (1. - mu) * _k_elem # k_bins
75
+ usage = (self.k_elem.view(k_bins, 1) >= self.threshold).float()
76
+ self.k = usage * (self.k_sum.view(k_bins, emb_width) / self.k_elem.view(k_bins, 1)) \
77
+ + (1 - usage) * _k_rand
78
+ _k_prob = _k_elem / t.sum(_k_elem) # x_l_onehot.mean(dim=-1) # prob of each bin
79
+ entropy = -t.sum(_k_prob * t.log(_k_prob + 1e-8)) # entropy ie how diverse
80
+ used_curr = (_k_elem >= self.threshold).sum()
81
+ usage = t.sum(usage)
82
+ dk = t.norm(self.k - old_k) / np.sqrt(np.prod(old_k.shape))
83
+ return dict(entropy=entropy,
84
+ used_curr=used_curr,
85
+ usage=usage,
86
+ dk=dk)
87
+
88
+ def preprocess(self, x):
89
+ # NCT -> NTC -> [NT, C]
90
+ x = x.permute(0, 2, 1).contiguous()
91
+ x = x.view(-1, x.shape[-1]) # x_en = (N * L, w), k_j = (w, k_bins)
92
+
93
+ if x.shape[-1] == self.emb_width:
94
+ prenorm = t.norm(x - t.mean(x)) / np.sqrt(np.prod(x.shape))
95
+ elif x.shape[-1] == 2 * self.emb_width:
96
+ x1, x2 = x[...,:self.emb_width], x[...,self.emb_width:]
97
+ prenorm = (t.norm(x1 - t.mean(x1)) / np.sqrt(np.prod(x1.shape))) + (t.norm(x2 - t.mean(x2)) / np.sqrt(np.prod(x2.shape)))
98
+
99
+ # Normalise
100
+ x = x1 + x2
101
+ else:
102
+ assert False, f"Expected {x.shape[-1]} to be (1 or 2) * {self.emb_width}"
103
+ return x, prenorm
104
+
105
+ def postprocess(self, x_l, x_d, x_shape):
106
+ # [NT, C] -> NTC -> NCT
107
+ N, T = x_shape
108
+ x_d = x_d.view(N, T, -1).permute(0, 2, 1).contiguous()
109
+ x_l = x_l.view(N, T)
110
+ return x_l, x_d
111
+
112
+ def quantise(self, x):
113
+ # Calculate latent code x_l
114
+ k_w = self.k.t()
115
+ distance = t.sum(x ** 2, dim=-1, keepdim=True) - 2 * t.matmul(x, k_w) + t.sum(k_w ** 2, dim=0,
116
+ keepdim=True) # (N * L, b)
117
+ min_distance, x_l = t.min(distance, dim=-1)
118
+ fit = t.mean(min_distance)
119
+ return x_l, fit
120
+
121
+ def dequantise(self, x_l):
122
+ x = F.embedding(x_l, self.k)
123
+ return x
124
+
125
+ def encode(self, x):
126
+ N, width, T = x.shape
127
+
128
+ # Preprocess.
129
+ x, prenorm = self.preprocess(x)
130
+
131
+ # Quantise
132
+ x_l, fit = self.quantise(x)
133
+
134
+ # Postprocess.
135
+ x_l = x_l.view(N, T)
136
+ return x_l
137
+
138
+ def decode(self, x_l):
139
+ N, T = x_l.shape
140
+ width = self.emb_width
141
+
142
+ # Dequantise
143
+ x_d = self.dequantise(x_l)
144
+
145
+ # Postprocess
146
+ x_d = x_d.view(N, T, width).permute(0, 2, 1).contiguous()
147
+ return x_d
148
+
149
+ def forward(self, x, update_k=True):
150
+ N, width, T = x.shape
151
+
152
+ # Preprocess
153
+ x, prenorm = self.preprocess(x)
154
+
155
+ # Init k if not inited
156
+ if update_k and not self.init:
157
+ self.init_k(x)
158
+
159
+ # Quantise and dequantise through bottleneck
160
+ x_l, fit = self.quantise(x)
161
+ x_d = self.dequantise(x_l)
162
+
163
+ # Update embeddings
164
+ if update_k:
165
+ update_metrics = self.update_k(x, x_l)
166
+ else:
167
+ update_metrics = {}
168
+
169
+ # Loss
170
+ commit_loss = t.norm(x_d.detach() - x) ** 2 / np.prod(x.shape)
171
+
172
+ # Passthrough
173
+ x_d = x + (x_d - x).detach()
174
+
175
+ # Postprocess
176
+ x_l, x_d = self.postprocess(x_l, x_d, (N,T))
177
+ return x_l, x_d, commit_loss, dict(fit=fit,
178
+ pn=prenorm,
179
+ **update_metrics)
180
+
181
+
182
+ class Bottleneck(nn.Module):
183
+ def __init__(self, l_bins, emb_width, mu, levels):
184
+ super().__init__()
185
+ self.levels = levels
186
+ level_block = lambda level: BottleneckBlock(l_bins, emb_width, mu)
187
+ self.level_blocks = nn.ModuleList()
188
+ for level in range(self.levels):
189
+ self.level_blocks.append(level_block(level))
190
+
191
+ def encode(self, xs):
192
+ zs = [level_block.encode(x) for (level_block, x) in zip(self.level_blocks, xs)]
193
+ return zs
194
+
195
+ def decode(self, zs, start_level=0, end_level=None):
196
+ if end_level is None:
197
+ end_level = self.levels
198
+ xs_quantised = [level_block.decode(z) for (level_block, z) in zip(self.level_blocks[start_level:end_level], zs)]
199
+ return xs_quantised
200
+
201
+ def forward(self, xs):
202
+ zs, xs_quantised, commit_losses, metrics = [], [], [], []
203
+ for level in range(self.levels):
204
+ level_block = self.level_blocks[level]
205
+ x = xs[level]
206
+ z, x_quantised, commit_loss, metric = level_block(x, update_k=self.training)
207
+ zs.append(z)
208
+ if not self.training:
209
+ # Be extra paranoid and make sure the encoder weights can't
210
+ # change from straight-through estimator
211
+ x_quantised = x_quantised.detach()
212
+ xs_quantised.append(x_quantised)
213
+ commit_losses.append(commit_loss)
214
+ if self.training:
215
+ metrics.append(metric)
216
+ return zs, xs_quantised, commit_losses, metrics
217
+
218
+ class NoBottleneckBlock(nn.Module):
219
+ def restore_k(self):
220
+ pass
221
+
222
+ class NoBottleneck(nn.Module):
223
+ def __init__(self, levels):
224
+ super().__init__()
225
+ self.level_blocks = nn.ModuleList()
226
+ self.levels = levels
227
+ for level in range(levels):
228
+ self.level_blocks.append(NoBottleneckBlock())
229
+
230
+ def encode(self, xs):
231
+ return xs
232
+
233
+ def decode(self, zs, start_level=0, end_level=None):
234
+ if end_level is None:
235
+ end_level = self.levels
236
+ return zs
237
+
238
+ def forward(self, xs):
239
+ zero = t.zeros(()).cuda()
240
+ commit_losses = [zero for _ in range(self.levels)]
241
+ metrics = [dict(entropy=zero, usage=zero, used_curr=zero, pn=zero, dk=zero) for _ in range(self.levels)]
242
+ return xs, xs, commit_losses, metrics
243
+
244
+ if __name__ == '__main__':
245
+ from jukebox.utils.dist_utils import setup_dist_from_mpi
246
+ rank, local_rank, device = setup_dist_from_mpi(port=29600)
247
+ bottleneck = Bottleneck(256, 64, 0.99, 2).to(device)
248
+ bottleneck.check()
jukebox/vqvae/encdec.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch as t
2
+ import torch.nn as nn
3
+ from jukebox.vqvae.resnet import Resnet, Resnet1D
4
+ from jukebox.utils.torch_utils import assert_shape
5
+
6
+ class EncoderConvBlock(nn.Module):
7
+ def __init__(self, input_emb_width, output_emb_width, down_t,
8
+ stride_t, width, depth, m_conv,
9
+ dilation_growth_rate=1, dilation_cycle=None, zero_out=False,
10
+ res_scale=False):
11
+ super().__init__()
12
+ blocks = []
13
+ filter_t, pad_t = stride_t * 2, stride_t // 2
14
+ if down_t > 0:
15
+ for i in range(down_t):
16
+ block = nn.Sequential(
17
+ nn.Conv1d(input_emb_width if i == 0 else width, width, filter_t, stride_t, pad_t),
18
+ Resnet1D(width, depth, m_conv, dilation_growth_rate, dilation_cycle, zero_out, res_scale),
19
+ )
20
+ blocks.append(block)
21
+ block = nn.Conv1d(width, output_emb_width, 3, 1, 1)
22
+ blocks.append(block)
23
+ self.model = nn.Sequential(*blocks)
24
+
25
+ def forward(self, x):
26
+ return self.model(x)
27
+
28
+ class DecoderConvBock(nn.Module):
29
+ def __init__(self, input_emb_width, output_emb_width, down_t,
30
+ stride_t, width, depth, m_conv, dilation_growth_rate=1, dilation_cycle=None, zero_out=False, res_scale=False, reverse_decoder_dilation=False, checkpoint_res=False):
31
+ super().__init__()
32
+ blocks = []
33
+ if down_t > 0:
34
+ filter_t, pad_t = stride_t * 2, stride_t // 2
35
+ block = nn.Conv1d(output_emb_width, width, 3, 1, 1)
36
+ blocks.append(block)
37
+ for i in range(down_t):
38
+ block = nn.Sequential(
39
+ Resnet1D(width, depth, m_conv, dilation_growth_rate, dilation_cycle, zero_out=zero_out, res_scale=res_scale, reverse_dilation=reverse_decoder_dilation, checkpoint_res=checkpoint_res),
40
+ nn.ConvTranspose1d(width, input_emb_width if i == (down_t - 1) else width, filter_t, stride_t, pad_t)
41
+ )
42
+ blocks.append(block)
43
+ self.model = nn.Sequential(*blocks)
44
+
45
+ def forward(self, x):
46
+ return self.model(x)
47
+
48
+ class Encoder(nn.Module):
49
+ def __init__(self, input_emb_width, output_emb_width, levels, downs_t,
50
+ strides_t, **block_kwargs):
51
+ super().__init__()
52
+ self.input_emb_width = input_emb_width
53
+ self.output_emb_width = output_emb_width
54
+ self.levels = levels
55
+ self.downs_t = downs_t
56
+ self.strides_t = strides_t
57
+
58
+ block_kwargs_copy = dict(**block_kwargs)
59
+ if 'reverse_decoder_dilation' in block_kwargs_copy:
60
+ del block_kwargs_copy['reverse_decoder_dilation']
61
+ level_block = lambda level, down_t, stride_t: EncoderConvBlock(input_emb_width if level == 0 else output_emb_width,
62
+ output_emb_width,
63
+ down_t, stride_t,
64
+ **block_kwargs_copy)
65
+ self.level_blocks = nn.ModuleList()
66
+ iterator = zip(list(range(self.levels)), downs_t, strides_t)
67
+ for level, down_t, stride_t in iterator:
68
+ self.level_blocks.append(level_block(level, down_t, stride_t))
69
+
70
+ def forward(self, x):
71
+ N, T = x.shape[0], x.shape[-1]
72
+ emb = self.input_emb_width
73
+ assert_shape(x, (N, emb, T))
74
+ xs = []
75
+
76
+ # 64, 32, ...
77
+ iterator = zip(list(range(self.levels)), self.downs_t, self.strides_t)
78
+ for level, down_t, stride_t in iterator:
79
+ level_block = self.level_blocks[level]
80
+ x = level_block(x)
81
+ emb, T = self.output_emb_width, T // (stride_t ** down_t)
82
+ assert_shape(x, (N, emb, T))
83
+ xs.append(x)
84
+
85
+ return xs
86
+
87
+ class Decoder(nn.Module):
88
+ def __init__(self, input_emb_width, output_emb_width, levels, downs_t,
89
+ strides_t, **block_kwargs):
90
+ super().__init__()
91
+ self.input_emb_width = input_emb_width
92
+ self.output_emb_width = output_emb_width
93
+ self.levels = levels
94
+
95
+ self.downs_t = downs_t
96
+
97
+ self.strides_t = strides_t
98
+
99
+ level_block = lambda level, down_t, stride_t: DecoderConvBock(output_emb_width,
100
+ output_emb_width,
101
+ down_t, stride_t,
102
+ **block_kwargs)
103
+ self.level_blocks = nn.ModuleList()
104
+ iterator = zip(list(range(self.levels)), downs_t, strides_t)
105
+ for level, down_t, stride_t in iterator:
106
+ self.level_blocks.append(level_block(level, down_t, stride_t))
107
+
108
+ self.out = nn.Conv1d(output_emb_width, input_emb_width, 3, 1, 1)
109
+
110
+ def forward(self, xs, all_levels=True):
111
+ if all_levels:
112
+ assert len(xs) == self.levels
113
+ else:
114
+ assert len(xs) == 1
115
+ x = xs[-1]
116
+ N, T = x.shape[0], x.shape[-1]
117
+ emb = self.output_emb_width
118
+ assert_shape(x, (N, emb, T))
119
+
120
+ # 32, 64 ...
121
+ iterator = reversed(list(zip(list(range(self.levels)), self.downs_t, self.strides_t)))
122
+ for level, down_t, stride_t in iterator:
123
+ level_block = self.level_blocks[level]
124
+ x = level_block(x)
125
+ emb, T = self.output_emb_width, T * (stride_t ** down_t)
126
+ assert_shape(x, (N, emb, T))
127
+ if level != 0 and all_levels:
128
+ x = x + xs[level - 1]
129
+
130
+ x = self.out(x)
131
+ return x
jukebox/vqvae/resnet.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import torch.nn as nn
3
+ import jukebox.utils.dist_adapter as dist
4
+ from jukebox.utils.checkpoint import checkpoint
5
+
6
+ class ResConvBlock(nn.Module):
7
+ def __init__(self, n_in, n_state):
8
+ super().__init__()
9
+ self.model = nn.Sequential(
10
+ nn.ReLU(),
11
+ nn.Conv2d(n_in, n_state, 3, 1, 1),
12
+ nn.ReLU(),
13
+ nn.Conv2d(n_state, n_in, 1, 1, 0),
14
+ )
15
+
16
+ def forward(self, x):
17
+ return x + self.model(x)
18
+
19
+ class Resnet(nn.Module):
20
+ def __init__(self, n_in, n_depth, m_conv=1.0):
21
+ super().__init__()
22
+ self.model = nn.Sequential(*[ResConvBlock(n_in, int(m_conv * n_in)) for _ in range(n_depth)])
23
+
24
+ def forward(self, x):
25
+ return self.model(x)
26
+
27
+ class ResConv1DBlock(nn.Module):
28
+ def __init__(self, n_in, n_state, dilation=1, zero_out=False, res_scale=1.0):
29
+ super().__init__()
30
+ padding = dilation
31
+ self.model = nn.Sequential(
32
+ nn.ReLU(),
33
+ nn.Conv1d(n_in, n_state, 3, 1, padding, dilation),
34
+ nn.ReLU(),
35
+ nn.Conv1d(n_state, n_in, 1, 1, 0),
36
+ )
37
+ if zero_out:
38
+ out = self.model[-1]
39
+ nn.init.zeros_(out.weight)
40
+ nn.init.zeros_(out.bias)
41
+ self.res_scale = res_scale
42
+
43
+ def forward(self, x):
44
+ return x + self.res_scale * self.model(x)
45
+
46
+ class Resnet1D(nn.Module):
47
+ def __init__(self, n_in, n_depth, m_conv=1.0, dilation_growth_rate=1, dilation_cycle=None, zero_out=False, res_scale=False, reverse_dilation=False, checkpoint_res=False):
48
+ super().__init__()
49
+ def _get_depth(depth):
50
+ if dilation_cycle is None:
51
+ return depth
52
+ else:
53
+ return depth % dilation_cycle
54
+ blocks = [ResConv1DBlock(n_in, int(m_conv * n_in),
55
+ dilation=dilation_growth_rate ** _get_depth(depth),
56
+ zero_out=zero_out,
57
+ res_scale=1.0 if not res_scale else 1.0 / math.sqrt(n_depth))
58
+ for depth in range(n_depth)]
59
+ if reverse_dilation:
60
+ blocks = blocks[::-1]
61
+ self.checkpoint_res = checkpoint_res
62
+ if self.checkpoint_res == 1:
63
+ if dist.get_rank() == 0:
64
+ print("Checkpointing convs")
65
+ self.blocks = nn.ModuleList(blocks)
66
+ else:
67
+ self.model = nn.Sequential(*blocks)
68
+
69
+ def forward(self, x):
70
+ if self.checkpoint_res == 1:
71
+ for block in self.blocks:
72
+ x = checkpoint(block, (x, ), block.parameters(), True)
73
+ return x
74
+ else:
75
+ return self.model(x)
jukebox/vqvae/vqvae.py ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import torch as t
3
+ import torch.nn as nn
4
+
5
+ from jukebox.vqvae.encdec import Encoder, Decoder, assert_shape
6
+ from jukebox.vqvae.bottleneck import NoBottleneck, Bottleneck
7
+ from jukebox.utils.logger import average_metrics
8
+ from jukebox.utils.audio_utils import spectral_convergence, spectral_loss, multispectral_loss, audio_postprocess
9
+
10
+ def dont_update(params):
11
+ for param in params:
12
+ param.requires_grad = False
13
+
14
+ def update(params):
15
+ for param in params:
16
+ param.requires_grad = True
17
+
18
+ def calculate_strides(strides, downs):
19
+ return [stride ** down for stride, down in zip(strides, downs)]
20
+
21
+ def _loss_fn(loss_fn, x_target, x_pred, hps):
22
+ if loss_fn == 'l1':
23
+ return t.mean(t.abs(x_pred - x_target)) / hps.bandwidth['l1']
24
+ elif loss_fn == 'l2':
25
+ return t.mean((x_pred - x_target) ** 2) / hps.bandwidth['l2']
26
+ elif loss_fn == 'linf':
27
+ residual = ((x_pred - x_target) ** 2).reshape(x_target.shape[0], -1)
28
+ values, _ = t.topk(residual, hps.linf_k, dim=1)
29
+ return t.mean(values) / hps.bandwidth['l2']
30
+ elif loss_fn == 'lmix':
31
+ loss = 0.0
32
+ if hps.lmix_l1:
33
+ loss += hps.lmix_l1 * _loss_fn('l1', x_target, x_pred, hps)
34
+ if hps.lmix_l2:
35
+ loss += hps.lmix_l2 * _loss_fn('l2', x_target, x_pred, hps)
36
+ if hps.lmix_linf:
37
+ loss += hps.lmix_linf * _loss_fn('linf', x_target, x_pred, hps)
38
+ return loss
39
+ else:
40
+ assert False, f"Unknown loss_fn {loss_fn}"
41
+
42
+ class VQVAE(nn.Module):
43
+ def __init__(self, input_shape, levels, downs_t, strides_t,
44
+ emb_width, l_bins, mu, commit, spectral, multispectral,
45
+ multipliers=None, use_bottleneck=True, **block_kwargs):
46
+ super().__init__()
47
+
48
+ self.sample_length = input_shape[0]
49
+ x_shape, x_channels = input_shape[:-1], input_shape[-1]
50
+ self.x_shape = x_shape
51
+
52
+ self.downsamples = calculate_strides(strides_t, downs_t)
53
+ self.hop_lengths = np.cumprod(self.downsamples)
54
+ self.z_shapes = z_shapes = [(x_shape[0] // self.hop_lengths[level],) for level in range(levels)]
55
+ self.levels = levels
56
+
57
+ if multipliers is None:
58
+ self.multipliers = [1] * levels
59
+ else:
60
+ assert len(multipliers) == levels, "Invalid number of multipliers"
61
+ self.multipliers = multipliers
62
+ def _block_kwargs(level):
63
+ this_block_kwargs = dict(block_kwargs)
64
+ this_block_kwargs["width"] *= self.multipliers[level]
65
+ this_block_kwargs["depth"] *= self.multipliers[level]
66
+ return this_block_kwargs
67
+
68
+ encoder = lambda level: Encoder(x_channels, emb_width, level + 1,
69
+ downs_t[:level+1], strides_t[:level+1], **_block_kwargs(level))
70
+ decoder = lambda level: Decoder(x_channels, emb_width, level + 1,
71
+ downs_t[:level+1], strides_t[:level+1], **_block_kwargs(level))
72
+ self.encoders = nn.ModuleList()
73
+ self.decoders = nn.ModuleList()
74
+ for level in range(levels):
75
+ self.encoders.append(encoder(level))
76
+ self.decoders.append(decoder(level))
77
+
78
+ if use_bottleneck:
79
+ self.bottleneck = Bottleneck(l_bins, emb_width, mu, levels)
80
+ else:
81
+ self.bottleneck = NoBottleneck(levels)
82
+
83
+ self.downs_t = downs_t
84
+ self.strides_t = strides_t
85
+ self.l_bins = l_bins
86
+ self.commit = commit
87
+ self.spectral = spectral
88
+ self.multispectral = multispectral
89
+
90
+ def preprocess(self, x):
91
+ # x: NTC [-1,1] -> NCT [-1,1]
92
+ assert len(x.shape) == 3
93
+ x = x.permute(0,2,1).float()
94
+ return x
95
+
96
+ def postprocess(self, x):
97
+ # x: NTC [-1,1] <- NCT [-1,1]
98
+ x = x.permute(0,2,1)
99
+ return x
100
+
101
+ def _decode(self, zs, start_level=0, end_level=None):
102
+ # Decode
103
+ if end_level is None:
104
+ end_level = self.levels
105
+ assert len(zs) == end_level - start_level
106
+ xs_quantised = self.bottleneck.decode(zs, start_level=start_level, end_level=end_level)
107
+ assert len(xs_quantised) == end_level - start_level
108
+
109
+ # Use only lowest level
110
+ decoder, x_quantised = self.decoders[start_level], xs_quantised[0:1]
111
+ x_out = decoder(x_quantised, all_levels=False)
112
+ x_out = self.postprocess(x_out)
113
+ return x_out
114
+
115
+ def decode(self, zs, start_level=0, end_level=None, bs_chunks=1):
116
+ z_chunks = [t.chunk(z, bs_chunks, dim=0) for z in zs]
117
+ x_outs = []
118
+ for i in range(bs_chunks):
119
+ zs_i = [z_chunk[i] for z_chunk in z_chunks]
120
+ x_out = self._decode(zs_i, start_level=start_level, end_level=end_level)
121
+ x_outs.append(x_out)
122
+ return t.cat(x_outs, dim=0)
123
+
124
+ def _encode(self, x, start_level=0, end_level=None):
125
+ # Encode
126
+ if end_level is None:
127
+ end_level = self.levels
128
+ x_in = self.preprocess(x)
129
+ xs = []
130
+ for level in range(self.levels):
131
+ encoder = self.encoders[level]
132
+ x_out = encoder(x_in)
133
+ xs.append(x_out[-1])
134
+ zs = self.bottleneck.encode(xs)
135
+ return zs[start_level:end_level]
136
+
137
+ def encode(self, x, start_level=0, end_level=None, bs_chunks=1):
138
+ x_chunks = t.chunk(x, bs_chunks, dim=0)
139
+ zs_list = []
140
+ for x_i in x_chunks:
141
+ zs_i = self._encode(x_i, start_level=start_level, end_level=end_level)
142
+ zs_list.append(zs_i)
143
+ zs = [t.cat(zs_level_list, dim=0) for zs_level_list in zip(*zs_list)]
144
+ return zs
145
+
146
+ def sample(self, n_samples):
147
+ zs = [t.randint(0, self.l_bins, size=(n_samples, *z_shape), device='cuda') for z_shape in self.z_shapes]
148
+ return self.decode(zs)
149
+
150
+ def forward(self, x, hps, loss_fn='l1'):
151
+ metrics = {}
152
+
153
+ N = x.shape[0]
154
+
155
+ # Encode/Decode
156
+ x_in = self.preprocess(x)
157
+ xs = []
158
+ for level in range(self.levels):
159
+ encoder = self.encoders[level]
160
+ x_out = encoder(x_in)
161
+ xs.append(x_out[-1])
162
+
163
+ zs, xs_quantised, commit_losses, quantiser_metrics = self.bottleneck(xs)
164
+ x_outs = []
165
+ for level in range(self.levels):
166
+ decoder = self.decoders[level]
167
+ x_out = decoder(xs_quantised[level:level+1], all_levels=False)
168
+ assert_shape(x_out, x_in.shape)
169
+ x_outs.append(x_out)
170
+
171
+ # Loss
172
+ def _spectral_loss(x_target, x_out, hps):
173
+ if hps.use_nonrelative_specloss:
174
+ sl = spectral_loss(x_target, x_out, hps) / hps.bandwidth['spec']
175
+ else:
176
+ sl = spectral_convergence(x_target, x_out, hps)
177
+ sl = t.mean(sl)
178
+ return sl
179
+
180
+ def _multispectral_loss(x_target, x_out, hps):
181
+ sl = multispectral_loss(x_target, x_out, hps) / hps.bandwidth['spec']
182
+ sl = t.mean(sl)
183
+ return sl
184
+
185
+ recons_loss = t.zeros(()).to(x.device)
186
+ spec_loss = t.zeros(()).to(x.device)
187
+ multispec_loss = t.zeros(()).to(x.device)
188
+ x_target = audio_postprocess(x.float(), hps)
189
+
190
+ for level in reversed(range(self.levels)):
191
+ x_out = self.postprocess(x_outs[level])
192
+ x_out = audio_postprocess(x_out, hps)
193
+ this_recons_loss = _loss_fn(loss_fn, x_target, x_out, hps)
194
+ this_spec_loss = _spectral_loss(x_target, x_out, hps)
195
+ this_multispec_loss = _multispectral_loss(x_target, x_out, hps)
196
+ metrics[f'recons_loss_l{level + 1}'] = this_recons_loss
197
+ metrics[f'spectral_loss_l{level + 1}'] = this_spec_loss
198
+ metrics[f'multispectral_loss_l{level + 1}'] = this_multispec_loss
199
+ recons_loss += this_recons_loss
200
+ spec_loss += this_spec_loss
201
+ multispec_loss += this_multispec_loss
202
+
203
+ commit_loss = sum(commit_losses)
204
+ loss = recons_loss + self.spectral * spec_loss + self.multispectral * multispec_loss + self.commit * commit_loss
205
+
206
+ with t.no_grad():
207
+ sc = t.mean(spectral_convergence(x_target, x_out, hps))
208
+ l2_loss = _loss_fn("l2", x_target, x_out, hps)
209
+ l1_loss = _loss_fn("l1", x_target, x_out, hps)
210
+ linf_loss = _loss_fn("linf", x_target, x_out, hps)
211
+
212
+ quantiser_metrics = average_metrics(quantiser_metrics)
213
+
214
+ metrics.update(dict(
215
+ recons_loss=recons_loss,
216
+ spectral_loss=spec_loss,
217
+ multispectral_loss=multispec_loss,
218
+ spectral_convergence=sc,
219
+ l2_loss=l2_loss,
220
+ l1_loss=l1_loss,
221
+ linf_loss=linf_loss,
222
+ commit_loss=commit_loss,
223
+ **quantiser_metrics))
224
+
225
+ for key, val in metrics.items():
226
+ metrics[key] = val.detach()
227
+
228
+ return x_out, loss, metrics
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
2
  # model-specific deps below:
 
3
  torch
4
  torchaudio
5
  transformers
@@ -7,6 +8,17 @@ miditoolkit
7
  questionary
8
  soundfile
9
  mpi4py
10
- sheetsage @ git+https://github.com/tanchihpin0517/PiCoGen-sheetsage.git
11
  beat_this @ https://github.com/CPJKU/beat_this/archive/main.zip
12
- madmom @ git+https://github.com/CPJKU/madmom.git@0551aa8f48d71a367d92b5d3a347a0cf7cd97cc9
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
2
  # model-specific deps below:
3
+ setuptools<82 # madmom imports pkg_resources at runtime; removed in setuptools 82+
4
  torch
5
  torchaudio
6
  transformers
 
8
  questionary
9
  soundfile
10
  mpi4py
 
11
  beat_this @ https://github.com/CPJKU/beat_this/archive/main.zip
12
+ madmom @ git+https://github.com/CPJKU/madmom.git@0551aa8f48d71a367d92b5d3a347a0cf7cd97cc9
13
+ # sheetsage/ and jukebox/ are vendored directly via this repo since jukebox's own
14
+ # packaging is broken upstream. Here are their runtime deps:
15
+ numpy<2
16
+ scipy
17
+ pretty-midi
18
+ validators
19
+ pillow
20
+ fire
21
+ unidecode
22
+ numba
23
+ librosa
24
+ resampy
sheetsage/__init__.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pathlib
2
+ from os import environ as os_env
3
+
4
+ LIB_DIR = pathlib.Path(__file__).resolve().parent
5
+
6
+ if "SHEETSAGE_CACHE_DIR" in os_env:
7
+ CACHE_DIR = pathlib.Path(os_env["SHEETSAGE_CACHE_DIR"])
8
+ else:
9
+ CACHE_DIR = pathlib.Path(pathlib.Path.home(), ".sheetsage")
10
+ CACHE_DIR = CACHE_DIR.resolve()
11
+
12
+
13
+ # NOTE: This changes the test discovery pattern from "test*.py" (default) to "*test.py".
14
+ def load_tests(loader, standard_tests, pattern):
15
+ package_tests = loader.discover(start_dir=LIB_DIR, pattern="*test.py")
16
+ standard_tests.addTests(package_tests)
17
+ return standard_tests
sheetsage/align.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from scipy.interpolate import interp1d
3
+
4
+
5
+ def _extrapolating_linear_interp1d(a, b, safe=True):
6
+ if safe:
7
+ if isinstance(a, np.ndarray):
8
+ a = a.tolist()
9
+ if isinstance(b, np.ndarray):
10
+ b = b.tolist()
11
+ if a != sorted(a):
12
+ raise ValueError()
13
+ if b != sorted(b):
14
+ raise ValueError()
15
+ if len(a) != len(b):
16
+ raise ValueError()
17
+ if len(np.unique(a)) != len(a):
18
+ raise ValueError()
19
+ if len(np.unique(b)) != len(b):
20
+ raise ValueError()
21
+ return interp1d(a, b, kind="linear", fill_value="extrapolate")
22
+
23
+
24
+ def create_beat_to_time_fn(beats, times, safe=True):
25
+ return _extrapolating_linear_interp1d(beats, times, safe=safe)
26
+
27
+
28
+ def create_time_to_beat_fn(beats, times, safe=True):
29
+ return _extrapolating_linear_interp1d(times, beats, safe=safe)
sheetsage/assets.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import logging
3
+ import pathlib
4
+ import urllib.request
5
+
6
+ from . import CACHE_DIR, LIB_DIR
7
+ from .utils import compute_checksum
8
+
9
+ _DEFAULT_CHUNK_SIZE = 4096
10
+ _ASSETS = None
11
+
12
+
13
+ def _init_assets():
14
+ global _ASSETS
15
+ if _ASSETS is not None:
16
+ raise Exception("Should only run this once")
17
+
18
+ _ASSETS = {}
19
+ asset_paths = set()
20
+ for json_path in sorted(pathlib.Path(LIB_DIR, "assets").rglob("*.json")):
21
+ with open(json_path, "r") as f:
22
+ d = json.load(f)
23
+ for tag, asset in d.items():
24
+ if "checksum" not in asset:
25
+ raise AssertionError("Missing checksum")
26
+ try:
27
+ asset["path"] = pathlib.PurePosixPath(asset["path"].strip())
28
+ except:
29
+ raise AssertionError("Invalid path")
30
+ if asset["path"] in asset_paths:
31
+ raise AssertionError("Duplicate path")
32
+ asset_paths.add(asset["path"])
33
+ asset["path_abs"] = pathlib.Path(CACHE_DIR, asset["path"])
34
+ _ASSETS.update(d)
35
+
36
+
37
+ _init_assets()
38
+
39
+
40
+ def get_asset_tags():
41
+ return set(_ASSETS.keys())
42
+
43
+
44
+ def _download(url, dest_path, chunk_size=_DEFAULT_CHUNK_SIZE):
45
+ with open(dest_path, "wb") as f:
46
+ r = urllib.request.urlopen(url)
47
+ while True:
48
+ chunk = r.read(chunk_size)
49
+ if not chunk:
50
+ break
51
+ f.write(chunk)
52
+
53
+
54
+ def retrieve_asset(tag, delete_wrong=False, chunk_size=_DEFAULT_CHUNK_SIZE, log=True):
55
+ """Attempts to acquire and/or verify existence of a tagged asset in the cache.
56
+
57
+ Returns
58
+ -------
59
+ str
60
+ Absolute file path for asset, if verified.
61
+
62
+ Raises
63
+ ------
64
+ :class:`ValueError`
65
+ Invalid asset tag.
66
+ :class:`Exception`
67
+ Asset could not be verified.
68
+ """
69
+ # Retrieve asset
70
+ if tag not in _ASSETS:
71
+ raise ValueError()
72
+ asset = _ASSETS[tag]
73
+ path = asset["path_abs"]
74
+ checksum = asset["checksum"]
75
+ if log:
76
+ logging.info(f"Verifying asset: {tag}")
77
+ logging.info(f"Asset location: {path}")
78
+
79
+ # Create parent directory
80
+ if not path.parent.is_dir():
81
+ if log:
82
+ logging.info(f"Creating parent: {path.parent}")
83
+ path.parent.mkdir(parents=True)
84
+
85
+ def verify():
86
+ assert path.is_file()
87
+ if checksum is not None:
88
+ if len(checksum) == 32:
89
+ algorithm = "md5"
90
+ elif len(checksum) == 40:
91
+ algorithm = "sha1"
92
+ elif len(checksum) == 64:
93
+ algorithm = "sha256"
94
+ else:
95
+ raise AssertionError("Unknown checksum algorithm")
96
+ computed = compute_checksum(
97
+ path, algorithm=algorithm, chunk_size=chunk_size
98
+ )
99
+ if computed != checksum:
100
+ raise Exception(f"File {path} has wrong checksum.")
101
+
102
+ # Delete incorrect files
103
+ already_verified = False
104
+ if delete_wrong and path.is_file():
105
+ try:
106
+ verify()
107
+ already_verified = True
108
+ except Exception:
109
+ logging.warning(f"Deleting file with bad checksum: {path}")
110
+ path.unlink()
111
+
112
+ # Attempt to download
113
+ if not path.is_file():
114
+ url = asset.get("url")
115
+ if url is None:
116
+ raise Exception("File is missing and cannot be downloaded")
117
+ if log:
118
+ logging.info(f"Downloading from: {url}")
119
+ try:
120
+ _download(url, path)
121
+ except Exception as e:
122
+ if path.is_file():
123
+ path.unlink()
124
+ raise Exception(f"Download failed: {e}")
125
+ assert path.is_file()
126
+
127
+ # Ensure file integrity
128
+ if not already_verified:
129
+ verify()
130
+ if log:
131
+ logging.info(f"Verified!")
132
+
133
+ return path
134
+
135
+
136
+ if __name__ == "__main__":
137
+ import multiprocessing
138
+ from argparse import ArgumentParser
139
+
140
+ parser = ArgumentParser()
141
+
142
+ parser.add_argument("startswith", nargs="?")
143
+ parser.add_argument("--delete_wrong", action="store_true", dest="delete_wrong")
144
+ parser.add_argument("--num_parallel", "-n", type=int)
145
+
146
+ parser.set_defaults(startswith=None, num_parallel=1, delete_wrong=False)
147
+
148
+ args = parser.parse_args()
149
+
150
+ logging.basicConfig(level=logging.INFO)
151
+
152
+ tags = sorted(list(get_asset_tags()))
153
+ if args.startswith is not None:
154
+ tags = [t for t in tags if t.startswith(args.startswith.strip().upper())]
155
+
156
+ def task(t):
157
+ logging.info("-" * 80)
158
+ try:
159
+ retrieve_asset(t, delete_wrong=args.delete_wrong)
160
+ except Exception as e:
161
+ logging.error(e)
162
+ raise e
163
+
164
+ with multiprocessing.Pool(args.num_parallel) as p:
165
+ p.map(task, tags)
sheetsage/assets/hooktheory.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "HOOKTHEORY": {
3
+ "path": "hooktheory/Hooktheory.json.gz",
4
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory.json.gz",
5
+ "checksum": "917b7cd58f5f4e07d6c36acf7bfad958c99ee05472dab3555399141094698e0c"
6
+ },
7
+ "HOOKTHEORY_TRAIN_SEGMENTS": {
8
+ "path": "hooktheory/Hooktheory_Train_Segments.json",
9
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Train_Segments.json",
10
+ "checksum": "f2601eb544f2e5028ffad54d3827912865578fb9ad96e6768b35e4714d5c7207"
11
+ },
12
+ "HOOKTHEORY_TRAIN_MIDI": {
13
+ "path": "hooktheory/Hooktheory_Train_MIDI.tar.gz",
14
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Train_MIDI.tar.gz",
15
+ "checksum": "a2345e13564c81740c087b79731b47e8323c4ceb7b85d40a1a11582af58145cb"
16
+ },
17
+ "HOOKTHEORY_VALID_SEGMENTS": {
18
+ "path": "hooktheory/Hooktheory_Valid_Segments.json",
19
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Valid_Segments.json",
20
+ "checksum": "12526962f77c2eb41cd117c8effa678b39c2b350384a7b048b327aff287b0c48"
21
+ },
22
+ "HOOKTHEORY_VALID_MIDI": {
23
+ "path": "hooktheory/Hooktheory_Valid_MIDI.tar.gz",
24
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Valid_MIDI.tar.gz",
25
+ "checksum": "e369fd4a3072c7524e3cafe506bbdad6e908de969d0f1ba7abf08bf5148989fe"
26
+ },
27
+ "HOOKTHEORY_TEST_SEGMENTS": {
28
+ "path": "hooktheory/Hooktheory_Test_Segments.json",
29
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Test_Segments.json",
30
+ "checksum": "72be80045d4d28842352383e605e8712d50b3437a07b15faa541ee9d17283d5a"
31
+ },
32
+ "HOOKTHEORY_TEST_MIDI": {
33
+ "path": "hooktheory/Hooktheory_Test_MIDI.tar.gz",
34
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Test_MIDI.tar.gz",
35
+ "checksum": "3baebe9d4e19a5006d0f24bc7f0c92a4f66039ab376be86bf7b37a136d4fb6c8"
36
+ },
37
+ "HOOKTHEORY_RAW": {
38
+ "path": "hooktheory/Hooktheory_Raw.json.gz",
39
+ "url": "https://github.com/chrisdonahue/sheetsage-data/raw/refs/heads/main/hooktheory/Hooktheory_Raw.json.gz",
40
+ "checksum": "716af2979f060400c302ab098dd45d9f8c5fe4d4b3b1fe61c478dd9bdf041634"
41
+ }
42
+ }