pythongosssss / ComfyUI-WD14-Tagger

A ComfyUI extension allowing for the interrogation of booru tags from images.
MIT License
436 stars 51 forks source link

aiohttp TimeoutError when downloading models #52

Open frictionel opened 1 month ago

frictionel commented 1 month ago

With a slow connection, the download of the models will not work:

model.onnx: 89%|████████████████████████████████████████████████▏ | 338M/379M [04:59<00:36, 1.13MB/s] !!! Exception during processing!!! Traceback (most recent call last): File "/Users//git/ComfyUI/execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//git/ComfyUI/execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/*/git/ComfyUI/execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//git/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/wd14tagger.py", line 200, in tag tags.append(wait_for_async(lambda: tag(image, model, threshold, character_threshold, exclude_tags, replace_underscore, trailing_comma))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//git/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/pysssss.py", line 215, in wait_for_async File "/Users//miniforge3/envs/pytorch312/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Users//git/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/pysssss.py", line 205, in run_async res.append(r) ^^^^^^^^^^ File "/Users//git/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/wd14tagger.py", line 55, in tag await download_model(model_name, client_id, node) File "/Users//git/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/wd14tagger.py", line 129, in download_model await download_to_file( File "/Users//git/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/pysssss.py", line 187, in download_to_file f.write(chunk) File "/Users//miniforge3/envs/pytorch312/lib/python3.12/site-packages/aiohttp/streams.py", line 44, in anext rv = await self.read_func() ^^^^^^^^^^^^^^^^^^^^^^ File "/Users//miniforge3/envs/pytorch312/lib/python3.12/site-packages/aiohttp/streams.py", line 383, in read await self._wait("read") File "/Users//miniforge3/envs/pytorch312/lib/python3.12/site-packages/aiohttp/streams.py", line 301, in _wait with self._timer: File "/Users//miniforge3/envs/pytorch312/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in exit raise asyncio.TimeoutError from None TimeoutError

Prompt executed in 300.22 seconds

I propose to remove the standard five-minute timeout of aiohttp or set it to a higher value.

async with session.get(url, timeout=None) as response:

bejaranoo commented 2 weeks ago

manually download the model with your browser from here: https://huggingface.co/SmilingWolf/wd-v1-4-convnext-tagger-v2/resolve/main/model.onnx?download=true

change its name to "wd-v1-4-moat-tagger-v2.onnx" and replace the one in \ComfyUI\custom_nodes\ComfyUI-WD14-Tagger\models