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

Function init_pipeline

examples/WanVSR/infer_flashvsr_tiny_long_video.py:178–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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