Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make repo pip-installable #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
from pytorch_lightning.callbacks import ModelCheckpoint, Callback, LearningRateMonitor
from pytorch_lightning.utilities.distributed import rank_zero_only

def get_obj_from_str(string, reload=False):
module, cls = string.rsplit(".", 1)
if reload:
module_imp = importlib.import_module(module)
importlib.reload(module_imp)
return getattr(importlib.import_module(module, package=None), cls)

from taming import get_obj_from_str, instantiate_from_config

def get_parser(**parser_kwargs):
def str2bool(v):
Expand Down
13 changes: 13 additions & 0 deletions taming/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import importlib

def get_obj_from_str(string, reload=False):
module, cls = string.rsplit(".", 1)
if reload:
module_imp = importlib.import_module(module)
importlib.reload(module_imp)
return getattr(importlib.import_module(module, package=None), cls)

def instantiate_from_config(config):
if not "target" in config:
raise KeyError("Expected key `target` to instantiate.")
return get_obj_from_str(config["target"])(**config.get("params", dict()))
Empty file added taming/data/__init__.py
Empty file.
Empty file added taming/models/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion taming/models/cond_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch.nn.functional as F
import pytorch_lightning as pl

from main import instantiate_from_config
from taming import instantiate_from_config
from taming.modules.util import SOSProvider


Expand Down
2 changes: 1 addition & 1 deletion taming/models/vqgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import torch.nn.functional as F
import pytorch_lightning as pl

from main import instantiate_from_config
from taming import instantiate_from_config

from taming.modules.diffusionmodules.model import Encoder, Decoder
from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
Expand Down
Empty file added taming/modules/__init__.py
Empty file.
Empty file.
Empty file.
Empty file added taming/modules/misc/__init__.py
Empty file.
Empty file.
Empty file.