Coder Social home page Coder Social logo

vqgan-clip-animations's Introduction

AI image generation/animation

A badge showing that this repo is unmaintained as of 2023

Main notebook

Click the button below to run the notebook in Google Colab
Open main notebook in Colab

Helper tools

Two helper tools for this notebook are available:

Interesting/Notable Uses

Helper spreadsheet

@EphemeralInc made a useful spreadsheet to help construct large keyframe strings.

Donation Link

If you want, you can donate to support me at ko-fi. No pressure (but I'd love to know if you create cool art, or just had fun!).

Buy Me a Coffee at ko-fi.com

vqgan-clip-animations's People

Contributors

chigozienri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vqgan-clip-animations's Issues

Cannot load VQGAN models

I get an error that VQGAN model file was not found. It seems that the mirror.io links are down?

I tried to replace the links with ones I found from Reddit (https://www.reddit.com/r/deepdream/comments/o2slfu/vqganclip_notebook_broken_vqganmirrors_disabled/), and they load and that cell runs ok, but I still get the File not found -error in a later cell.

This line is highlighted:
model = load_vqgan_model(args.vqgan_config, args.vqgan_checkpoint).to(device)

(And sorry if this is a stupid question, I don't really know anything about coding... :D)

"Target_Image" not working

I want to make a looping render so I set the seed and collected the first image and when I upload it and copy path to the "target_image" it gives me an error, "RuntimeError: Key Frame string not correctly formatted: /content/0001.png".

Is this a bug or is there a way to keyframe text to image as well as have an ending target image or how do I keyframe it to start rendering that image?
Screenshot 2022-11-11 210404
Screenshot 2022-11-11 210438

cannot generate video

Describe the bug
In trying to generate a video i keep getting a runtime error.

Parameters used
Paste in the parameters you used
Dont have all this info any longer but resolution was 400x400

Which cell you saw the error in
Make a video of the results

Error message
RuntimeError Traceback (most recent call last)
in ()
44 stdout, stderr = process.communicate()
45 if process.returncode != 0:
---> 46 raise RuntimeError(stderr)
47 print(stderr)
48 print(

RuntimeError: b"ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers\n built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)\n configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared\n libavutil 55. 78.100 / 55. 78.100\n libavcodec 57.107.100 / 57.107.100\n libavformat 57. 83.100 / 57. 83.100\n libavdevice 57. 10.100 / 57. 10.100\n libavfilter 6.107.100 / 6.107.100\n libavresample 3. 7. 0 / 3...
Screen Shot 2021-10-01 at 1 12 46 PM
Screen Shot 2021-10-01 at 1 12 26 PM

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
I have attempted to terminate and restart. Pardon my ignorance in this. Just learning. I was able to create a video on my first pass but ever since I have encountered issues. Also, I am on Colab pro plus.

Fixed random Seed does not create the same results

Using a fixed random seed does not produce the same result, even with an initial_image as starting point.

I guess there are different seed values in some sub routines - do you think it is possible to fix all these to make 100% reproducible results?

My hope would be, that animation would get more stable then. But maybe I'm wrong and this would not help to tame the temporal incoherence...

Video cell error

Hi,

For some reason, I am receiving this error every time the "create video" cell tries to run. Everything works smoothly before that. What might be the reason?

Screenshot 2021-08-30 at 0 19 06

ImportError: 1.3 Install and load libraries and definitions

Describe the bug
Have not gotten very far but in zone 1.3 Install and load libraries and definitions it gives me a runtime error:
ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/distributed.py)
Was wondering if there was a solution to his, running this on collabs.

Parameters used
N/A did not get here

Which cell you saw the error in
1.3

Error message
ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed'

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here. e.g. Had you restarted to use only the video generation cells? Are you using google drive?

Can no longer successfully run the cell "Installation and loading of libraries and definitions"

This is in regard to:
https://colab.research.google.com/github/chigozienri/VQGAN-CLIP-animations/blob/main/VQGAN-CLIP-animations.ipynb

I used to have no problem running this colab (even as recently as last night) but now I'm suddenly getting an error when I run the cell called "Installation and loading of libraries and definitions".

Here's the error that keeps happening:

ImportError Traceback (most recent call last)
in ()
52 from omegaconf import OmegaConf
53 from PIL import Image
---> 54 from taming.models import cond_transformer, vqgan
55 import torch
56 from torch import nn, optim

10 frames
/content/taming-transformers/taming/models/cond_transformer.py in ()
2 import torch
3 import torch.nn.functional as F
----> 4 import pytorch_lightning as pl
5
6 from main import instantiate_from_config

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/init.py in ()
18 _PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT)
19
---> 20 from pytorch_lightning.callbacks import Callback # noqa: E402
21 from pytorch_lightning.core import LightningDataModule, LightningModule # noqa: E402
22 from pytorch_lightning.trainer import Trainer # noqa: E402

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/callbacks/init.py in ()
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 14 from pytorch_lightning.callbacks.base import Callback
15 from pytorch_lightning.callbacks.device_stats_monitor import DeviceStatsMonitor
16 from pytorch_lightning.callbacks.early_stopping import EarlyStopping

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/callbacks/base.py in ()
24
25 import pytorch_lightning as pl
---> 26 from pytorch_lightning.utilities.types import STEP_OUTPUT
27
28

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/init.py in ()
16 import numpy
17
---> 18 from pytorch_lightning.utilities.apply_func import move_data_to_device # noqa: F401
19 from pytorch_lightning.utilities.distributed import AllGatherGrad, rank_zero_info, rank_zero_only # noqa: F401
20 from pytorch_lightning.utilities.enums import ( # noqa: F401

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/apply_func.py in ()
27
28 if _TORCHTEXT_AVAILABLE:
---> 29 if _compare_version("torchtext", operator.ge, "0.9.0"):
30 from torchtext.legacy.data import Batch
31 else:

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/imports.py in _compare_version(package, op, version, use_base_version)
52 """
53 try:
---> 54 pkg = importlib.import_module(package)
55 except (ModuleNotFoundError, DistributionNotFound):
56 return False

/usr/lib/python3.7/importlib/init.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129

/usr/local/lib/python3.7/dist-packages/torchtext/init.py in ()
3 from . import datasets
4 from . import utils
----> 5 from . import vocab
6 from . import legacy
7 from ._extension import _init_extension

/usr/local/lib/python3.7/dist-packages/torchtext/vocab/init.py in ()
9 )
10
---> 11 from .vocab_factory import (
12 vocab,
13 build_vocab_from_iterator,

/usr/local/lib/python3.7/dist-packages/torchtext/vocab/vocab_factory.py in ()
2 from typing import Dict, Iterable, Optional, List
3 from collections import Counter, OrderedDict
----> 4 from torchtext._torchtext import (
5 Vocab as VocabPybind,
6 )

ImportError: /usr/local/lib/python3.7/dist-packages/torchtext/_torchtext.so: undefined symbol: _ZTVN5torch3jit6MethodE


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

[SSL: CERTIFICATE_VERIFY_FAILED]

Describe the bug
I am getting an SSL: Certificate_Verify_Failed error in the "Actually do the run..." cell.

Parameters used
key_frames = True #@param {type:"boolean"}
text_prompts = 0: (a blueprint of human emotion by Wassily Kandinsky: 0| the color of emotion: 0| Love: 0| heart: 0| baby: 0| Acrylic art: 0| memories of a beautiful childhood: 0| impressionism: 0| Hyperrealism: -3), 15: (a blueprint of human emotion by Wassily Kandinsky: 2| the color of emotion: 1.5| Love: 0| heart: 0| baby: 0| Acrylic art: 0| memories of a beautiful childhood: 0| impressionism: 0| Hyperrealism: -3), 63: (a blueprint of human emotion by Wassily Kandinsky: 2| the color of emotion: 1.73| Love: 2| heart: .3| baby: 0| Acrylic art: 2| memories of a beautiful childhood: .3| impressionism: 0| Hyperrealism: -3), 100: (a blueprint of human emotion by Wassily Kandinsky: 2| the color of emotion: 2| Love: 1| heart: 1.1| baby: 1| Acrylic art: 2| memories of a beautiful childhood: 1| impressionism: 0| Hyperrealism: -3), 130: (a blueprint of human emotion by Wassily Kandinsky: .55| the color of emotion: 1.4| Love: .5| heart: 0| baby: 2| Acrylic art: 2| memories of a beautiful childhood: 2| impressionism: 0| Hyperrealism: -3), 243: (a blueprint of human emotion by Wassily Kandinsky: .35| the color of emotion: 1.4| Love: .5| heart: 0| baby: 2| Acrylic art: 2| memories of a beautiful childhood: 1.8| impressionism: 2| Hyperrealism: -3)
width = 400#@param {type:"number"}
height = 400#@param {type:"number"}
model = "vqgan_imagenet_f16_16384" #@param ["vqgan_imagenet_f16_16384", "vqgan_imagenet_f16_1024", "wikiart_16384", "coco", "faceshq", "sflckr"]
interval = 1#@param {type:"number"}
initial_image = /content/GRIDS/GRID_full_F8b.png
target_images = 0: (/content/GRIDS/GRID_full_F8b.png: 2| /content/baby_1.png: 0), 30: (/content/GRIDS/GRID_full_F8b.png: 0| /content/baby_1.png: 0), 200: (/content/GRIDS/GRID_full_F8b.png: 0| /content/baby_1.png: 3)
seed = -1
max_frames = 301
angle = 0: (1.031), 159: (0)
zoom = 0: (1.03), 5: (1.034), 145: (1.08), 155: (1.08), 243: (1)
translation_x = 0: (0)
translation_y = 0: (0)
iterations_per_frame = 0: (13), 300: (33)
save_all_iterations = False#@param {type:"boolean"}

Which cell you saw the error in
Actually do the run

Error message
Cleared Accounted PIDs for GPU 00000000:00:04.0.
All done.
Using device: cuda:0
Using seed: 14080064489281205813
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to /root/.cache/torch/hub/checkpoints/vgg16-397923af.pth

SSLCertVerificationError Traceback (most recent call last)
/usr/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1349 h.request(req.get_method(), req.selector, req.data, headers,
-> 1350 encode_chunked=req.has_header('Transfer-encoding'))
1351 except OSError as err: # timeout error

25 frames
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
/usr/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1350 encode_chunked=req.has_header('Transfer-encoding'))
1351 except OSError as err: # timeout error
-> 1352 raise URLError(err)
1353 r = h.getresponse()
1354 except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)>

Screenshots
Screenshot attached

Additional context
I am using google drive. I've been successfully using this for close to a month since purchasing pro+. I've had other errors before and solved them, but this is the first I've received this error and I just can't figure it out. Please advise! Thank you!
certification verify failed

curl: (6) Could not resolve host: mirror.io.community -Error when trying to install data sets

When I try to install imagenet or wikiart data sets on the Colab notebook I get these errors.

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: mirror.io.community
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: mirror.io.community
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: mirror.io.community
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: mirror.io.community

Optional: SRCNN for increasing resolution – upscaled images don't get saved when using GPU runtime

https://colab.research.google.com/github/chigozienri/VQGAN-CLIP-animations/blob/main/VQGAN-CLIP-animations.ipynb

They get saved ok when using TPU runtime (but this is too slow). They seem to go missing when using GPU runtime.

Might well be a fault I'm making as I am a fumbling luddite, but the above seems true when no other parameters are changed so I don't know why it would be.

works amazingly otherwise

Import Error: ---> 26 from taming.models import cond_transformer, vqgan

Describe the bug

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-8-dbaa526c00d0> in <module>()
     24 from omegaconf import OmegaConf
     25 from PIL import Image
---> 26 from taming.models import cond_transformer, vqgan
     27 import torch
     28 from torch import nn, optim

3 frames
/content/taming-transformers/taming/data/helper_types.py in <module>()
----> 1 from typing import Dict, Tuple, Literal, Optional, NamedTuple, Union
      2 
      3 from PIL.Image import Image as pil_image
      4 from torch import Tensor
      5 

ImportError: cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py)

Parameters used
Did not get to parameters

Which cell you saw the error in
"# @title Loading of libraries and definitions"

Error message
See above

notebook is using a pytorch version not compatible with A100

Is your feature request related to a problem? Please describe.
Im trying to run the VQGan notebook and im using colab Pro+ and they must have got a boat load of new A100s, because everytime I connect I get it! Which should be awesome, but...the notebook is showing me the error I pasted below. Your help is appreciated. Thank you!

Describe the solution you'd like
If possible can you show me where to add the call to load the correct version of pytorch that will work well with the A100s?
Describe alternatives you've considered
I tried to get a different GPU, by closing and restarting, and trying different note books, but I keep getting A100s
Additional context

Here is the error im getting.

Cleared Accounted PIDs for GPU 00000000:00:04.0.
All done.
Using device: cuda:0
Using seed: 1
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
Restored from sflckr.ckpt
/usr/local/lib/python3.7/dist-packages/torch/cuda/init.py:106: UserWarning:
A100-SXM4-40GB with CUDA capability sm_80 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the A100-SXM4-40GB GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
100%|████████████████████████████████████████| 338M/338M [00:01<00:00, 191MiB/s]

RuntimeError Traceback (most recent call last)
in ()
44 toksX, toksY = args.size[0] // f, args.size[1] // f
45 sideX, sideY = toksX * f, toksY * f
---> 46 z_min = model.quantize.embedding.weight.min(dim=0).values[None, :, None, None]
47 z_max = model.quantize.embedding.weight.max(dim=0).values[None, :, None, None]
48 stop_on_next_loop = False # Make sure GPU memory doesn't get corrupted from cancelling the run mid-way through, allow a full frame to complete

RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

the working_dir tab is gone and I cannot actually do the run

Describe the bug
A clear and concise description of what the bug is.

Parameters used
Paste in the parameters you used
e.g.
key_frames = True #@param {type:"boolean"}
text_prompts = "10:(Apple: 1| Orange: 0), 20: (Apple: 0| Orange: 1| Peach: 1)" #@param {type:"string"}
width = 400#@param {type:"number"}
height = 400#@param {type:"number"}
model = "vqgan_imagenet_f16_16384" #@param ["vqgan_imagenet_f16_16384", "vqgan_imagenet_f16_1024", "wikiart_16384", "coco", "faceshq", "sflckr"]
interval = 1#@param {type:"number"}
initial_image = ""#@param {type:"string"}
target_images = ""#@param {type:"string"}
seed = 1#@param {type:"number"}
max_frames = 50#@param {type:"number"}
angle = "10: (0), 30: (10), 50: (0)"#@param {type:"string"}
zoom = "10: (1), 30: (1.2), 50: (1)"#@param {type:"string"}
translation_x = "0: (0)"#@param {type:"string"}
translation_y = "0: (0)"#@param {type:"string"}
iterations_per_frame = "0: (10)"#@param {type:"string"}
save_all_iterations = False#@param {type:"boolean"}

Which cell you saw the error in
e.g. "Actually do the run"

Error message
Paste in the traceback you saw

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here. e.g. Had you restarted to use only the video generation cells? Are you using google drive?

Blurry images generated when i != 0

The execution works but it produces blurry images after the first iteration.

Parameters:
image

Example of issue:
image

For any prompt, it does that. The images after the very first one are always completely blurry. What might be the cause of this?

A100 Support

When using a A100 (Pro+) the processing is dramatically slow, several times slower than a P100/V100.

This is probably an issue with one of the libraries, but I could not figure out which one.

Any comments appreciated, thank you very much.

NameError: name 'filepath' is not defined

Hi
I'm getting this error after upscaling frames and trying to "make a video of the results". I wasn't having any issues initially, but have since had a hard time upscaling, creating, and doing the slow mo.
Restarting runtime and going through a few cells sometimes helps. Changing the 'i' to the last frame seems to work intermittently.
If you could help me understand if I'm doing something wrong, I'd really appreciate it. I am a total noob, so i feel like a caveman trying to troubleshoot this.
Thank you
Screen Shot 2021-09-20 at 11 24 07 AM
Screen Shot 2021-09-20 at 9 34 19 AM
!!

File name too long

first time user,
tried with default settings after not being able to with custom ones.
getting this error message

apologies if this is a dumb question

Cleared Accounted PIDs for GPU 00000000:00:04.0.
All done.
Using device: cuda:0
Using seed: 17729675578306137288

OSError Traceback (most recent call last)
in ()
34 print('Using seed:', seed)
35
---> 36 model = load_vqgan_model(args.vqgan_config, args.vqgan_checkpoint).to(device)
37 perceptor = clip.load(args.clip_model, jit=False)[0].eval().requires_grad_(False).to(device)
38

1 frames
/usr/local/lib/python3.7/dist-packages/omegaconf/omegaconf.py in load(file_)
181
182 if isinstance(file_, (str, pathlib.Path)):
--> 183 with io.open(os.path.abspath(file_), "r", encoding="utf-8") as f:
184 obj = yaml.load(f, Loader=get_yaml_loader())
185 elif getattr(file_, "read", None):

OSError: [Errno 36] File name too long: '/content/VQModel(\n (encoder): Encoder(\n (conv_in): Conv2d(3, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n (down): ModuleList(\n (0): Module(\n (block): ModuleList(\n (0): ResnetBlock(\n (norm1): GroupNorm(32, 128, eps=1e-06, affine=True)\n (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n (norm2): GroupNorm(32, 128, eps=1e-06, affine=True)\n (dropout): Dropout(p=0.0, inplace=False)\n (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ResnetBlock(\n (norm1): GroupNorm(32, 128, eps=1e-06, affine=True)\n (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n (norm2): GroupNorm(32, 128, eps=1e-06, affine=True)\n (dropout): Dropout(p=0.0, inplace=False)\n (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (attn): ModuleList()\n (downsample): Downsample(\n (conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(2, 2))\n )\n )\n (1): Module(\n (block): ModuleList(\n (0): ResnetBlock(\n (norm1): GroupNorm(32, 128, eps=1e-06, affine=True)\n (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n (norm2): GroupNorm(32...

Screen Shot 2022-01-20 at 7 10 50 pm

Add MSE regularization

Apologies if my terminology is not good, I'm not very well versed in the behind the scenes. Recently, there's been a notebook which added linearly decreasing MSE values, and the results are IMO much better and more coherent. Here's the notebook: https://colab.research.google.com/drive/1gFn9u3oPOgsNzJWEFmdK-N9h_y65b8fj?usp=sharing and here's a Reddit post on it: https://www.reddit.com/r/bigsleep/comments/onmz5r/mse_regulized_vqgan_clip/

Would it be feasible and/or straightforward to add that ability to your notebook? I'm going to take a crack at it myself but not knowing the code I'll be basically just working through the diffs and blindly grabbing lines that seem like they'll help.

Several missing module errors in vqgan

Describe the bug
Every time I try and download the image libraries, i get the set of errors below. This error consists throughout all VQGAN colab libraries I can find.

Parameters used
errors happened before getting to parameters

Which cell you saw the error in
Prepare Folders

Error message

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 50>()
48 from omegaconf import OmegaConf
49 from PIL import Image
---> 50 from taming.models import cond_transformer, vqgan
51 import torch
52 from torch import nn, optim

2 frames
/content/./taming-transformers/taming/models/cond_transformer.py in
4 import pytorch_lightning as pl
5
----> 6 from main import instantiate_from_config
7 from taming.modules.util import SOSProvider
8

/content/./taming-transformers/main.py in
12 from pytorch_lightning.utilities import rank_zero_only
13
---> 14 from taming.data.utils import custom_collate
15
16

/content/./taming-transformers/taming/data/utils.py in
9 import torch
10 from taming.data.helper_types import Annotation
---> 11 from torch._six import string_classes
12 from torch.utils.data._utils.collate import np_str_obj_array_pattern, default_collate_err_msg_format
13 from tqdm import tqdm

ModuleNotFoundError: No module named 'torch._six'


I was banking on having this tool available, but like I said, it seems all vqgan colabs I can find are relying on whatever is now broken.

Out of memory

Error in the section "actually do the run"

After adding both a init image and target image I get out of memory. Fresh setup and factory restored everything.

`
Cleared Accounted PIDs for GPU 00000000:00:04.0.
All done.
Using device: cuda:0
Using seed: 1
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to /root/.cache/torch/hub/checkpoints/vgg16-397923af.pth
100%
528M/528M [00:05<00:00, 98.3MB/s]
Downloading vgg_lpips model from https://heibox.uni-heidelberg.de/f/607503859c864bc1b30b/?dl=1 to taming/modules/autoencoder/lpips/vgg.pth
8.19kB [00:00, 488kB/s]
loaded pretrained LPIPS loss from taming/modules/autoencoder/lpips/vgg.pth
VQLPIPSWithDiscriminator running with hinge loss.
Restored from vqgan_imagenet_f16_16384.ckpt
100%|███████████████████████████████████████| 338M/338M [00:05<00:00, 59.1MiB/s]
text_prompts: ['Ape: 1.0', 'Cryptopunk: 0.0']angle: 0.0 zoom: 1.0 translation_x: 0.0 translation_y: 0.0 iterations_per_frame: 10
0/? [00:02<?, ?it/s]

RuntimeError Traceback (most recent call last)
in ()
231 train(i, save=True, suffix=suffix)
232 else:
--> 233 train(i, save=False, suffix=suffix)
234 j += 1
235 pbar.update()

14 frames
in train(i, save, suffix)
210 def train(i, save=True, suffix=None):
211 opt.zero_grad()
--> 212 lossAll = ascend_txt(i, save=save, suffix=suffix)
213 if i % args.display_freq == 0 and save:
214 checkin(i, lossAll)

in ascend_txt(i, save, suffix)
193 def ascend_txt(i, save=True, suffix=None):
194 out = synth(z)
--> 195 iii = perceptor.encode_image(normalize(make_cutouts(out))).float()
196
197 result = []

/content/CLIP/clip/model.py in encode_image(self, image)
335
336 def encode_image(self, image):
--> 337 return self.visual(image.type(self.dtype))
338
339 def encode_text(self, text):

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/content/CLIP/clip/model.py in forward(self, x)
226
227 x = x.permute(1, 0, 2) # NLD -> LND
--> 228 x = self.transformer(x)
229 x = x.permute(1, 0, 2) # LND -> NLD
230

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/content/CLIP/clip/model.py in forward(self, x)
197
198 def forward(self, x: torch.Tensor):
--> 199 return self.resblocks(x)
200
201

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/container.py in forward(self, input)
137 def forward(self, input):
138 for module in self:
--> 139 input = module(input)
140 return input
141

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/content/CLIP/clip/model.py in forward(self, x)
184
185 def forward(self, x: torch.Tensor):
--> 186 x = x + self.attention(self.ln_1(x))
187 x = x + self.mlp(self.ln_2(x))
188 return x

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/content/CLIP/clip/model.py in forward(self, x)
156 def forward(self, x: torch.Tensor):
157 orig_type = x.dtype
--> 158 ret = super().forward(x.type(torch.float32))
159 return ret.type(orig_type)
160

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/normalization.py in forward(self, input)
172 def forward(self, input: Tensor) -> Tensor:
173 return F.layer_norm(
--> 174 input, self.normalized_shape, self.weight, self.bias, self.eps)
175
176 def extra_repr(self) -> str:

/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in layer_norm(input, normalized_shape, weight, bias, eps)
2344 layer_norm, (input,), input, normalized_shape, weight=weight, bias=bias, eps=eps
2345 )
-> 2346 return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
2347
2348

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 11.17 GiB total capacity; 10.55 GiB already allocated; 9.81 MiB free; 10.68 GiB reserved in total by PyTorch)`

The GPU log
`Fri Sep 17 20:04:09 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.63.01 Driver Version: 460.32.03 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 00000000:00:04.0 Off | 0 |
| N/A 31C P8 29W / 149W | 0MiB / 11441MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+`

How to resume from last frame after disconnect?

First of all, thank you for setting up this great Colab!

I have trouble generating my animations because Google Colab disconnects before it's finished (even tho I am not idle and interact with the screen every few minutes).

Is there a way to not have to start over again and instead resume image generation from the last generated frame?

Cant get the FacesHQ or Sflickr to work...

imagenet models an wikiart work great but I get this error with the others:

Cleared Accounted PIDs for GPU 00000000:00:04.0.
All done.
Using device: cuda:0
Using seed: 1
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-69-76cb74c215a0> in <module>()
     34 print('Using seed:', seed)
     35 
---> 36 model = load_vqgan_model(args.vqgan_config, args.vqgan_checkpoint).to(device)
     37 perceptor = clip.load(args.clip_model, jit=False)[0].eval().requires_grad_(False).to(device)
     38 

11 frames
/content/taming-transformers/taming/modules/transformer/mingpt.py in <module>()
     15 import torch.nn as nn
     16 from torch.nn import functional as F
---> 17 from transformers import top_k_top_p_filtering
     18 
     19 logger = logging.getLogger(__name__)

ModuleNotFoundError: No module named 'transformers'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Super-slomo error related to ffmpeg version

Describe the bug
Super-slomo does not work, reporting an error related to ffmpeg version.
Everytime when I click the super-slomo cell(after downloading the Super-Slomo model), I would receive the above error. The rest of the cells(Video generation and video upscale) run in the right way.

I am using Google drive. GPU: K80 or T4 (same error). I have tried to restart the notebook and only run the Spuer-Slomo cell (after choosing google drive, installing and loading libraries and define the variable filepath with the path to the video) for tons of times. But I still receive the same error.

Apologies if this is a dumb question

Which cell you saw the error in
"SLOW_MOTION_FACTOR & TARGET_FPS:"

Error message
RuntimeError Traceback (most recent call last)
in ()
22 stdout, stderr = process.communicate()
23 if process.returncode != 0:
---> 24 raise RuntimeError(stderr)
25
26 cmd2 = [

RuntimeError: b'ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers\n built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)\n configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared\n libavutil 55. 78.100 / 55. 78.100\n libavcodec 57.107.100 / 57.107.100\n libavformat 57. 83.100 / 57. 83.100\n libavdevice 57. 10.100 / 57. 10.100\n libavfilter 6.107.100 / 6.107.100\n libavresample 3. 7. 0 / 3...

Screenshots
sp220226_121533

Additional context
I am using Google drive. GPU: K80 or T4. I have tried to restart the notebook and only run the Spuer-Slomo cell (after choosing google drive, installing and loading libraries and defining the variable filepath with the path to the video) for tons of times. But I still receive the same error.

Running Collab locally through Jupyter Notebook

I wanted to use the collab to create videos with vqgan. The use of the google gpus/tpus is very restricted, so i wanted to run it locally over my own gpu. I saw that you could either connect the collab to the jupyther notebook with a link or with the downloaded jupyter file that you can run in the notebook. Both these alternatives give me the same errors unfortunately, but i am very sure that it should be possible. After i run the first lines I get the first error at the stage where it wants to download CLIP. I get multiple syntax errors. Collab uses the same writing of the code, no? I could only explain it to me that it doesnt know which directory it should download it to or something because its obviously different to a google server. Do you know any ways to run this exact collab locally? I am able to run a different version by nerdy rodent, he made the folder with the generate.py public and you cant install everything through anaconda. Is something like that possible? Like adding the keyframe function to the generate.py of the other collab or something? Thanks so much for all your work :)

Module not found errors (2 so far) - omegaconf, taming

Describe the bug
First attempt: ModuleNotFoundError: No module named 'omegaconf'
Refreshed colab and tried again, Second attempt: ModuleNotFoundError: No module named 'taming'

Parameters used
Paste in the parameters you used
Didn't get this far

Which cell you saw the error in
e.g. "Loading of libraries and definitions"

Error message

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-11-dbaa526c00d0> in <module>()
     24 from omegaconf import OmegaConf
     25 from PIL import Image
---> 26 from taming.models import cond_transformer, vqgan
     27 import torch
     28 from torch import nn, optim

ModuleNotFoundError: No module named 'taming'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.