manbeast3b commited on
Commit
957b710
·
verified ·
1 Parent(s): 41a2eca

Update src/pipeline.py

Browse files
Files changed (1) hide show
  1. src/pipeline.py +3 -10
src/pipeline.py CHANGED
@@ -8,12 +8,6 @@ from torch import Generator
8
  from loss import SchedulerWrapper
9
  # from utils import register_normal_pipeline, register_faster_forward, register_parallel_pipeline, seed_everything
10
  from onediffx import compile_pipe, save_pipe, load_pipe
11
- # from diffusers import BitsAndBytesConfig
12
-
13
- # nf4_config = BitsAndBytesConfig(
14
- # load_in_4bit=True,
15
- # bnb_4bit_quant_type="nf4",
16
- # )
17
 
18
  def callback_dynamic_cfg(pipe, step_index, timestep, callback_kwargs):
19
  if step_index == int(pipe.num_timesteps * 0.78):
@@ -28,7 +22,7 @@ def load_pipeline(pipeline=None) -> StableDiffusionXLPipeline:
28
  if not pipeline:
29
  pipeline = StableDiffusionXLPipeline.from_pretrained(
30
  "stablediffusionapi/newdream-sdxl-20",
31
- torch_dtype=torch.float16,
32
  ).to("cuda")
33
 
34
  # Register optimizations for performance
@@ -42,12 +36,11 @@ def load_pipeline(pipeline=None) -> StableDiffusionXLPipeline:
42
  #
43
  load_pipe(pipeline, dir="/home/sandbox/.cache/huggingface/hub/models--RobertML--cached-pipe-02/snapshots/58d70deae87034cce351b780b48841f9746d4ad7")
44
 
45
- for _ in range(2):
46
  deepcache_output = pipeline(prompt="telestereography, unstrengthen, preadministrator, copatroness, hyperpersonal, paramountness, paranoid, guaniferous", output_type="pil", num_inference_steps=20)
47
  pipeline.scheduler.prepare_loss()
48
- for _ in range(4):
49
  pipeline(prompt="telestereography, unstrengthen, preadministrator, copatroness, hyperpersonal, paramountness, paranoid, guaniferous", output_type="pil", num_inference_steps=20)
50
- # save_pipe(pipeline, dir="/home/sandbox/.cache/pipe/")
51
  return pipeline
52
 
53
  def infer(request: TextToImageRequest, pipeline: StableDiffusionXLPipeline) -> Image:
 
8
  from loss import SchedulerWrapper
9
  # from utils import register_normal_pipeline, register_faster_forward, register_parallel_pipeline, seed_everything
10
  from onediffx import compile_pipe, save_pipe, load_pipe
 
 
 
 
 
 
11
 
12
  def callback_dynamic_cfg(pipe, step_index, timestep, callback_kwargs):
13
  if step_index == int(pipe.num_timesteps * 0.78):
 
22
  if not pipeline:
23
  pipeline = StableDiffusionXLPipeline.from_pretrained(
24
  "stablediffusionapi/newdream-sdxl-20",
25
+ torch_dtype=torch.bfloat16,
26
  ).to("cuda")
27
 
28
  # Register optimizations for performance
 
36
  #
37
  load_pipe(pipeline, dir="/home/sandbox/.cache/huggingface/hub/models--RobertML--cached-pipe-02/snapshots/58d70deae87034cce351b780b48841f9746d4ad7")
38
 
39
+ for _ in range(1):
40
  deepcache_output = pipeline(prompt="telestereography, unstrengthen, preadministrator, copatroness, hyperpersonal, paramountness, paranoid, guaniferous", output_type="pil", num_inference_steps=20)
41
  pipeline.scheduler.prepare_loss()
42
+ for _ in range(2):
43
  pipeline(prompt="telestereography, unstrengthen, preadministrator, copatroness, hyperpersonal, paramountness, paranoid, guaniferous", output_type="pil", num_inference_steps=20)
 
44
  return pipeline
45
 
46
  def infer(request: TextToImageRequest, pipeline: StableDiffusionXLPipeline) -> Image: