rlawjdghek commited on
Commit
cf0b6eb
β€’
1 Parent(s): 6db35fc
app.py CHANGED
@@ -14,11 +14,11 @@ import torch
14
  from omegaconf import OmegaConf
15
  from PIL import Image
16
  import spaces
17
- print("pip import done")
18
 
19
  from cldm.model import create_model
20
  from cldm.plms_hacked import PLMSSampler
21
  from utils_stableviton import get_batch, get_mask_location, tensor2img
 
22
 
23
  PROJECT_ROOT = Path(__file__).absolute().parents[1].absolute()
24
  sys.path.insert(0, str(PROJECT_ROOT))
 
14
  from omegaconf import OmegaConf
15
  from PIL import Image
16
  import spaces
 
17
 
18
  from cldm.model import create_model
19
  from cldm.plms_hacked import PLMSSampler
20
  from utils_stableviton import get_batch, get_mask_location, tensor2img
21
+ print("pip import done")
22
 
23
  PROJECT_ROOT = Path(__file__).absolute().parents[1].absolute()
24
  sys.path.insert(0, str(PROJECT_ROOT))
ldm/models/autoencoder.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- # import pytorch_lightning as pl
3
  import torch.nn as nn
4
  import torch.nn.functional as F
5
  from contextlib import contextmanager
@@ -11,7 +11,7 @@ from ldm.util import instantiate_from_config
11
  from ldm.modules.ema import LitEma
12
 
13
 
14
- class AutoencoderKL(nn.Module):
15
  def __init__(self,
16
  ddconfig,
17
  lossconfig,
 
1
  import torch
2
+ import pytorch_lightning as pl
3
  import torch.nn as nn
4
  import torch.nn.functional as F
5
  from contextlib import contextmanager
 
11
  from ldm.modules.ema import LitEma
12
 
13
 
14
+ class AutoencoderKL(pl.LightningModule):
15
  def __init__(self,
16
  ddconfig,
17
  lossconfig,
ldm/models/diffusion/ddpm.py CHANGED
@@ -9,7 +9,7 @@ https://github.com/CompVis/taming-transformers
9
  import torch
10
  import torch.nn as nn
11
  import numpy as np
12
- # import pytorch_lightning as pl
13
  from torch.optim.lr_scheduler import LambdaLR
14
  from einops import rearrange, repeat
15
  from contextlib import contextmanager, nullcontext
@@ -47,7 +47,7 @@ def disabled_train(self, mode=True):
47
  def uniform_on_device(r1, r2, shape, device):
48
  return (r1 - r2) * torch.rand(*shape, device=device) + r2
49
 
50
- class DDPM(nn.Module):
51
  # classic DDPM with Gaussian diffusion, in image space
52
  def __init__(self,
53
  unet_config,
 
9
  import torch
10
  import torch.nn as nn
11
  import numpy as np
12
+ import pytorch_lightning as pl
13
  from torch.optim.lr_scheduler import LambdaLR
14
  from einops import rearrange, repeat
15
  from contextlib import contextmanager, nullcontext
 
47
  def uniform_on_device(r1, r2, shape, device):
48
  return (r1 - r2) * torch.rand(*shape, device=device) + r2
49
 
50
+ class DDPM(pl.LightningModule):
51
  # classic DDPM with Gaussian diffusion, in image space
52
  def __init__(self,
53
  unet_config,
requirements.txt CHANGED
@@ -20,4 +20,5 @@ cloudpickle
20
  fvcore
21
  omegaconf==2.1
22
  hydra-core
23
- pycocotools
 
 
20
  fvcore
21
  omegaconf==2.1
22
  hydra-core
23
+ pycocotools
24
+ pytorch-lightning==1.5.0