valhalla commited on
Commit
d998141
·
1 Parent(s): 83f1301

Update modeling_latent_diffusion.py

Browse files
Files changed (1) hide show
  1. modeling_latent_diffusion.py +5 -9
modeling_latent_diffusion.py CHANGED
@@ -1,16 +1,12 @@
1
- # pytorch_diffusion + derived encoder decoder
2
- import math
3
-
4
- import numpy as np
5
  import tqdm
6
  import torch
7
- import torch.nn as nn
8
 
9
  from diffusers import DiffusionPipeline
10
 
11
- from .modeling_vae import AutoencoderKL
12
- from .configuration_ldmbert import LDMBertConfig
13
- from .modeling_ldmbert import LDMBertModel
 
14
 
15
  class LatentDiffusion(DiffusionPipeline):
16
  def __init__(self, vqvae, bert, tokenizer, unet, noise_scheduler):
@@ -95,4 +91,4 @@ class LatentDiffusion(DiffusionPipeline):
95
  image = self.vqvae.decode(image)
96
  image = torch.clamp((image+1.0)/2.0, min=0.0, max=1.0)
97
 
98
- return image
 
 
 
 
 
1
  import tqdm
2
  import torch
 
3
 
4
  from diffusers import DiffusionPipeline
5
 
6
+ # add these relative imports here, so we can load from hub
7
+ from .modeling_vae import AutoencoderKL # NOQA
8
+ from .configuration_ldmbert import LDMBertConfig # NOQA
9
+ from .modeling_ldmbert import LDMBertModel # NOQA
10
 
11
  class LatentDiffusion(DiffusionPipeline):
12
  def __init__(self, vqvae, bert, tokenizer, unet, noise_scheduler):
 
91
  image = self.vqvae.decode(image)
92
  image = torch.clamp((image+1.0)/2.0, min=0.0, max=1.0)
93
 
94
+ return image