Open danilomaiaweb opened 2 months ago
i had a similar error File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\sd_samplers_common.py", line 74, in single_sample_to_image x_sample = 255. * np.moveaxis(x_sample.cpu().numpy(), 0, 2) TypeError: Got unsupported ScalarType BFloat16
when trying to use the hiresfix button after generation.
i asked claude ai it told me to edit the file:
stable-diffusion-webui-forge\modules\sd_samplers_common.py
and replace some part of it with this code:
def single_sample_to_image(sample, approximation=None):
# Convert to float32 if it's BFloat16
if sample.dtype == torch.bfloat16:
sample = sample.to(torch.float32)
x_sample = samples_to_images_tensor(sample.unsqueeze(0), approximation)[0] * 0.5 + 0.5
x_sample = torch.clamp(x_sample, min=0.0, max=1.0)
# Ensure x_sample is in float32 before converting to numpy
x_sample = x_sample.float()
x_sample = 255. * torch.permute(x_sample, (1, 2, 0)).cpu().numpy()
x_sample = x_sample.astype(np.uint8)
return Image.fromarray(x_sample)
that worked.
Skipping unconditional conditioning when CFG = 1. Negative Prompts are ignored. To load target model JointTextEncoder Begin to load 1 model [Memory Management] Current Free GPU Memory: 6924.37 MB [Memory Management] Required Model Memory: 5227.11 MB [Memory Management] Required Inference Memory: 1024.00 MB [Memory Management] Estimated Remaining GPU Memory: 673.27 MB Moving model(s) has taken 2.18 seconds Distilled CFG Scale will be ignored for Schnell Error running process_before_every_sampling: E:\ForgeFlux\webui\extensions-builtin\sd_forge_freeu\scripts\forge_freeu.py Traceback (most recent call last): File "E:\ForgeFlux\webui\modules\scripts.py", line 892, in process_before_every_sampling script.process_before_every_sampling(p, script_args, kwargs) File "E:\ForgeFlux\webui\extensions-builtin\sd_forge_freeu\scripts\forge_freeu.py", line 92, in process_before_every_sampling unet = patch_freeu_v2(unet, freeu_b1, freeu_b2, freeu_s1, freeu_s2) File "E:\ForgeFlux\webui\extensions-builtin\sd_forge_freeu\scripts\forge_freeu.py", line 27, in patch_freeu_v2 model_channels = unet_patcher.model.diffusion_model.config["model_channels"] KeyError: 'model_channels'
To load target model KModel Begin to load 1 model [Memory Management] Current Free GPU Memory: 6919.79 MB [Memory Management] Required Model Memory: 6241.47 MB [Memory Management] Required Inference Memory: 1024.00 MB [Memory Management] Estimated Remaining GPU Memory: -345.68 MB [Memory Management] Loaded to CPU Swap: 1704.28 MB (blocked method) [Memory Management] Loaded to GPU: 4537.12 MB Moving model(s) has taken 2.07 seconds 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:14<00:00, 3.51s/it] To load target model IntegratedAutoencoderKL██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:10<00:00, 2.87s/it] Begin to load 1 model [Memory Management] Current Free GPU Memory: 2793.58 MB [Memory Management] Required Model Memory: 159.87 MB [Memory Management] Required Inference Memory: 1024.00 MB [Memory Management] Estimated Remaining GPU Memory: 1609.71 MB Moving model(s) has taken 0.05 seconds Total progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:11<00:00, 2.86s/it] Total progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:11<00:00, 2.87s/it]Skipping unconditional conditioning when CFG = 1. Negative Prompts are ignored. | 0/4 [00:00<?, ?it/s] To load target model JointTextEncoder Begin to load 1 model [Memory Management] Current Free GPU Memory: 6919.21 MB [Memory Management] Required Model Memory: 5227.11 MB [Memory Management] Required Inference Memory: 1024.00 MB [Memory Management] Estimated Remaining GPU Memory: 668.11 MB Moving model(s) has taken 2.44 seconds Distilled CFG Scale will be ignored for Schnell Distilled CFG Scale will be ignored for Schnell To load target model IntegratedAutoencoderKL Begin to load 1 model [Memory Management] Current Free GPU Memory: 2716.20 MB [Memory Management] Required Model Memory: 159.87 MB [Memory Management] Required Inference Memory: 1024.00 MB [Memory Management] Estimated Remaining GPU Memory: 1532.32 MB Moving model(s) has taken 0.46 seconds Traceback (most recent call last): File "E:\ForgeFlux\webui\modules_forge\main_thread.py", line 37, in loop task.work() File "E:\ForgeFlux\webui\modules_forge\main_thread.py", line 26, in work self.result = self.func(*self.args, self.kwargs) File "E:\ForgeFlux\webui\modules\txt2img.py", line 84, in txt2img_upscale_function processed = processing.process_images(p) File "E:\ForgeFlux\webui\modules\processing.py", line 809, in process_images res = process_images_inner(p) File "E:\ForgeFlux\webui\modules\processing.py", line 952, in process_images_inner samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts) File "E:\ForgeFlux\webui\modules\processing.py", line 1339, in sample return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts) File "E:\ForgeFlux\webui\modules\processing.py", line 1367, in sample_hr_pass save_intermediate(samples, i) File "E:\ForgeFlux\webui\modules\processing.py", line 1356, in save_intermediate image = sd_samplers.sample_to_image(image, index, approximation=0) File "E:\ForgeFlux\webui\modules\sd_samplers_common.py", line 86, in sample_to_image return single_sample_to_image(samples[index], approximation) File "E:\ForgeFlux\webui\modules\sd_samplers_common.py", line 74, in single_sample_to_image x_sample = 255. np.moveaxis(x_sample.cpu().numpy(), 0, 2) TypeError: Got unsupported ScalarType BFloat16 Got unsupported ScalarType BFloat16 Error completing request * Arguments: ('task(ssw0ex419af8hq0)', <gradio.route_utils.Request object at 0x000002719F64FD90>, [(<PIL.PngImagePlugin.PngImageFile image mode=RGB size=584x1040 at 0x271A21FDCF0>, None)], 0, '{"prompt": "old man with glasses and hat, 33mm, f1.4, natural light, Path\u00e9chrome, Path\u00e9color", "all_prompts": ["old man with glasses and hat, 33mm, f1.4, natural light, Path\u00e9chrome, Path\u00e9color"], "negative_prompt": "", "all_negative_prompts": [""], "seed": 3709174609, "all_seeds": [3709174609], "subseed": 1007509373, "all_subseeds": [1007509373], "subseed_strength": 0, "width": 584, "height": 1040, "sampler_name": "Euler", "cfg_scale": 1, "steps": 4, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_name": "flux1-schnell-bnb-nf4", "sd_model_hash": "c922e7f77f", "sd_vae_name": null, "sd_vae_hash": null, "seed_resize_from_w": -1, "seed_resize_from_h": -1, "denoising_strength": 0.7, "extra_generation_params": {"Schedule type": "Simple"}, "index_of_first_image": 0, "infotexts": ["old man with glasses and hat, 33mm, f1.4, natural light, Path\u00e9chrome, Path\u00e9color\nSteps: 4, Sampler: Euler, Schedule type: Simple, CFG scale: 1, Seed: 3709174609, Size: 584x1040, Model hash: c922e7f77f, Model: flux1-schnell-bnb-nf4, Version: f2.0.1v1.10.1-previous-252-g00f1cd36"], "styles": [], "job_timestamp": "20240814022237", "clip_skip": 1, "is_using_inpainting_conditioning": false, "version": "f2.0.1v1.10.1-previous-252-g00f1cd36"}', 'old man with glasses and hat, 33mm, f1.4, natural light, Pathéchrome, Pathécolor', '', [], 1, 1, 1, 3.5, 1040, 584, True, 0.4, 1.5, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', None, 0, 4, 'Euler', 'Simple', False, -1, False, -1, 0, 0, 0, False, 0, 4, 0, 512, 512, True, 'None', 'None', 0, False, False, {'ad_model': 'face_yolov8n.pt', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, None, False, '0', '0', 'inswapper_128.onnx', 'CodeFormer', 1, True, 'None', 1, 1, False, True, 1, 0, 0, False, 0.5, True, False, 'CUDA', False, 0, 'None', '', None, False, False, 0.5, 0, 'tab_single', 1, ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=None, batch_mask_gallery=None, generated_image=None, mask_image=None, mask_image_fg=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, image_fg=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=None, batch_mask_gallery=None, generated_image=None, mask_image=None, mask_image_fg=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, image_fg=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=None, batch_mask_gallery=None, generated_image=None, mask_image=None, mask_image_fg=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, image_fg=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), False, 7, 1, 'Constant', 0, 'Constant', 0, 1, 'enable', 'MEAN', 'AD', 1, True, 1.01, 1.02, 0.99, 0.95, False, 0.5, 2, False, 3, False, 3, 2, 0, 0.35, True, 'bicubic', 'bicubic', False, 0, 'anisotropic', 0, 'reinhard', 100, 0, 'subtract', 0, 0, 'gaussian', 'add', 0, 100, 127, 0, 'hard_clamp', 5, 0, 'None', 'None', False, 'MultiDiffusion', 768, 768, 64, 4, False, False, False, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', '', 0, '', '', 0, '', '', True, False, False, False, False, False, False, 0, False) {} Traceback (most recent call last): File "E:\ForgeFlux\webui\modules\call_queue.py", line 74, in f res = list(func(*args, kwargs)) TypeError: 'NoneType' object is not iterable