Diffusers
Safetensors
shunk031 commited on
Commit
c2e4aaf
·
verified ·
1 Parent(s): 64789a5

Upload pipeline_ncsn.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. pipeline_ncsn.py +9 -9
pipeline_ncsn.py CHANGED
@@ -5,11 +5,11 @@ from diffusers.callbacks import MultiPipelineCallbacks, PipelineCallback
5
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
6
  from einops import rearrange
7
 
8
- from .scheduling_ncsn import (
9
- AnnealedLangevinDynamicOutput,
10
- AnnealedLangevinDynamicScheduler,
11
  )
12
- from .unet_2d_ncsn import UNet2DModelForNCSN
13
 
14
 
15
  def normalize_images(image: torch.Tensor) -> torch.Tensor:
@@ -42,17 +42,17 @@ class NCSNPipeline(DiffusionPipeline):
42
  Parameters:
43
  unet ([`UNet2DModelForNCSN`]):
44
  A `UNet2DModelForNCSN` to estimate the score of the image.
45
- scheduler ([`AnnealedLangevinDynamicScheduler`]):
46
- A `AnnealedLangevinDynamicScheduler` to be used in combination with `unet` to estimate the score of the image.
47
  """
48
 
49
  unet: UNet2DModelForNCSN
50
- scheduler: AnnealedLangevinDynamicScheduler
51
 
52
  _callback_tensor_inputs: List[str] = ["samples"]
53
 
54
  def __init__(
55
- self, unet: UNet2DModelForNCSN, scheduler: AnnealedLangevinDynamicScheduler
56
  ) -> None:
57
  super().__init__()
58
  self.register_modules(unet=unet, scheduler=scheduler)
@@ -151,7 +151,7 @@ class NCSNPipeline(DiffusionPipeline):
151
  )
152
  samples = (
153
  output.prev_sample
154
- if isinstance(output, AnnealedLangevinDynamicOutput)
155
  else output[0]
156
  )
157
 
 
5
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
6
  from einops import rearrange
7
 
8
+ from .scheduler.scheduling_ncsn import (
9
+ AnnealedLangevinDynamicsOutput,
10
+ AnnealedLangevinDynamicsScheduler,
11
  )
12
+ from .unet.unet_2d_ncsn import UNet2DModelForNCSN
13
 
14
 
15
  def normalize_images(image: torch.Tensor) -> torch.Tensor:
 
42
  Parameters:
43
  unet ([`UNet2DModelForNCSN`]):
44
  A `UNet2DModelForNCSN` to estimate the score of the image.
45
+ scheduler ([`AnnealedLangevinDynamicsScheduler`]):
46
+ A `AnnealedLangevinDynamicsScheduler` to be used in combination with `unet` to estimate the score of the image.
47
  """
48
 
49
  unet: UNet2DModelForNCSN
50
+ scheduler: AnnealedLangevinDynamicsScheduler
51
 
52
  _callback_tensor_inputs: List[str] = ["samples"]
53
 
54
  def __init__(
55
+ self, unet: UNet2DModelForNCSN, scheduler: AnnealedLangevinDynamicsScheduler
56
  ) -> None:
57
  super().__init__()
58
  self.register_modules(unet=unet, scheduler=scheduler)
 
151
  )
152
  samples = (
153
  output.prev_sample
154
+ if isinstance(output, AnnealedLangevinDynamicsOutput)
155
  else output[0]
156
  )
157