Bing-su / adetailer

Auto detecting, masking and inpainting with detection model.
GNU Affero General Public License v3.0
3.92k stars 305 forks source link

[Bug]: Ran out of input error when using face_yolov8n.pt model #338

Closed brknsoul closed 9 months ago

brknsoul commented 9 months ago

Describe the bug

When I use the face_yolov8n.pt model, I get a EOFError: Ran out of input error. I don't get this error when using a mediapipe model.

SD.Next, Win10, AMD/DirectML, Chrome

Screenshots

No response

Console logs, from start to end.

10:02:54-641862 INFO     Starting SD.Next                                      
10:02:54-653862 INFO     Python 3.10.11 on Windows                             
10:02:54-873862 INFO     Version: app=sd.next updated=2023-09-20 hash=89ba8e3c 
                         url=https://github.com/vladmandic/automatic/tree/HEAD 
10:02:55-510320 INFO     Platform: arch=AMD64 cpu=Intel64 Family 6 Model 158   
                         Stepping 11, GenuineIntel system=Windows              
                         release=Windows-10-10.0.19045-SP0 python=3.10.11      
10:02:55-513345 INFO     Using DirectML Backend                                
10:02:55-919438 INFO     Extensions: disabled=['Lora']                         
10:02:55-921438 INFO     Extensions: enabled=['a1111-sd-webui-lycoris',        
                         'clip-interrogator-ext', 'LDSR',                      
                         'multidiffusion-upscaler-for-automatic1111', 'ScuNET',
                         'sd-extension-system-info',                           
                         'sd-webui-agent-scheduler', 'sd-webui-controlnet',    
                         'stable-diffusion-webui-images-browser',              
                         'stable-diffusion-webui-rembg', 'SwinIR']             
                         extensions-builtin                                    
10:02:55-930438 INFO     Extensions: enabled=['a1111-sd-webui-tagcomplete',    
                         'adetailer', 'model-keyword', 'sd-dynamic-prompts']   
                         extensions                                            
10:02:55-935437 INFO     Verifying requirements                                
10:02:55-941437 INFO     Verifying packages                                    
10:02:55-943439 INFO     Verifying repositories                                
10:03:01-253488 INFO     Verifying submodules                                  
10:03:21-203991 INFO     Extensions enabled: ['a1111-sd-webui-lycoris',        
                         'clip-interrogator-ext', 'LDSR',                      
                         'multidiffusion-upscaler-for-automatic1111', 'ScuNET',
                         'sd-extension-system-info',                           
                         'sd-webui-agent-scheduler', 'sd-webui-controlnet',    
                         'stable-diffusion-webui-images-browser',              
                         'stable-diffusion-webui-rembg', 'SwinIR',             
                         'a1111-sd-webui-tagcomplete', 'adetailer',            
                         'model-keyword', 'sd-dynamic-prompts']                
10:03:21-205989 INFO     Verifying packages                                    
10:03:21-224965 INFO     Extension preload: {'extensions-builtin': 0.01,       
                         'extensions': 0.0}                                    
10:03:21-226965 INFO     Command line args: ['--medvram', '--autolaunch',      
                         '--use-directml'] medvram=True autolaunch=True        
                         use_directml=True                                     
10:03:31-961315 INFO     Engine: backend=Backend.ORIGINAL compute=directml     
                         mode=no_grad device=privateuseone:0                   
10:03:31-966289 INFO     Device:                                               
10:03:33-181527 INFO     Available VAEs: models\VAE items=3                    
10:03:33-184530 INFO     Removing empty folder: models\BSRGAN                  
10:03:33-201528 INFO     Available models: models\Stable-diffusion items=33    
                         time=0.01s                                            
10:03:37-755691 INFO     Extension:                                            
                         script='extensions-builtin\sd-webui-controlnet\scripts
                         \controlnet.py' Warning: ControlNet failed to load SGM
                         - will use LDM instead.                               
