ddPn08 / Radiata

Stable diffusion webui based on diffusers.
https://ddpn08.github.io/Radiata/
Apache License 2.0
983 stars 68 forks source link

TypeError: Tensor.resize() got an unexpected keyword argument 'resample' (when using upresfix with batch size higher than 2 using either diffusers or tensorRT models #96

Closed boricuapab closed 1 year ago

boricuapab commented 1 year ago

Describe the bug

when using either diffusers or tensor rt converted models and high res fix with batch size more than 1 produces the following error

TypeError: Tensor.resize() got an unexpected keyword argument 'resample'

Also, is --medvram implemented as a radiata flag?

Also, it's strange that when using high res fix the generated images get output into the img2img folder.

Reproduction

generate an image with batch size 2 or more with high res fix using diffuser/tensor rt converted model

Expected behavior

in a1111, Im able to generate high res fix with batches up to 4

System Info

win 10 rtx 2060 super 8gb

Additional context

Traceback (most recent call last): File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\gradio\routes.py", line 422, in run_predict output = await app.get_blocks().process_api( File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\gradio\blocks.py", line 1067, in call_function prediction = await utils.async_iteration(iterator) File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\gradio\utils.py", line 336, in async_iteration return await iterator.anext() File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\gradio\utils.py", line 329, in anext return await anyio.to_thread.run_sync( File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\gradio\utils.py", line 312, in run_sync_iterator_async return next(iterator) File "C:\sdRadiata\Radiata\modules\tabs\generate.py", line 75, in wrapper yield from fn(self, opts, plugin_values) File "C:\sdRadiata\Radiata\modules\tabs\generate.py", line 120, in generate_image for data in model_manager.sd_model(opts, plugin_data): File "C:\sdRadiata\Radiata\modules\model.py", line 201, in call images = feature.result().images File "C:\ProgramData\miniconda3\envs\radiata\lib\concurrent\futures_base.py", line 451, in result return self.get_result() File "C:\ProgramData\miniconda3\envs\radiata\lib\concurrent\futures_base.py", line 403, in get_result raise self._exception File "C:\ProgramData\miniconda3\envs\radiata\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(self.args, *self.kwargs) File "C:\ProgramData\miniconda3\envs\radiata\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, **kwargs) File "C:\sdRadiata\Radiata\modules\diffusion\pipelines\diffusers.py", line 476, in call opts.image = self.preprocess_image(opts.image, opts.height, opts.width) File "C:\sdRadiata\Radiata\modules\diffusion\pipelines\diffusers.py", line 222, in preprocess_image image = image.resize((width, height), resample=PIL_INTERPOLATION["lanczos"]) TypeError: Tensor.resize() got an unexpected keyword argument 'resample' [INFO] HTTP Request: POST http://127.0.0.1:7860/api/predict "HTTP/1.1 500 Internal Server Error" [INFO] HTTP Request: POST http://127.0.0.1:7860/reset "HTTP/1.1 200 OK"

Validations

ddPn08 commented 1 year ago

This error doesn't seem to be OOM. did you use img2img?

boricuapab commented 1 year ago

I just enabled high res fix, but it does output the upscaled images into the img2img output folder, which I thought was strange.

ddPn08 commented 1 year ago

It seems there is a little bug. I'm going to investigate.

Isotr0py commented 1 year ago

We reuse the img2img to run the second step in hiresfix for convenience, so it will be an error when batch size>1.

It's easy to fix it, I will fix it soon.