Skip to content

Commit

Permalink
Minimize re-exports from __init__ files (Stability-AI#44)
Browse files Browse the repository at this point in the history
This allows importing parts of the package without having to
import practically everything (since importing a package will
import its parents' __init__s, etc).
  • Loading branch information
akx authored and LinearFalcon committed Jul 6, 2024
1 parent d23d778 commit e5f4ca3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
4 changes: 0 additions & 4 deletions sgm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
from .data import StableDataModuleFromConfig
from .models import AutoencodingEngine, DiffusionEngine
from .util import instantiate_from_config, get_configs_path

__version__ = "0.0.1"
1 change: 0 additions & 1 deletion sgm/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from .dataset import StableDataModuleFromConfig
2 changes: 0 additions & 2 deletions sgm/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
from .autoencoder import AutoencodingEngine
from .diffusion import DiffusionEngine
7 changes: 7 additions & 0 deletions sgm/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from .encoders.modules import GeneralConditioner

__all__ = [
# `sgm.models.GeneralConditioner` is referenced in model configurations, etc.,
# so it must be re-exported from this module.
"GeneralConditioner",
"UNCONDITIONAL_CONFIG",
]

UNCONDITIONAL_CONFIG = {
"target": "sgm.modules.GeneralConditioner",
"params": {"emb_models": []},
Expand Down
7 changes: 0 additions & 7 deletions sgm/modules/diffusionmodules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
from .denoiser import Denoiser
from .discretizer import Discretization
from .loss import StandardDiffusionLoss
from .model import Model, Encoder, Decoder
from .openaimodel import UNetModel
from .sampling import BaseDiffusionSampler
from .wrappers import OpenAIWrapper

0 comments on commit e5f4ca3

Please sign in to comment.