Spaces:
Runtime error
Runtime error
Update app.py
Browse files29 unmodified lines303132333435363738394041424344454647484929 unmodified lines# Generator seed,generator = torch.manual_seed(0)pose_model = OpenposeDetector.from_pretrained("lllyasviel/ControlNet")controlnet_pose = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-openpose", torch_dtype=torch.float16)pipe_pose = StableDiffusionControlNetPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", controlnet=controlnet_pose, safety_checker=None, torch_dtype=torch.float16)pipe_pose.scheduler = UniPCMultistepScheduler.from_config(pipe_pose.scheduler.config)# This command loads the individual model components on GPU on-demand. So, we don't# need to explicitly call pipe.to("cuda").pipe_pose.enable_model_cpu_offload()# xformerspipe_pose.enable_xformers_memory_efficient_attention()29 unmodified lines303132333435363738394041424344454647484950515253545529 unmodified lines# Generator seed,generator = torch.manual_seed(0)torch_dtype = torch.float16 # or torch.bfloat16 (if needed)pose_model = OpenposeDetector.from_pretrained("lllyasviel/ControlNet")controlnet_pose = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-openpose", torch_dtype=torch_dtype).to("cuda") # Load it directly on GPUpipe_pose = StableDiffusionControlNetPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",controlnet=controlnet_pose,safety_checker=None,torch_dtype=torch_dtype)pipe_pose.scheduler = UniPCMultistepScheduler.from_config(pipe_pose.scheduler.config)pipe_pose.enable_model_cpu_offload()# ✅ Enable xformers (Optimizes memory usage)pipe_pose.enable_xformers_memory_efficient_attention()
app.py+12-6