From b976f2526bcf4a92d0f512201df6f6ea7386f84a Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Fri, 29 Jan 2021 14:02:58 +0100 Subject: [PATCH] Music to Crash Cars To, Bruebach, Alexis Alexoudis & Hardyville. --- cards/neural/archetypical-cuda1.sh | 15 ++++++++--- cards/neural/enfilminate.sh | 7 +++++ cards/neural/glow.py | 41 ++++++++++++++++++++++++++++++ cards/neural/hexagrams-cuda1.sh | 30 ++++++++++++++++++++++ cards/neural/phrases-cuda0.sh | 30 ++++++++++++++++++++++ cards/neural/phrases-cuda1.sh | 30 ++++++++++++++++++++++ 6 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 cards/neural/enfilminate.sh create mode 100644 cards/neural/glow.py create mode 100644 cards/neural/hexagrams-cuda1.sh create mode 100644 cards/neural/phrases-cuda0.sh create mode 100644 cards/neural/phrases-cuda1.sh diff --git a/cards/neural/archetypical-cuda1.sh b/cards/neural/archetypical-cuda1.sh index 0f2c282..2f732b6 100644 --- a/cards/neural/archetypical-cuda1.sh +++ b/cards/neural/archetypical-cuda1.sh @@ -7,7 +7,7 @@ PLACE=/tmp/neural mkdir -p $PLACE cd $PLACE -echo "using the Superject archetype..." +echo "using the Superject archetypes..." occasions=("Journey" "Science" "Magic" "Nature" "Power" "Education" "Connection" "Obstacle" "Tool" "Retreat" "Fortune" "Justice" "Sacrifice" "Death" "Art" "Decay" "Ruin" "Mystery" "Bridge" "Energy" "Transformation" "World") @@ -16,9 +16,18 @@ qualia=("Sad" "Happy" "Fear" "Surprise" "Angry" "Disgust" "Grief" "Hunger" "Love lures=("Assemble" "Cook" "Destroy" "Hex" "Enact" "Exchange" "Experiment" "Gather" "Give" "Grow" "Repair" "Make" "Perform" "Play" "Protect" "Prototype" "Question" "Resist" "Reverse" "Serve" "Solve" "Trick") -echo "qualia..." +echo "occasions..." -for i in "${qualia[@]}" +for i in "${occasions[@]}" + do + export CUDA_VISIBLE_DEVICES=1 + echo "dreaming $i" + dream $i --save-progress --save-every 30 --epochs=6 --iterations=600 +done + +echo "lures..." + +for i in "${lures[@]}" do export CUDA_VISIBLE_DEVICES=1 echo "dreaming $i" diff --git a/cards/neural/enfilminate.sh b/cards/neural/enfilminate.sh new file mode 100644 index 0000000..ff46e09 --- /dev/null +++ b/cards/neural/enfilminate.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +NAME=$1 + +echo "composing $1" + +ffmpeg -r 24 -f image2 -s 1920x1080 -i "$NAME".%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p "$NAME"_x0.mp4 diff --git a/cards/neural/glow.py b/cards/neural/glow.py new file mode 100644 index 0000000..3074230 --- /dev/null +++ b/cards/neural/glow.py @@ -0,0 +1,41 @@ + +# via https://github.com/huggingface/pytorch-pretrained-BigGAN + +import torch +from pytorch_pretrained_biggan import (BigGAN, one_hot_from_names, truncated_noise_sample, + save_as_images, display_in_terminal) + +# OPTIONAL: if you want to have more information on what's happening, activate the logger as follows +import logging +logging.basicConfig(level=logging.INFO) + +# Load pre-trained model tokenizer (vocabulary) +model = BigGAN.from_pretrained('biggan-deep-512') + +# Prepare a input +truncation = 0.4 +class_vector = one_hot_from_names(['soap bubble', 'coffee', 'mushroom'], batch_size=3) +noise_vector = truncated_noise_sample(truncation=truncation, batch_size=3) + +# All in tensors +noise_vector = torch.from_numpy(noise_vector) +class_vector = torch.from_numpy(class_vector) + +# If you have a GPU, put everything on 'cuda' +noise_vector = noise_vector.to('cpu') +class_vector = class_vector.to('cpu') +model.to('cpu') + +# Generate an image +with torch.no_grad(): + output = model(noise_vector, class_vector, truncation) + +# If you have a GPU put back on CPU +output = output.to('cpu') + +# If you have a sixtel compatible terminal you can display the images in the terminal +# (see https://github.com/saitoha/libsixel for details) +display_in_terminal(output) + +# Save results as png images +save_as_images(output) diff --git a/cards/neural/hexagrams-cuda1.sh b/cards/neural/hexagrams-cuda1.sh new file mode 100644 index 0000000..0942275 --- /dev/null +++ b/cards/neural/hexagrams-cuda1.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# a simple script to test a linode GPU instance for superject abstraction + +PLACE=/tmp/neural/hexagrams + +mkdir -p $PLACE +cd $PLACE + +echo "using the HEXAGRAMS..." + +hexagrams=("The Creative Heaven" "The Receptive Earth" "Difficulty At The Beginning" "Youthful Folly" "Waiting" "Conflict" "The Army" "Holding Together" "Small Taming" "Treading" "Peace" "Standstill" "Fellowship" "Great Possession" "Modesty" "Enthusiasm" "Following" "Work On The Decayed" "Approach" "Contemplation" "Biting Through" "Grace" "Splitting Apart" "Return" "Innocence" "Great Taming" "Mouth Corners" "Great Preponderance" "The Abysmal Water" "The Clinging Fire" "Influence" "Duration" "Retreat" "Great Power" "Progress" "Darkening Of The Light" "The Family" "Opposition" "Obstruction" "Deliverance" "Decrease" "Increase" "Breakthrough" "Coming To Meet" "Gathering Together" "Pushing Upward" "Oppression" "The Well" "Revolution" "The Cauldron" "The Arousing Thunder" "The Keeping Still Mountain" "Development" "The Marrying Maiden" "Abundance" "The Wanderer" "The Gentle Wind" "The Joyous Lake" "Dispersion" "Limitation" "Inner Truth" "Small Preponderance" "After Completion") + +echo "bifold trigram..." + +for i in "${hexagrams[@]}" + do + export CUDA_VISIBLE_DEVICES=1 + echo "dreaming $i" + dream "$i" --save-progress --save-every 10 --epochs=1 --iterations=100 --image-size=512 +done + + +#export CUDA_VISIBLE_DEVICES=1 + +# note in big-sleep.py -> torch,cuda.set_device(1) +# and/or CUDA_VISIBLE_DEVICES=1,2 python myscript.py + + +# ffmpeg -r 24 -f image2 -s 1920x1080 -i The_Grand_Evocateur_of_intensity.%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p The_Grand_Evocateur_of_intensity_m3.mp4 diff --git a/cards/neural/phrases-cuda0.sh b/cards/neural/phrases-cuda0.sh new file mode 100644 index 0000000..0edea5e --- /dev/null +++ b/cards/neural/phrases-cuda0.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# a simple script to test a linode GPU instance for superject abstraction + +PLACE=/tmp/neural/tarot + +mkdir -p $PLACE +cd $PLACE + +echo "using the Tarot..." + +phrases=("An energetic nomad on a long hike with wooden staff a green leaf and a small dog." "At the beginning of a magical quest for wisdom an animus of a conman hide beneath the table." "A charismatic female figure meditates on the book of flesh in isolation, oval and white." "Fertility of nature in small green leaves, adam's apple, a pyramid and a baby eagle's wing." "The alchemical gold adorns the throne in a powerful house rooted in matter.") + +echo "cosmic entanglement..." + +for i in "${phrases[@]}" + do + export CUDA_VISIBLE_DEVICES=0 + echo "dreaming $i" + dream "$i" --save-progress --save-every 20 --epochs=6 --iterations=800 --image-size=512 +done + + +#export CUDA_VISIBLE_DEVICES=1 + +# note in big-sleep.py -> torch,cuda.set_device(1) +# and/or CUDA_VISIBLE_DEVICES=1,2 python myscript.py + + +# ffmpeg -r 24 -f image2 -s 1920x1080 -i The_Grand_Evocateur_of_intensity.%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p The_Grand_Evocateur_of_intensity_m3.mp4 diff --git a/cards/neural/phrases-cuda1.sh b/cards/neural/phrases-cuda1.sh new file mode 100644 index 0000000..f421c0e --- /dev/null +++ b/cards/neural/phrases-cuda1.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# a simple script to test a linode GPU instance for superject abstraction + +PLACE=/tmp/neural/tarot + +mkdir -p $PLACE +cd $PLACE + +echo "using the Tarot..." + +phrases=("An energetic nomad on a long hike with wooden staff a green leaf and a small dog." "At the beginning of a magical quest for wisdom an animus of a conman hide beneath the table." "A charismatic female figure meditates on the book of flesh in isolation, oval and white." "Fertility of nature in small green leaves, adam's apple, a pyramid and a baby eagle's wing." "The alchemical gold adorns the throne in a powerful house rooted in matter.") + +echo "cosmic entanglement..." + +for i in "${phrases[@]}" + do + export CUDA_VISIBLE_DEVICES=1 + echo "dreaming $i" + dream "$i" --save-progress --save-every 40 --epochs=6 --iterations=800 --image-size=512 +done + + +#export CUDA_VISIBLE_DEVICES=1 + +# note in big-sleep.py -> torch,cuda.set_device(1) +# and/or CUDA_VISIBLE_DEVICES=1,2 python myscript.py + + +# ffmpeg -r 24 -f image2 -s 1920x1080 -i The_Grand_Evocateur_of_intensity.%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p The_Grand_Evocateur_of_intensity_m3.mp4