pytti-tools / pytti-book Goto Github PK
View Code? Open in Web Editor NEWPyTTI Documentation and Tutorials
Home Page: https://pytti-tools.github.io/pytti-book/intro.html
PyTTI Documentation and Tutorials
Home Page: https://pytti-tools.github.io/pytti-book/intro.html
Hi, I am trying to animate a video using this notebook on google Colab.
After running for a while the run usually stops at some point due to the runtime timing out or other reasons.
When I run the notebook again with the resume checkbox checked a new Video is generated, rather than the notebook continuing from where it left off.
E.g. pytti-core issue #155
Additionally, could we detect missing config attrs in warmup or something and add them to defaults?
this would be an advanced tutorial, and might actually require some feature development to be realizable.
consider some image X we want to use as an image prompt. run automated captioning on it repeatedly and project the sampled text captions into CLIP space. use the resultant vectors as supplemental guiding CLIP prompts (or pooled into a single prompt prompts).
For each model:
could make this stuff attributes on objects in https://github.com/dmarx/multi-modal-comparators
I ran the following instruction ,but the process stuck at step 299.
%%writefile config/conf/my_first_pytti_art.yaml
# @package _global_
scenes: The swirling cloud of the wormhole is a metaphor for the inner workings of the mind.
steps_per_scene: 500
save_every: 50
display_every: 50
file_namespace: my_first_pytti_art
seed: 123
And it just stuck at step 300 and not moving anymore.
60%|████████████████████████▌ | 300/500 [01:27<00:54, 3.65it/s]2022-03-11 07:19:14.431 | DEBUG | main:update:438 - Step 300 losses:
2022-03-11 07:19:14.431 | DEBUG | main:update:441 - The swirling cloud o..mind. 0.77344
Name: 299, dtype: float64
<PIL.Image.Image image mode=RGB size=720x448 at 0x7F6D63FD1EE0>
probably just need to edit this outside
try to include acknowledgements for "indirect" contributors as well, i.e. people whose names don't appear in commits because their code was incorporated from a shared notebook or something like that.
In step 10 of the setup it says to clone the dev branch of the pytti-core module, but there seems to be no dev branch.
$ git clone --recurse-submodules -j8 --branch dev https://github.com/pytti-tools/pytti-core
Cloning into 'pytti-core'...
fatal: Remote branch dev not found in upstream origin
If I clone without specifying the branch I'm missing the config, images_out and pretrained folder in comparison to the folder structure given under Step 10.
Hi Pytti team,
when I tired out "scenes:sunlight:3_[production ID_4508066.mp4]|midnight:3_[-production ID_4508066.mp4]" on Google Colab, I encountered the erroe "NameError: name 'Image' is not defined". I tried to add hot fix code like "from PIL import Image" in rotoscoper.py but still not working.
Best,
2022-03-14 16:05:09.307 | DEBUG | pytti.workhorse:_main:187 - {'scenes': 'sunlight:3_[production ID_4508066.mp4]|midnight:3_[-production ID_4508066.mp4]', 'scene_prefix': '', 'scene_suffix': '', 'interpolation_steps': 0, 'steps_per_scene': 500, 'direct_image_prompts': '', 'init_image': '', 'direct_init_weight': '', 'semantic_init_weight': '', 'image_model': 'Limited Palette', 'width': 720, 'height': 448, 'pixel_size': 1, 'smoothing_weight': 0.02, 'vqgan_model': 'sflckr', 'random_initial_palette': False, 'palette_size': 6, 'palettes': 9, 'gamma': 1, 'hdr_weight': 0.01, 'palette_normalization_weight': 0.2, 'show_palette': False, 'target_palette': '', 'lock_palette': False, 'animation_mode': '3D', 'sampling_mode': 'bicubic', 'infill_mode': 'wrap', 'pre_animation_steps': 100, 'steps_per_frame': 50, 'frames_per_second': 12, 'direct_stabilization_weight': '', 'semantic_stabilization_weight': '', 'depth_stabilization_weight': '', 'edge_stabilization_weight': '', 'flow_stabilization_weight': '', 'video_path': '', 'frame_stride': 1, 'reencode_each_frame': True, 'flow_long_term_samples': 1, 'translate_x': '-1700*sin(radians(1.5))', 'translate_y': '0', 'translate_z_3d': '(50+10*t)*sin(t/10*pi)**2', 'rotate_3d': '[cos(radians(1.5)), 0, -sin(radians(1.5))/sqrt(2), sin(radians(1.5))/sqrt(2)]', 'rotate_2d': '5', 'zoom_x_2d': '0', 'zoom_y_2d': '0', 'lock_camera': True, 'field_of_view': 60, 'near_plane': 1, 'far_plane': 10000, 'file_namespace': 'default', 'allow_overwrite': False, 'display_every': 50, 'clear_every': 0, 'display_scale': 1, 'save_every': 50, 'backups': 5, 'show_graphs': False, 'approximate_vram_usage': False, 'ViTB32': True, 'ViTB16': False, 'RN50': False, 'RN50x4': False, 'ViTL14': False, 'RN101': False, 'RN50x16': False, 'RN50x64': False, 'learning_rate': None, 'reset_lr_each_frame': True, 'seed': -19922333275351923, 'cutouts': 40, 'cut_pow': 2, 'cutout_border': 0.25, 'gradient_accumulation_steps': 1, 'border_mode': 'clamp', 'models_parent_dir': '.'}
2022-03-14 16:05:09.311 | DEBUG | pytti.workhorse:_main:188 - {'scenes': 'sunlight:3_[production ID_4508066.mp4]|midnight:3_[-production ID_4508066.mp4]', 'scene_prefix': '', 'scene_suffix': '', 'interpolation_steps': 0, 'steps_per_scene': 500, 'direct_image_prompts': '', 'init_image': '', 'direct_init_weight': '', 'semantic_init_weight': '', 'image_model': 'Limited Palette', 'width': 720, 'height': 448, 'pixel_size': 1, 'smoothing_weight': 0.02, 'vqgan_model': 'sflckr', 'random_initial_palette': False, 'palette_size': 6, 'palettes': 9, 'gamma': 1, 'hdr_weight': 0.01, 'palette_normalization_weight': 0.2, 'show_palette': False, 'target_palette': '', 'lock_palette': False, 'animation_mode': '3D', 'sampling_mode': 'bicubic', 'infill_mode': 'wrap', 'pre_animation_steps': 100, 'steps_per_frame': 50, 'frames_per_second': 12, 'direct_stabilization_weight': '', 'semantic_stabilization_weight': '', 'depth_stabilization_weight': '', 'edge_stabilization_weight': '', 'flow_stabilization_weight': '', 'video_path': '', 'frame_stride': 1, 'reencode_each_frame': True, 'flow_long_term_samples': 1, 'translate_x': '-1700*sin(radians(1.5))', 'translate_y': '0', 'translate_z_3d': '(50+10*t)*sin(t/10*pi)**2', 'rotate_3d': '[cos(radians(1.5)), 0, -sin(radians(1.5))/sqrt(2), sin(radians(1.5))/sqrt(2)]', 'rotate_2d': '5', 'zoom_x_2d': '0', 'zoom_y_2d': '0', 'lock_camera': True, 'field_of_view': 60, 'near_plane': 1, 'far_plane': 10000, 'file_namespace': 'default', 'allow_overwrite': False, 'display_every': 50, 'clear_every': 0, 'display_scale': 1, 'save_every': 50, 'backups': 5, 'show_graphs': False, 'approximate_vram_usage': False, 'ViTB32': True, 'ViTB16': False, 'RN50': False, 'RN50x4': False, 'ViTL14': False, 'RN101': False, 'RN50x16': False, 'RN50x64': False, 'learning_rate': None, 'reset_lr_each_frame': True, 'seed': -19922333275351923, 'cutouts': 40, 'cut_pow': 2, 'cutout_border': 0.25, 'gradient_accumulation_steps': 1, 'border_mode': 'clamp', 'models_parent_dir': '.'}
2022-03-14 16:05:09.521 | DEBUG | pytti.workhorse:do_run:242 - 40
2022-03-14 16:05:09.532 | INFO | pytti.workhorse:parse_scenes:110 - Loading prompts...
2022-03-14 16:05:09.846 | INFO | pytti.rotoscoper:get_frames:41 - loaded 751 frames. for production ID_4508066.mp4
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
[<ipython-input-19-3894f198f437>](https://localhost:8080/#) in <module>()
6
7 # function wraps step 2.3 of the original p5 notebook
----> 8 render_frames(cfg)
8 frames
[/usr/local/lib/python3.7/dist-packages/hydra/main.py](https://localhost:8080/#) in decorated_main(cfg_passthrough)
41 def decorated_main(cfg_passthrough: Optional[DictConfig] = None) -> Any:
42 if cfg_passthrough is not None:
---> 43 return task_function(cfg_passthrough)
44 else:
45 args = get_args_parser()
[/usr/local/lib/python3.7/dist-packages/pytti/workhorse.py](https://localhost:8080/#) in _main(cfg)
586 torch.cuda.empty_cache()
587 else:
--> 588 do_run()
589 logger.info("Complete.")
590 gc.collect()
[/usr/local/lib/python3.7/dist-packages/pytti/workhorse.py](https://localhost:8080/#) in do_run()
257 scenes=params.scenes,
258 scene_prefix=params.scene_prefix,
--> 259 scene_suffix=params.scene_suffix,
260 )
261
[/usr/local/lib/python3.7/dist-packages/pytti/workhorse.py](https://localhost:8080/#) in parse_scenes(embedder, scenes, scene_prefix, scene_suffix)
115 if p.strip()
116 ]
--> 117 for stage in scenes.split("||")
118 if stage
119 ]
[/usr/local/lib/python3.7/dist-packages/pytti/workhorse.py](https://localhost:8080/#) in <listcomp>(.0)
116 ]
117 for stage in scenes.split("||")
--> 118 if stage
119 ]
120 logger.info("Prompts loaded.")
[/usr/local/lib/python3.7/dist-packages/pytti/workhorse.py](https://localhost:8080/#) in <listcomp>(.0)
113 parse_prompt(embedder, p.strip())
114 for p in (scene_prefix + stage + scene_suffix).strip().split("|")
--> 115 if p.strip()
116 ]
117 for stage in scenes.split("||")
[/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py](https://localhost:8080/#) in decorate_context(*args, **kwargs)
26 def decorate_context(*args, **kwargs):
27 with self.__class__():
---> 28 return func(*args, **kwargs)
29 return cast(F, decorate_context)
30
[/usr/local/lib/python3.7/dist-packages/pytti/Perceptor/Prompt.py](https://localhost:8080/#) in parse_prompt(embedder, prompt_string, pil_image, device)
223 if roto is not None:
224 roto.target = out
--> 225 roto.update(0)
226 return out
227
[/usr/local/lib/python3.7/dist-packages/pytti/rotoscoper.py](https://localhost:8080/#) in update(self, frame_n)
66 """
67 if self.target is None:
---> 68 return
69 mask_pil = Image.fromarray(self.frames.get_data(frame_n)).convert("L")
70 self.target.set_mask(mask_pil, self.inverted)
NameError: name 'Image' is not defined
e.g. KING - MAN + WOMAN
So I was thinking today about creating an "end objective" direct image prompt, like an init but in reverse. It would trigger steps_from_end_of_scene before completion, and steer the image towards a final product. I can see a whole bunch of applications for it, such as for loops or targeting a specific image instead of building out from one
lol...
https://colab.research.google.com/github/pytti-tools/pytti-notebook/blob/main/pyttitools-PYTTI.ipynb/github/pytti-tools/pytti-book/blob/master/docs/CrashCourse.ipynb
Even if it doesn't necessarily go in a tutorial section or something like that. Use it as an excuse to show off some random experiments or things I didn't feel like writing up but have demonstrations for. Draft posts.
Hell, "half baked docs" could even be a pattern to encourage external contribution.
add a TLDR setup for colab, paperspace, etc:
!git clone https://github.com/pytti-tools/pytti-notebook
%cd pytti-notebook
!pip install jupyter gdown loguru einops seaborn PyGLM ftfy regex tqdm hydra-core adjustText exrex matplotlib-label-lines
!git clone --recurse-submodules -j8 https://github.com/pytti-tools/pytti-core
!pip install ./pytti-core/vendor/AdaBins
!pip install ./pytti-core/vendor/CLIP
!pip install ./pytti-core/vendor/GMA
!pip install ./pytti-core/vendor/taming-transformers
!pip install ./pytti-core
!python -m pytti.warmup
I guess this is already available in the notebook essentially... better to just make it nice and obvious for people.
https://discord.com/channels/869630568818696202/869675528494391307/947668038470217769
direct_init_weight:W*max(k-t,0)
might also be a good idea to separate sections into respective text files to facilitate people consuming the lists programmatically
widget uses Path.glob() to find image folders and files. This is fine for prototyping, but now that this set of files is fixed, let's dump the filenames/URLs/whatever we need into a text file or something like that and modify the build sequence to look there instead of globbing for local image files.
e.g. try to induce a "tilt-shift" effect by finding images of the same scene with and without tilt shift. project both images to clip space, subtract one from the other to get a "prompt" vector that effectively encapsulates a tilt-shift operator.
... I could make several effects of this kind and ship with the library?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.