Skip to content

Commit

Permalink
Dev (#37) - CLI improvements + docs, simpler install
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx authored Feb 13, 2022
1 parent c2caf36 commit 80276ae
Show file tree
Hide file tree
Showing 15 changed files with 264 additions and 122 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "vendor/GMA"]
path = vendor/GMA
url = https://github.com/pytti-tools/GMA
[submodule "vendor/AdaBins"]
path = vendor/AdaBins
url = https://github.com/pytti-tools/AdaBins
[submodule "vendor/CLIP"]
path = vendor/CLIP
url = https://github.com/openai/CLIP
[submodule "pytti_taming"]
path = vendor/taming-transformers
url = https://github.com/pytti-tools/taming-transformers
290 changes: 182 additions & 108 deletions README.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name = pyttitools-core
version = 0.0.1

[options]
packages = find:
package_dir =
= src
#packages = find:
#package_dir =
# = src
install_requires =
torch >= 1.10
include_package_data=True

[options.packages.find]
where = src
#[options.packages.find]
#where = src
25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from setuptools import setup, find_packages, find_namespace_packages
import logging

p0 = find_packages(where='src')
#print(p0)
#logging.critical(p0)
#p1 = find_namespace_packages(where='vendor.*')
#print(p1)
#logging.critical(p1)
p2 = find_namespace_packages(
where='src',
include=['hydra_plugins.*'],
)
#logging.critical(p2)

setup(
#packages= p0 + p1,
packages=p0+p2,
package_dir={
"": "src",
#"pyttitools-adabins": "vendor",
#"pyttitools-gma": "vendor",
},
install_requires=['pyttitools-adabins', 'pyttitools-gma']
)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os

from loguru import logger

from hydra.core.config_search_path import ConfigSearchPath
from hydra.plugins.search_path_plugin import SearchPathPlugin


# https://hydra.cc/docs/advanced/search_path/#
# https://github.com/facebookresearch/hydra/issues/763

class PyttiLocalConfigSearchPathPlugin(SearchPathPlugin):

def manipulate_search_path(self, search_path: ConfigSearchPath) -> None:

local_path = f"{os.getcwd()}/config/"
# If path doesn't exist, we should create it and copy configs to it
logger.debug(local_path)

search_path.append(
provider="pytti_hydra_pathplugin", path=f"file://{local_path}"
)
12 changes: 6 additions & 6 deletions src/pytti/Image/VQGANImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import sys, subprocess
from loguru import logger

if not path_exists("./taming-transformers"):
raise FileNotFoundError("ERROR: taming-transformers is missing!")
if "./taming-transformers" not in sys.path:
sys.path.append("./taming-transformers")
else:
logger.debug("DEBUG: sys.path already contains ./taming transformers")
#if not path_exists("./taming-transformers"):
# raise FileNotFoundError("ERROR: taming-transformers is missing!")
#if "./taming-transformers" not in sys.path:
# sys.path.append("./taming-transformers")
#else:
# logger.debug("DEBUG: sys.path already contains ./taming transformers")
from taming.models import cond_transformer, vqgan

from pytti import DEVICE, replace_grad, clamp_with_grad, vram_usage_mode
Expand Down
2 changes: 1 addition & 1 deletion src/pytti/Perceptor/Prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from torch.nn import functional as F
from torchvision.transforms import functional as TF
import re, math
from CLIP import clip
from clip import clip
import pytti
from PIL import Image
from pytti.Image import RGBImage
Expand Down
2 changes: 1 addition & 1 deletion src/pytti/Perceptor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import torch
from CLIP import clip
from clip import clip
from pytti import DEVICE, vram_usage_mode

CLIP_PERCEPTORS = None
Expand Down
6 changes: 5 additions & 1 deletion src/pytti/config/conf/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ scene_prefix: 'astrophotography #pixelart | image credit nasa | space full of cy
scene_suffix: '| satellite image:-1:-.95 | text:-1:-.95 | anime:-1:-.95 | watermark:-1:-.95
| backyard telescope:-1:-.95 | map:-1:-.95'

direct_image_prompts: https://i.imgur.com/frXoHJ6.jpg
steps_per_scene: 30
steps_per_frame: 3
pre_animation_steps: 2
save_every: ${steps_per_frame}
display_every: ${steps_per_frame}

image_model: Limited Palette
ViTB32: true
Expand Down
1 change: 1 addition & 0 deletions vendor/AdaBins
Submodule AdaBins added at 21303d
1 change: 1 addition & 0 deletions vendor/CLIP
Submodule CLIP added at 40f548
1 change: 1 addition & 0 deletions vendor/GMA
Submodule GMA added at 4d4af8
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Vendored code goes here.
1 change: 1 addition & 0 deletions vendor/taming-transformers
Submodule taming-transformers added at cc6d07

0 comments on commit 80276ae

Please sign in to comment.