10:03:37-758660 INFO     Extension:                                            
                         script='extensions-builtin\sd-webui-controlnet\scripts
                         \controlnet.py' ControlNet preprocessor location:     
                         E:\SM\Data\Packages\SD.Next Web                       
                         UI\extensions-builtin\sd-webui-controlnet\annotator\do
                         wnloads                                               
10:03:37-779981 INFO     Extension:                                            
                         script='extensions-builtin\sd-webui-controlnet\scripts
                         \hook.py' Warning: ControlNet failed to load SGM -    
                         will use LDM instead.                                 
10:03:41-976897 INFO     Extension:                                            
                         script='extensions\adetailer\scripts\!adetailer.py'   
                         [-] ADetailer initialized. version: 23.9.3, num       
                         models: 9                                             
10:03:42-196948 INFO     Extensions time: 8.92s { a1111-sd-webui-lycoris=1.96s 
                         clip-interrogator-ext=0.08s LDSR=0.07s                
                         sd-extension-system-info=0.07s                        
                         sd-webui-agent-scheduler=0.63s                        
                         sd-webui-controlnet=1.65s                             
                         stable-diffusion-webui-images-browser=0.19s           
                         stable-diffusion-webui-rembg=1.01s SwinIR=0.08s       
                         a1111-sd-webui-tagcomplete=0.23s adetailer=2.68s      
                         model-keyword=0.07s sd-dynamic-prompts=0.06s          
                         ScuNET=0.08s }                                        
10:03:42-511653 INFO     Loading UI theme: name=black-orange style=Dark        
10:03:42-522219 WARNING  Triggered lyco-patch-lora, will take lora_dir and     
                         <lora> format.                                        
10:03:45-338777 INFO     Themes: builtin=6 default=5 external=54               
10:03:48-679818 INFO     Local URL: http://127.0.0.1:7860/                     
10:03:48-681808 INFO     Initializing middleware                               
10:03:49-309893 INFO     [AgentScheduler] Task queue is empty                  
10:03:49-311894 INFO     [AgentScheduler] Registering APIs                     
Loading weights: E:\SM\Data\Packages\SD.Next Web UI\models\Stable-diffusion\a… 
10:03:50-016474 INFO     Torch override dtype: no-half set                     
10:03:50-017474 INFO     Torch override VAE dtype: no-half set                 
10:03:50-019475 INFO     Setting Torch parameters: device=privateuseone:0      
                         dtype=torch.float32 vae=torch.float32                 
                         unet=torch.float32 context=no_grad fp16=False         
                         bf16=False                                            
10:03:50-569561 INFO     LDM: LatentDiffusion: Running in eps-prediction mode  
10:03:50-573696 INFO     LDM: DiffusionWrapper has 859.52 M params.            
10:03:51-567394 INFO     Cross-attention: optimization=Sub-quadratic options=[]
10:03:51-625754 INFO     Loaded embeddings: loaded=41 skipped=0                
10:03:51-631901 INFO     Model loaded in 1.84s { load=0.22s create=0.54s       
                         apply=0.97s embeddings=0.06s }                        
10:03:51-899566 INFO     Model load finished: {'ram': {'used': 6.81, 'total':  
                         15.95}, 'gpu': {'used': 0.62, 'total': 7.98},         
                         'retries': 'DirectMLDevice', 'oom': 0} cached=0       
10:03:52-039100 INFO     Startup time: 30.78s { torch=7.54s gradio=1.02s       
                         diffusers=1.26s libraries=2.10s extensions=8.92s      
                         onchange=0.31s ui-txt2img=2.25s ui-img2img=0.22s      
                         ui-models=0.23s ui-settings=0.18s ui-extensions=2.74s 
                         ui-defaults=0.11s launch=0.37s api=0.13s              
                         app-started=0.72s checkpoint=2.50s }                  
10:03:52-044069 INFO     Launching browser                                     
10:04:02-721291 INFO     Themes: builtin=6 default=5 external=54               
100%|##########| 25/25 [00:34<00:00,  1.39s/it]
10:05:12-061690 INFO     Model loaded: type=ESRGAN                             
                         model=E:\SM\Data\Packages\SD.Next Web                 
                         UI\models\ESRGAN\4x_NMKD-Siax_200k.pth                
