cm3020 Topic 04: Creativity
Main Info
Title: Creativity
Teachers: Matthew Yee King
Semester Taken: October 2021
Parent Module: cm3020 Artificial Intelligence
Description
Introduces generative systems, including text generation with transformers, music generation, and vocal synthesis.
Lecture Summaries
Can be found in cm3020 Lecture Summaries: Topic 04
Lab Summaries
The first lab has you build a bigram Markov model and text generator, here’s my go:
def bigram_model(input):
model = defaultdict(lambda: [])
for i, w in enumerate(input):
if i < (len(input) - 2):
key = w + " " + input[i+1]
model[key].append(input[i+2])
if i < (len(input) - 1):
model[w].append(input[i+1])
return model
def generate_text(model, length):
state = random.choice(list(model.keys()))
tokens = state.split()
while len(tokens) < length:
bigram = " ".join(tokens[-2:])
unigram = tokens[-1]
if model[bigram]:
tokens.append(random.choice(model[bigram]))
elif model[unigram]:
tokens.append(random.choice(model[unigram]))
else:
tokens.append(random.choice(list(model.keys())))
return " ".join(tokens)
The second lab has you play around with a fine-tuned GPT-2 model.
The third lab has you play around with MusicVAE to generate music.
The fourth lab has you play with their DiffSinger implementation.
Assigned Reading
Week One: Introduction
Week Two: Generating Text
Chollet: Chapter 11: Deep Learning for Text, especially Word Order Models (Chollet), and Transformer Architecture (Chollet)
Radford et al: Language Models are Unsupervised Multitask Learners (the GPT-2 paper)