Teach Your Computer to Make Art!

Well done! It's time for Level 2.

1. Use your password.

Do you have your Computer Kit password - the one you wrote down earlier?

Your computer might ask for your permission to install programs.
It may ask you for your password, with a line that looks like this.

[sudo] password for (your username):

When you type, you won’t see the characters appear on the screen - keep calm, this is normal!

It’s to keep your password private.

If you need to, type in your password.

Press Enter.

2. Install the program files.

You’re going to give your computer 5 simple commands, to install the program it just downloaded. The first command will install the Torch program.

Type: ./install.sh

Press Enter.

This bit is going to take about 30 minutes.
You can leave your computer to install the files – and go get some fresh air!

3. Type the next 3 commands.

Now you’re going to install instructions. Your computer will use these to run Torch. Each command installs a different set of instructions.

After typing each command, wait for you for your username to appear before you start the next.

First, you need to prepare the files.

Type: source ~/.bashrc

Press Enter.

Awesome! Let's install the instructions!

Type: luarocks install nngraph

Press Enter.

Good job!

Now type: luarocks install optim

Press Enter.

One more to go!

Type: luarocks install nn

Press Enter.

They're all installed!

4. Teach your Computer.

This program will tell Torch how to read the art. Then your computer will learn to make its own. Type: cd ~

Press Enter


Now type: git clone https://github.com/neue/tomita.git

Press Enter.

There's just one more install to go!

5. Download 10,000 pieces of art!

To become a master artist, your computer needs to learn from real makers on Kano – people just like you.

You're going to give it the code from 10 000 pieces of art. This code will help it make art!

As soon as you see your username flashing on the bottom line of Terminal, type this command. Type: cd tomita/

Press Enter.

This will take you to the files you just installed.

Type: ./getbrain

Press Enter.

It will take a few minutes to download the art - the cursor will flash again when it's finished.

Now would be a great time for a quick drink.

Virtual high five!

6. Machine Learning.

Your computer used the Torch program to read all the art. The second program you installed helped your computer learn how to make art.

Remember that the computer is reading the code that makes the art. Using the programs you installed, it will find patterns in the code from all the art. Then it will generate its own creation, one character at a time!

Your computer is using the patterns it found to make its own code. This is a process called Machine Learning.

Now let’s see what it makes!

7. It's time to run the program.

We are going to create a path for your computer to find the program you installed. Type: cd tomita

*Press Enter.

cd means ‘Change directory’. This tells your computer where to go.

Tell your computer to run the program.

You are about to type a lot of text into your Terminal, a little bit at a time.

Don’t press enter until you see the “Press Enter Now” instruction.

If you do press it - not to worry!
You can simply start typing the command again.

Type in this text exactly as it is written here.
Remember the Do’s and Don’ts!

Type: th samplepi.lua cv/tomita-deepascii.t7


9. I did it! But what does that mean?

  • th opens the Torch program. It uses machine learning to teach computers.

  • tomita-deepascii.t7 is a neural network. It is made up of connected ‘cells’ – just like the ones in your brain – that can store data. Data is what we call a collection of information.

  • samplepi.lua is a computer program. It pulls the data out of the connected ‘cells’, and uses it to write the new code.

10. Tell your computer how much code to write.

Carry on typing in the same line.

Remember not to press the enter button.

Type: -gpuid -1 -length 1000


  • -gpuid tells the computer how to use its brain to process the code.
  • -length 1000 tells your computer to make 1000 characters of new code. Later, we'll turn that code into art!

11. Give your computer a starting point.

Carry on typing in the same line.

Remember not to press the enter button.

Type: -primetext "background"


  • -primetext controls the first word in the pattern – this time, it’s “background”.
  • Your computer is using patterns to make new code. This tells your computer to start the new code with the word “background”.

12. Control the code.

Now, for the last part of the command.

Remember not to press the enter button.

Type: -seed 1000


The program needs to make 1000 new characters. It uses a number to decide which characters to create.

This is called the seed – it helps the computer grow the code.

Every seed number will make its own, unique code.

13. Press Enter!

This is what your command should look like:


Now press the enter button.

Can you see what the computer is creating? Is there anything you recognise?

It's making the code for a new piece of art.

Next, let's turn that code into a picture!