manbeast3b commited on
Commit
0fe34cd
·
verified ·
1 Parent(s): 21f76cd

Update src/pipeline.py

Browse files
Files changed (1) hide show
  1. src/pipeline.py +20 -17
src/pipeline.py CHANGED
@@ -98,21 +98,14 @@ def load_pipeline() -> Pipeline:
98
  # torch_dtype=torch.bfloat16
99
  # ).to(memory_format=torch.channels_last)
100
 
101
- hub_model_dir = os.path.join(
102
- HF_HUB_CACHE,
103
- f"models--{model_name.replace('/', '--')}",
104
- "snapshots",
105
- revision,
106
- "transformer"
107
- )
108
- path = os.path.join(HF_HUB_CACHE, "models--manbeast3b--Flux.1.la_schnella_transformer/snapshots/a3d1dad2b6ef299a3df632f316737447d238f29e/flux.1.la_schnell_compiled.pt")
109
- transformer=torch.load(path).to("cuda")
110
- num_channels_latents = transformer.config.in_channels // 4
111
- inputs = get_example_inputs(batch_size=1, height=1024, width=1024, num_channels_latents=num_channels_latents)
112
 
113
- for _ in range(2):
114
- _ = f(transformer, **inputs)
115
-
116
  # transformer = FluxTransformer2DModel.from_pretrained(
117
  # hub_model_dir,
118
  # torch_dtype=torch.bfloat16,
@@ -123,15 +116,25 @@ def load_pipeline() -> Pipeline:
123
  ckpt_id,
124
  revision=ckpt_revision,
125
  # text_encoder_2=text_encoder_2,
126
- transformer=transformer,
127
  # vae=vae,
128
  torch_dtype=torch.bfloat16
129
  )
130
  # pipeline.vae = torch.compile(vae)
131
  pipeline.to("cuda")
132
- pipeline.transformer = torch.compile(pipeline.transformer, mode="max-autotune", fullgraph=True)
133
  quantize_(pipeline.vae, int8_dynamic_activation_int4_weight())
134
-
 
 
 
 
 
 
 
 
 
 
135
  warmup_ = "controllable varied focus thai warriors entertainment blue golden pink soft tough padthai"
136
  for _ in range(1):
137
  pipeline(
 
98
  # torch_dtype=torch.bfloat16
99
  # ).to(memory_format=torch.channels_last)
100
 
101
+ # hub_model_dir = os.path.join(
102
+ # HF_HUB_CACHE,
103
+ # f"models--{model_name.replace('/', '--')}",
104
+ # "snapshots",
105
+ # revision,
106
+ # "transformer"
107
+ # )
 
 
 
 
108
 
 
 
 
109
  # transformer = FluxTransformer2DModel.from_pretrained(
110
  # hub_model_dir,
111
  # torch_dtype=torch.bfloat16,
 
116
  ckpt_id,
117
  revision=ckpt_revision,
118
  # text_encoder_2=text_encoder_2,
119
+ transformer=None,#transformer,
120
  # vae=vae,
121
  torch_dtype=torch.bfloat16
122
  )
123
  # pipeline.vae = torch.compile(vae)
124
  pipeline.to("cuda")
125
+ # pipeline.transformer = torch.compile(pipeline.transformer, mode="max-autotune", fullgraph=True)
126
  quantize_(pipeline.vae, int8_dynamic_activation_int4_weight())
127
+
128
+ path = os.path.join(HF_HUB_CACHE, "models--manbeast3b--Flux.1.la_schnella_transformer/snapshots/a3d1dad2b6ef299a3df632f316737447d238f29e/flux.1.la_schnell_compiled.pt")
129
+ transformer=torch.load(path).to("cuda")
130
+ num_channels_latents = transformer.config.in_channels // 4
131
+ inputs = get_example_inputs(batch_size=1, height=1024, width=1024, num_channels_latents=num_channels_latents)
132
+
133
+ for _ in range(2):
134
+ _ = f(transformer, **inputs)
135
+
136
+ pipeline.transformer = transformer
137
+
138
  warmup_ = "controllable varied focus thai warriors entertainment blue golden pink soft tough padthai"
139
  for _ in range(1):
140
  pipeline(