Lu Yang joined the rookie only four months, this is his first time to participate in double 11 preparation. As a new employee, it was unique to celebrate Singles’ Day with an original hip-hop song. Ai and Double 11 also became MusicGo’s first major theme song.
This year’s Singles’ Day is very technological. Lu Yang feeds MusicGo a lot of articles that embody the technologies of Singles’ Day, such as Caibird Smart Logistics, Ali Cloud, Tianxun robot, intelligent customer service and other keywords. After adding the rhyming, 20 minutes later, a song titled “Tmall Double 11 Has Hip-hop” came out.
Let’s have a feel:
In fact, artificial intelligence has quietly become a new “profession” in this year’s Double 11 festival. Not only 50% of the background fault repair is responsible for by intelligent robots, super robot cluster and 3.5 million customers within a day are completed by intelligent robots and “shop honey”, it can be said that this year alibaba Double 11 opened a new chapter in the era of interpersonal cooperation.
MusicGo, an artificial intelligence program written by Lu Yang in his spare time, can analyze hip-hop lyrics, divide the lyrics into words and pinyin analysis, so as to further obtain the rhyme of each word, forming a huge word segmentation thesaurus, throw in a word can come out a lot of rhyming related words.
Today, Ali sister also invited author Lu Yang, invited him to talk about MusicGo implementation principle. It’s not as difficult as you think
Luyang: To look at the matter of AI writing songs abstractly, there is actually a model, or more generally speaking, there is a function. Just like Y is equal to WX plus B, you give an X, you produce a Y. So, the question is how do I abstract this function and make it as accurate as possible.
What deep learning can do is abstract models. So, for example, if I give you A sequence A as X, and I give you A sequence B as Y, it’s going to be A function Y equals WX plus B through continuous supervised learning. Then, I give A sequence C as X and A sequence D as Y, which tries to satisfy A->B && C->D by adjusting the parameters of the function. When the amount of learning reaches a certain stage, the model is basically usable.
So, what I’m looking for in the end is a reasonable model. This model can do it, I give a sequence X, it can generate sequence Y1, and generate hidden state H1. Then, using Y1 and H1 as inputs, Y2 and H2 are generated, and so on. Finally reach the defined sequence length standard.
Steps as follows:
1. Collect lyrics
2. Pre-process the lyrics to remove punctuation marks and special characters
3. Continuously train seQ2SEQ model
4. Use models to produce lyrics
Collect the lyrics
I used Python to crawl the hip-hop song list of XX music, analyze how rappers rhyme, and collected tens of thousands of hip-hop lyrics.
Data preprocessing
The original lyrics are uploaded by netizens, so the format is not completely uniform, and there will be some non-mainstream symbols. Therefore, all lyrics need to be preprocessed in the same way, with punctuation, special characters, and written into the file in order to make the rest of the text clean enough.
Training model
The first is to establish the LSTM model.
Based on the incoming primer state initial_state and sequence inputs_split, execute the decoder of RNN to get the output outputs_split.
The output is processed by softmax layer to get logits, train targets with the original text to learn, and calculate the total loss function value total_loss.
Loop through the text of the feed, constantly adjusting the model to reduce the loss function value.
Model generation process:
The resulting model is saved enough to satisfy the goal and can be used to generate the sequence later.
Output the lyrics
Using the generated model above to generate hip-hop songs, the results are less than ideal, giving the impression of a bit of a mess. Because the hip-hop songs themselves are very messy, and because of time, I didn’t train the model for too long, the loss function wasn’t low enough, and the resulting song was even more messy.
Adjust to the idea
Meanwhile, there’s a question: what about “Double 11” and “smart”? Even if I let Model learn hip hop all his life, he wouldn’t be able to write anything about Double 11 and ARTIFICIAL intelligence, because there are no similar songs out there. So I decided to go back to square one, change my mind, and be goal-oriented.
Use “artificial intelligence”, “Double 11”, “Ali Cloud”, “Ali Xiaomi”, “cainiao robot” and other keywords to crawl science and technology articles to feed the model, and the model will learn to produce sentences related to double 11 intelligence. At the same time, hip-hop sentence length to restrain it, hip-hop songs. Finally pick some sentences, add a “rhyme”, as a word.
Artificial modified intelligence
Of course, there are still some deviations between the words written by the program and those written by the human. Therefore, I adjusted the sentence pattern of the song automatically generated by the machine to make it more smooth (manual face covering).
Tmall Double 11 has hip hop
(Excerpts of lyrics)
It’s double 11 again
Let me buy and buy and spend all my energy
Come again this year double 11
Let me give command to an intelligent machine
Hacking technology changes lives
Break the blockade surrounding our territory
Smart technology connects you and me
Turn on the lights on double 11
Yeah Too much value to calculate
Thousands of orders are flying at your fingertips
Yeah Too much value to calculate
Ali Cloud lets all orders fly through the cloud
Ali xiaomi can recognize speech, text and image
The ability to learn is online all year long
Crowd tactics have all been changed by technology
Easy to use and changeable users reluctant to say goodbye
And wall-E at The Rookie warehouse
They’re smart enough to start taking the initiative
Picking and packing went through customs smoothly
From Hangzhou to Dongguan
From Shanghai to The Central Plains
This year, as an engineer, what are the must-lose items in your shopping cart? Is it the mechanical keyboard, noise-cancelling headphones and drone you crave, or the heart-warming gloves you bought for your sweetheart, or the celebrity lipstick? Welcome to share in the comments area ~
The original post was published on November 9, 2017
Author: Lu Yang
This article is from The cloud community partner “Ali Technology”