Spaces:
Runtime error
Runtime error
Update app.py
Browse files93 unmodified lines949596979899100101102103104105106107108109110111112113114172 unmodified lines28728828929029129229330 unmodified lines32432532632732832933033193 unmodified linessampler=PIPELINE_CONFIG_YAML["sampler"], # "from_checkpoint" or specific samplerdevice=DEVICE,enhance_prompt=False, # Assuming Gradio controls this, or set based on YAML later)# Create Latent Upsamplerlatent_upsampler = create_latent_upsampler(latent_upsampler_model_path=spatial_upsampler_path,device=DEVICE)latent_upsampler = latent_upsampler.to(torch.bfloat16 if PIPELINE_CONFIG_YAML["precision"] == "bfloat16" else torch.float32)# Multi-scale pipeline (wrapper)multi_scale_pipe = LTXMultiScalePipeline(video_pipeline=pipe,latent_upsampler=latent_upsampler)# --- End Global Configuration & Model Loading ---172 unmodified lines"output_type": "latent"}latents = pipe(**first_pass_args).images # .images here is actually latents# 2. Upsample latents manually# Need to handle normalization around latent upsampler if it expects unnormalized latentslatents_unnorm = un_normalize_latents(latents, pipe.vae, vae_per_channel_normalize=True)30 unmodified linesdecode_noise_val = PIPELINE_CONFIG_YAML.get("decode_noise_scale", 0.025)upsampled_latents = upsampled_latents * (1 - decode_noise_val) + noise * decode_noise_valresult_frames_tensor = pipe.vae.decode(upsampled_latents, **decode_kwargs).sample# result_frames_tensor shape: (B, C, F_video, H_video, W_video)# --- Post-processing: Cropping and Converting to PIL ---93 unmodified lines949596979899100101102103104105106107108109110111112113114172 unmodified lines28728828929029129229330 unmodified lines32432532632732832933033133293 unmodified linessampler=PIPELINE_CONFIG_YAML["sampler"], # "from_checkpoint" or specific samplerdevice=DEVICE,enhance_prompt=False, # Assuming Gradio controls this, or set based on YAML later).to(torch.bfloat16)# Create Latent Upsamplerlatent_upsampler = create_latent_upsampler(latent_upsampler_model_path=spatial_upsampler_path,device=DEVICE)latent_upsampler = latent_upsampler.to(torch.bfloat16)# Multi-scale pipeline (wrapper)multi_scale_pipe = LTXMultiScalePipeline(video_pipeline=pipe,latent_upsampler=latent_upsampler).to(torch.bfloat16)# --- End Global Configuration & Model Loading ---172 unmodified lines"output_type": "latent"}latents = pipe(**first_pass_args).images # .images here is actually latentsprint("First pass done!")# 2. Upsample latents manually# Need to handle normalization around latent upsampler if it expects unnormalized latentslatents_unnorm = un_normalize_latents(latents, pipe.vae, vae_per_channel_normalize=True)30 unmodified linesdecode_noise_val = PIPELINE_CONFIG_YAML.get("decode_noise_scale", 0.025)upsampled_latents = upsampled_latents * (1 - decode_noise_val) + noise * decode_noise_valprint("before vae decoding")result_frames_tensor = pipe.vae.decode(upsampled_latents, **decode_kwargs).sampleprint("after vae decoding?")# result_frames_tensor shape: (B, C, F_video, H_video, W_video)# --- Post-processing: Cropping and Converting to PIL ---
app.py+6-5