Upscaling ---------------------------------------- 100% 0:00:00 0:00:02
10:05:16-204246 ERROR    Running script postprocess image:                     
                         extensions\adetailer\scripts\!adetailer.py: EOFError  
┌───────────────────── Traceback (most recent call last) ─────────────────────┐
│ E:\SM\Data\Packages\SD.Next Web UI\modules\scripts.py:536 in                │
│ postprocess_image                                                           │
│                                                                             │
│   535 │   │   │   │   args = p.per_script_args.get(script.title(), p.script │
│ > 536 │   │   │   │   script.postprocess_image(p, pp, *args)                │
│   537 │   │   │   except Exception as e:                                    │
│                                                                             │
│ E:\SM\Data\Packages\SD.Next Web                                             │
│ UI\extensions\adetailer\adetailer\traceback.py:159 in wrapper               │
│                                                                             │
│   158 │   │   │   │   error = RuntimeError(output)                          │
│ > 159 │   │   │   raise error from None                                     │
│   160                                                                       │
└─────────────────────────────────────────────────────────────────────────────┘
EOFError: 
┌─────────────────────────────────────────────────────────────────────────┐
│                               System info                               │
│ ┌─────────────┬───────────────────────────────────────────────────────┐ │
│ │             │ Value                                                 │ │
│ ├─────────────┼───────────────────────────────────────────────────────┤ │
│ │    Platform │ Windows-10-10.0.19045-SP0                             │ │
│ │      Python │ 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023,          │ │
│ │             │ 00:38:17) [MSC v.1929 64 bit (AMD64)]                 │ │
│ │     Version │ Unknown (too old or vladmandic)                       │ │
│ │      Commit │ Unknown                                               │ │
│ │ Commandline │ ['E:\\SM\\Data\\Packages\\SD.Next Web UI\\launch.py', │ │
│ │             │ '--medvram', '--autolaunch', '--use-directml']        │ │
│ │   Libraries │ {'torch': '2.0.0', 'torchvision': '0.15.1',           │ │
│ │             │ 'ultralytics': '8.0.184', 'mediapipe': '0.10.5'}      │ │
│ └─────────────┴───────────────────────────────────────────────────────┘ │
│                                 Inputs                                  │
│ ┌─────────────────┬───────────────────────────────────────────────────┐ │
│ │                 │ Value                                             │ │
│ ├─────────────────┼───────────────────────────────────────────────────┤ │
│ │          prompt │ beautiful slim thick anime caucasian woman,       │ │
│ │                 │ brunette, lower belly fat, sitting back on her    │ │
│ │                 │ heels in bed, cumming, medium sized breasts, hard │ │
│ │                 │ nipples                                           │ │
│ │ negative_prompt │ a featureless color shader, 3d max, child,        │ │
│ │                 │ children, teen, teenage, teenager, loli,          │ │
│ │                 │ bad-hands-5,                                      │ │
│ │          n_iter │ 2                                                 │ │
│ │      batch_size │ 1                                                 │ │
│ │           width │ 512                                               │ │
│ │          height │ 768                                               │ │
│ │    sampler_name │ DPM++ 2M Karras                                   │ │
│ │       enable_hr │ False                                             │ │
│ │     hr_upscaler │ None                                              │ │
│ │      checkpoint │ aniverse_V12Pruned.safetensors [48e194607f]       │ │
│ │             vae │ Automatic                                         │ │
│ │            unet │ ------                                            │ │
│ └─────────────────┴───────────────────────────────────────────────────┘ │
│                 ADetailer                                               │
│ ┌─────────────────────┬─────────────────┐                               │
│ │                     │ Value           │                               │
│ ├─────────────────────┼─────────────────┤                               │
│ │             version │ 23.9.3          │                               │
│ │            ad_model │ face_yolov8n.pt │                               │
│ │           ad_prompt │                 │                               │
│ │  ad_negative_prompt │                 │                               │
│ │ ad_controlnet_model │ None            │                               │
│ │              is_api │ False           │                               │
│ └─────────────────────┴─────────────────┘                               │
│ ┌───────────────── Traceback (most recent call last) ─────────────────┐ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\extensions\adetailer\adetailer\traceback.py:139 in wrapper       │ │
│ │                                                                     │ │
│ │   136 │   │   width = width - 4 if width > 4 else None              │ │
│ │   137 │   │   console = Console(file=string, width=width)           │ │
│ │   138 │   │   try:                                                  │ │
│ │ > 139 │   │   │   return func(*args, **kwargs)                      │ │
│ │   140 │   │   except Exception as e:                                │ │
│ │   141 │   │   │   tables = [                                        │ │
│ │   142 │   │   │   │   get_table(title, data)                        │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\extensions\adetailer\scripts\!adetailer.py:656 in                │ │
│ │ postprocess_image                                                   │ │
│ │                                                                     │ │
│ │   653 │   │   │   for n, args in enumerate(arg_list):               │ │
│ │   654 │   │   │   │   if args.ad_model == "None":                   │ │
│ │   655 │   │   │   │   │   continue                                  │ │
│ │ > 656 │   │   │   │   is_processed |= self._postprocess_image_inner │ │
│ │   657 │   │                                                         │ │
│ │   658 │   │   if is_processed:                                      │ │
│ │   659 │   │   │   self.save_image(                                  │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\extensions\adetailer\scripts\!adetailer.py:579 in                │ │
│ │ _postprocess_image_inner                                            │ │
│ │                                                                     │ │
│ │   576 │   │   │   kwargs["device"] = self.ultralytics_device        │ │
│ │   577 │   │                                                         │ │
│ │   578 │   │   with change_torch_load():                             │ │
│ │ > 579 │   │   │   pred = predictor(ad_model, pp.image, args.ad_conf │ │
│ │   580 │   │                                                         │ │
│ │   581 │   │   masks = self.pred_preprocessing(pred, args)           │ │
│ │   582                                                               │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\extensions\adetailer\adetailer\ultralytics.py:21 in              │ │
│ │ ultralytics_predict                                                 │ │
│ │                                                                     │ │
│ │   18 ) -> PredictOutput:                                            │ │
│ │   19 │   from ultralytics import YOLO                               │ │
│ │   20 │                                                              │ │
│ │ > 21 │   model = YOLO(model_path)                                   │ │
│ │   22 │   pred = model(image, conf=confidence, device=device)        │ │
│ │   23 │                                                              │ │
│ │   24 │   bboxes = pred[0].boxes.xyxy.cpu().numpy()                  │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\venv\lib\site-packages\ultralytics\engine\model.py:92 in         │ │
│ │ __init__                                                            │ │
│ │                                                                     │ │
│ │    89 │   │   if suffix in ('.yaml', '.yml'):                       │ │
│ │    90 │   │   │   self._new(model, task)                            │ │
│ │    91 │   │   else:                                                 │ │
│ │ >  92 │   │   │   self._load(model, task)                           │ │
│ │    93 │                                                             │ │
│ │    94 │   def __call__(self, source=None, stream=False, **kwargs):  │ │
│ │    95 │   │   """Calls the 'predict' function with given arguments  │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\venv\lib\site-packages\ultralytics\engine\model.py:137 in _load  │ │
│ │                                                                     │ │
│ │   134 │   │   """                                                   │ │
│ │   135 │   │   suffix = Path(weights).suffix                         │ │
│ │   136 │   │   if suffix == '.pt':                                   │ │
│ │ > 137 │   │   │   self.model, self.ckpt = attempt_load_one_weight(w │ │
│ │   138 │   │   │   self.task = self.model.args['task']               │ │
│ │   139 │   │   │   self.overrides = self.model.args = self._reset_ck │ │
│ │   140 │   │   │   self.ckpt_path = self.model.pt_path               │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\venv\lib\site-packages\ultralytics\nn\tasks.py:588 in            │ │
│ │ attempt_load_one_weight                                             │ │
│ │                                                                     │ │
│ │   585                                                               │ │
│ │   586 def attempt_load_one_weight(weight, device=None, inplace=True │ │
│ │   587 │   """Loads a single model weights."""                       │ │
│ │ > 588 │   ckpt, weight = torch_safe_load(weight)  # load ckpt       │ │
│ │   589 │   args = {**DEFAULT_CFG_DICT, **(ckpt.get('train_args', {}) │ │
│ │   590 │   model = (ckpt.get('ema') or ckpt['model']).to(device).flo │ │
│ │   591                                                               │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\venv\lib\site-packages\ultralytics\nn\tasks.py:527 in            │ │
│ │ torch_safe_load                                                     │ │
│ │                                                                     │ │
│ │   524 │   │   │   │   'ultralytics.yolo.utils': 'ultralytics.utils' │ │
│ │   525 │   │   │   │   'ultralytics.yolo.v8': 'ultralytics.models.yo │ │
│ │   526 │   │   │   │   'ultralytics.yolo.data': 'ultralytics.data'}) │ │
│ │ > 527 │   │   │   return torch.load(file, map_location='cpu'), file │ │
│ │   528 │                                                             │ │
│ │   529 │   except ModuleNotFoundError as e:  # e.name is missing mod │ │
│ │   530 │   │   if e.name == 'models':                                │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\venv\lib\site-packages\torch\serialization.py:815 in load        │ │
│ │                                                                     │ │
│ │    812 │   │   │   │   return _legacy_load(opened_file, map_locatio │ │
│ │    813 │   │   │   except RuntimeError as e:                        │ │
│ │    814 │   │   │   │   raise pickle.UnpicklingError(UNSAFE_MESSAGE  │ │
│ │ >  815 │   │   return _legacy_load(opened_file, map_location, pickl │ │
│ │    816                                                              │ │
│ │    817                                                              │ │
│ │    818 # Register pickling support for layout instances such as     │ │
│ │                                                                     │ │
│ │ E:\SM\Data\Packages\SD.Next Web                                     │ │
│ │ UI\venv\lib\site-packages\torch\serialization.py:1033 in            │ │
│ │ _legacy_load                                                        │ │
│ │                                                                     │ │
│ │   1030 │   │   │   f"Received object of type \"{type(f)}\". Please  │ │
│ │   1031 │   │   │   "functionality.")                                │ │
│ │   1032 │                                                            │ │
│ │ > 1033 │   magic_number = pickle_module.load(f, **pickle_load_args) │ │
│ │   1034 │   if magic_number != MAGIC_NUMBER:                         │ │
│ │   1035 │   │   raise RuntimeError("Invalid magic number; corrupt fi │ │
│ │   1036 │   protocol_version = pickle_module.load(f, **pickle_load_a │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ EOFError: Ran out of input                                              │
└─────────────────────────────────────────────────────────────────────────┘

List of installed extensions

a1111-sd-webui-lycoris clip-interrogator-ext LDSR multidiffusion-upscaler-for-automatic1111 ScuNET sd-extension-system-info sd-webui-agent-scheduler sd-webui-controlnet stable-diffusion-webui-images-browser stable-diffusion-webui-rembg SwinIR a1111-sd-webui-tagcomplete adetailer model-keyword sd-dynamic-prompts

Bing-su commented 9 months ago

It works fine for me. I have no idea what the problem is.

brknsoul commented 9 months ago

Ok, I think some of my cached models are corrupted. If I delete these and re-download them into models\adetailer (rather than the huggingface cache), will that work?

Bing-su commented 9 months ago

If the problem is the model is corrupt, then it should work.

brknsoul commented 9 months ago

ok, looks like some of the symlinks got corrupted somehow. I deleted the Bingsu folder in the huggingface cache, and adetailer redownloaded them on the next launch.

Closing.