Views
No views yet








1conda create --name vqgan python=3.9
2conda activate vqganpip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.htmlpip install ftfy regex tqdm omegaconf pytorch-lightning IPython kornia imageio imageio-ffmpeg einops torch_optimizerrequirements.txt file, which includes version numbers.1git clone 'https://github.com/nerdyrodent/VQGAN-CLIP'
2cd VQGAN-CLIP
3git clone 'https://github.com/openai/CLIP'
4git clone 'https://github.com/CompVis/taming-transformers'requirements.txt or vqgan.yml files.1mkdir checkpoints
2
3curl -L -o checkpoints/vqgan_imagenet_f16_16384.yaml -C - 'https://heibox.uni-heidelberg.de/d/a7530b09fed84f80a887/files/?p=%2Fconfigs%2Fmodel.yaml&dl=1' #ImageNet 16384
4curl -L -o checkpoints/vqgan_imagenet_f16_16384.ckpt -C - 'https://heibox.uni-heidelberg.de/d/a7530b09fed84f80a887/files/?p=%2Fckpts%2Flast.ckpt&dl=1' #ImageNet 16384curl on Microsoft Windows should use double quotes.download_models.sh script is an optional way to download a number of models. By default, it will download just 1 model.checkpoints directory.
See https://github.com/CompVis/taming-transformers for more information on datasets and models.pip install torch==1.9.0+cu111 ..., use the one or two lines which are displayed here (select Pip -> Python-> ROCm):
https://pytorch.org/get-started/locally/-cd cpuconda remove --name vqgan --allVQGAN-CLIP directory.python generate.py -p "A painting of an apple in a fruit bowl"
python generate.py -p "A painting of an apple in a fruit bowl | psychedelic | surreal:0.5 | weird:0.25"
python generate.py -p "A picture of a bedroom with a portrait of Van Gogh" -ip "samples/VanGogh.jpg | samples/Bedroom.png"python generate.py -p "A painting of a sunflower|photo:-1 ^ a painting of a rose ^ a painting of a tulip ^ a painting of a daisy flower ^ a photograph of daffodil" -cpe 1500 -zvid -i 6000 -zse 10 -vl 20 -zsc 1.005 -opt Adagrad -lr 0.15 -se 6000python generate.py -p "A painting in the style of Picasso" -ii samples/VanGogh.jpg -i 80 -se 10 -opt AdamW -lr 0.25| Output | Style |
|---|---|
![]() | Picasso |
![]() | Sketch |
![]() | Psychedelic |
video_style_dir. Output will be saved in the steps directory, using the original video frame filenames. You can also use this as a sort of "batch mode" if you have a directory of images you want to apply a style to. This can also be combined with Story Mode if you don't wish to apply the same style to every images, but instead roll through a list of styles.zoom.sh shows this by applying a zoom and rotate to generated images, before feeding them back in again.
To use zoom.sh, specifying a text prompt, output filename and number of frames. E.g../zoom.sh "A painting of a red telephone box spinning through a time vortex" Telephone.png 150sudo apt install imagemagick
python generate.py -p "The inside of a sphere" -zvid -i 4500 -zse 20 -vl 10 -zsc 0.97 -opt Adagrad -lr 0.15 -se 4500random.sh to make a batch of images from random text. Edit the text and number of generated images to your taste!./random.shpython generate.py -h1usage: generate.py [-h] [-p PROMPTS] [-ip IMAGE_PROMPTS] [-i MAX_ITERATIONS] [-se DISPLAY_FREQ]
2[-s SIZE SIZE] [-ii INIT_IMAGE] [-in INIT_NOISE] [-iw INIT_WEIGHT] [-m CLIP_MODEL]
3[-conf VQGAN_CONFIG] [-ckpt VQGAN_CHECKPOINT] [-nps [NOISE_PROMPT_SEEDS ...]]
4[-npw [NOISE_PROMPT_WEIGHTS ...]] [-lr STEP_SIZE] [-cuts CUTN] [-cutp CUT_POW] [-sd SEED]
5[-opt {Adam,AdamW,Adagrad,Adamax,DiffGrad,AdamP,RAdam,RMSprop}] [-o OUTPUT] [-vid] [-zvid]
6[-zs ZOOM_START] [-zse ZOOM_FREQUENCY] [-zsc ZOOM_SCALE] [-cpe PROMPT_FREQUENCY]
7[-vl VIDEO_LENGTH] [-ofps OUTPUT_VIDEO_FPS] [-ifps INPUT_VIDEO_FPS] [-d]
8[-aug {Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} [{Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} ...]]
9[-cd CUDA_DEVICE]1optional arguments:
2 -h, --help show this help message and exit
3 -p PROMPTS, --prompts PROMPTS
4 Text prompts
5 -ip IMAGE_PROMPTS, --image_prompts IMAGE_PROMPTS
6 Image prompts / target image
7 -i MAX_ITERATIONS, --iterations MAX_ITERATIONS
8 Number of iterations
9 -se DISPLAY_FREQ, --save_every DISPLAY_FREQ
10 Save image iterations
11 -s SIZE SIZE, --size SIZE SIZE
12 Image size (width height) (default: [512, 512])
13 -ii INIT_IMAGE, --init_image INIT_IMAGE
14 Initial image
15 -in INIT_NOISE, --init_noise INIT_NOISE
16 Initial noise image (pixels or gradient)
17 -iw INIT_WEIGHT, --init_weight INIT_WEIGHT
18 Initial weight
19 -m CLIP_MODEL, --clip_model CLIP_MODEL
20 CLIP model (e.g. ViT-B/32, ViT-B/16)
21 -conf VQGAN_CONFIG, --vqgan_config VQGAN_CONFIG
22 VQGAN config
23 -ckpt VQGAN_CHECKPOINT, --vqgan_checkpoint VQGAN_CHECKPOINT
24 VQGAN checkpoint
25 -nps [NOISE_PROMPT_SEEDS ...], --noise_prompt_seeds [NOISE_PROMPT_SEEDS ...]
26 Noise prompt seeds
27 -npw [NOISE_PROMPT_WEIGHTS ...], --noise_prompt_weights [NOISE_PROMPT_WEIGHTS ...]
28 Noise prompt weights
29 -lr STEP_SIZE, --learning_rate STEP_SIZE
30 Learning rate
31 -cuts CUTN, --num_cuts CUTN
32 Number of cuts
33 -cutp CUT_POW, --cut_power CUT_POW
34 Cut power
35 -sd SEED, --seed SEED
36 Seed
37 -opt, --optimiser {Adam,AdamW,Adagrad,Adamax,DiffGrad,AdamP,RAdam,RMSprop}
38 Optimiser
39 -o OUTPUT, --output OUTPUT
40 Output file
41 -vid, --video Create video frames?
42 -zvid, --zoom_video Create zoom video?
43 -zs ZOOM_START, --zoom_start ZOOM_START
44 Zoom start iteration
45 -zse ZOOM_FREQUENCY, --zoom_save_every ZOOM_FREQUENCY
46 Save zoom image iterations
47 -zsc ZOOM_SCALE, --zoom_scale ZOOM_SCALE
48 Zoom scale
49 -cpe PROMPT_FREQUENCY, --change_prompt_every PROMPT_FREQUENCY
50 Prompt change frequency
51 -vl VIDEO_LENGTH, --video_length VIDEO_LENGTH
52 Video length in seconds
53 -ofps OUTPUT_VIDEO_FPS, --output_video_fps OUTPUT_VIDEO_FPS
54 Create an interpolated video (Nvidia GPU only) with this fps (min 10. best set to 30 or 60)
55 -ifps INPUT_VIDEO_FPS, --input_video_fps INPUT_VIDEO_FPS
56 When creating an interpolated video, use this as the input fps to interpolate from (>0 & <ofps)
57 -d, --deterministic Enable cudnn.deterministic?
58 -aug, --augments {Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} [{Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} ...]
59 Enabled augments
60 -cd CUDA_DEVICE, --cuda_device CUDA_DEVICE
61 Cuda device to useRuntimeError: cusolver error: CUSOLVER_STATUS_INTERNAL_ERROR, when calling cusolverDnCreate(handle)RuntimeError: CUDA out of memory. Tried to allocate 150.00 MiB (GPU 0; 23.70 GiB total capacity; 21.31 GiB already allocated; 78.56 MiB free; 21.70 GiB reserved in total by PyTorch)1@misc{unpublished2021clip,
2 title = {CLIP: Connecting Text and Images},
3 author = {Alec Radford, Ilya Sutskever, Jong Wook Kim, Gretchen Krueger, Sandhini Agarwal},
4 year = {2021}
5}1@misc{esser2020taming,
2 title={Taming Transformers for High-Resolution Image Synthesis},
3 author={Patrick Esser and Robin Rombach and Björn Ommer},
4 year={2020},
5 eprint={2012.09841},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV}
8}