MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / init_pipeline

Function init_pipeline

examples/WanVSR/infer_flashvsr_tiny.py:174–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 raise ValueError(f"Unsupported input: {path}")
173
174def init_pipeline():
175 print(torch.cuda.current_device(), torch.cuda.get_device_name(torch.cuda.current_device()))
176 mm = ModelManager(torch_dtype=torch.bfloat16, device="cpu")
177 mm.load_models([
178 "./FlashVSR/diffusion_pytorch_model_streaming_dmd.safetensors",
179 ])
180 pipe = FlashVSRTinyPipeline.from_model_manager(mm, device="cuda")
181 pipe.denoising_model().LQ_proj_in = Buffer_LQ4x_Proj(in_dim=3, out_dim=1536, layer_num=1).to("cuda", dtype=torch.bfloat16)
182 LQ_proj_in_path = "./FlashVSR/LQ_proj_in.ckpt"
183 if os.path.exists(LQ_proj_in_path):
184 pipe.denoising_model().LQ_proj_in.load_state_dict(torch.load(LQ_proj_in_path, map_location="cpu"), strict=True)
185 pipe.denoising_model().LQ_proj_in.to('cuda')
186
187 multi_scale_channels = [512, 256, 128, 128]
188 pipe.TCDecoder = build_tcdecoder(new_channels=multi_scale_channels, new_latent_channels=16+768)
189 mis = pipe.TCDecoder.load_state_dict(torch.load("./FlashVSR/TCDecoder.ckpt"), strict=False)
190 print(mis)
191
192 pipe.to('cuda'); pipe.enable_vram_management(num_persistent_param_in_dit=None)
193 pipe.init_cross_kv(); pipe.load_models_to_device(["dit","vae"])
194 return pipe
195
196def main():
197 RESULT_ROOT = "./results"

Callers 1

mainFunction · 0.70

Calls 11

load_modelsMethod · 0.95
ModelManagerClass · 0.90
Buffer_LQ4x_ProjClass · 0.90
build_tcdecoderFunction · 0.90
from_model_managerMethod · 0.45
denoising_modelMethod · 0.45
toMethod · 0.45
loadMethod · 0.45
init_cross_kvMethod · 0.45
load_models_to_deviceMethod · 0.45

Tested by

no test coverage detected