mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
562 stars 150 forks source link

Issue with docker #41

Closed rossman22590 closed 10 months ago

rossman22590 commented 10 months ago

Traceback (most recent call last): File "/app/main.py", line 378, in if prepare_environments(args): File "/app/main.py", line 224, in prepare_environments if not requirements_met(requirements_file): File "/app/main.py", line 130, in requirements_met import packaging.version

konieshadow commented 10 months ago

It should be fixed. Please update docker image using:

docker pull konieshadow/fooocus-api

Or using the latest tag: v0.3.6

rossman22590 commented 10 months ago

how do i get txt to image to work? right now it doesn but launches fine and api is up

konieshadow commented 10 months ago

how do i get txt to image to work? right now it doesn but launches fine and api is up

Can you open http://127.0.0.1:8888 ?

konieshadow commented 10 months ago

And cound you paste some output logs?

rossman22590 commented 10 months ago

2023-11-03 23:08:51 Working with z of shape (1, 4, 32, 32) = 4096 dimensions. 2023-11-03 23:08:51 Using pytorch attention in VAE 2023-11-03 23:08:51 missing {'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_l.text_projection'} 2023-11-03 23:08:51 Base model loaded: /app/repositories/Fooocus/models/checkpoints/juggernautXL_version6Rundiffusion.safetensors 2023-11-03 23:08:51 LoRAs loaded: [('sd_xl_offset_example-lora_1.0.safetensors', 0.1), ('None', 0.1), ('None', 0.1), ('None', 0.1), ('None', 0.1)] 2023-11-03 23:08:51 Fooocus Expansion engine loaded for cuda:0, use_fp16 = True. 2023-11-03 23:08:51 Requested to load SDXLClipModel 2023-11-03 23:08:51 Requested to load GPT2LMHeadModel 2023-11-03 23:08:51 Loading 2 new models 2023-11-03 23:08:51 [Fooocus Model Management] Moving model(s) has taken 0.25 seconds 2023-11-03 23:08:51 INFO: 172.17.0.1:56778 - "POST /v1/generation/text-to-image HTTP/1.1" 500 Internal Server Error 2023-11-03 23:08:51 ERROR: Exception in ASGI application 2023-11-03 23:08:51 Traceback (most recent call last): 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi 2023-11-03 23:08:51 result = await app( # type: ignore[func-returns-value] 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call 2023-11-03 23:08:51 return await self.app(scope, receive, send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/fastapi/applications.py", line 292, in call 2023-11-03 23:08:51 await super().call(scope, receive, send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in call 2023-11-03 23:08:51 await self.middleware_stack(scope, receive, send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in call 2023-11-03 23:08:51 raise exc 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in call 2023-11-03 23:08:51 await self.app(scope, receive, _send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call 2023-11-03 23:08:51 raise exc 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call 2023-11-03 23:08:51 await self.app(scope, receive, sender) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call 2023-11-03 23:08:51 raise e 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call 2023-11-03 23:08:51 await self.app(scope, receive, send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in call 2023-11-03 23:08:51 await route.handle(scope, receive, send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle 2023-11-03 23:08:51 await self.app(scope, receive, send) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app 2023-11-03 23:08:51 response = await func(request) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/fastapi/routing.py", line 273, in app 2023-11-03 23:08:51 raw_response = await run_endpoint_function( 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/fastapi/routing.py", line 192, in run_endpoint_function 2023-11-03 23:08:51 return await run_in_threadpool(dependant.call, values) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool 2023-11-03 23:08:51 return await anyio.to_thread.run_sync(func, args) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync 2023-11-03 23:08:51 return await get_asynclib().run_sync_in_worker_thread( 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread 2023-11-03 23:08:51 return await future 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run 2023-11-03 23:08:51 result = context.run(func, args) 2023-11-03 23:08:51 File "/app/fooocusapi/api.py", line 88, in text2img_generation 2023-11-03 23:08:51 results = call_worker(req, accept) 2023-11-03 23:08:51 File "/app/fooocusapi/api.py", line 65, in call_worker 2023-11-03 23:08:51 results = process_generate(queue_task, params) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context 2023-11-03 23:08:51 return func(*args, *kwargs) 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context 2023-11-03 23:08:51 return func(args, kwargs) 2023-11-03 23:08:51 File "/app/fooocusapi/worker.py", line 35, in process_generate 2023-11-03 23:08:51 import fooocus_extras.preprocessors as preprocessors 2023-11-03 23:08:51 File "/app/repositories/Fooocus/fooocus_extras/preprocessors.py", line 1, in 2023-11-03 23:08:51 import cv2 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/cv2/init.py", line 181, in 2023-11-03 23:08:51 bootstrap() 2023-11-03 23:08:51 File "/opt/venv/lib/python3.10/site-packages/cv2/init.py", line 153, in bootstrap 2023-11-03 23:08:51 native_module = importlib.import_module("cv2") 2023-11-03 23:08:51 File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module 2023-11-03 23:08:51 return _bootstrap._gcd_import(name[level:], package, level) 2023-11-03 23:08:51 ImportError: libGL.so.1: cannot open shared object file: No such file or directory

rossman22590 commented 10 months ago

when i try to geenrate

rossman22590 commented 10 months ago

Responses

Curl

curl -X 'POST' \
  'http://127.0.0.1:8888/v1/generation/text-to-image' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "",
  "negative_prompt": "",
  "style_selections": [
    "Fooocus V2",
    "Fooocus Enhance",
    "Fooocus Sharp"
  ],
  "performance_selection": "Speed",
  "aspect_ratios_selection": "1152×896",
  "image_number": 1,
  "image_seed": -1,
  "sharpness": 2,
  "guidance_scale": 4,
  "base_model_name": "juggernautXL_version6Rundiffusion.safetensors",
  "refiner_model_name": "None",
  "loras": [
    {
      "model_name": "sd_xl_offset_example-lora_1.0.safetensors",
      "weight": 0.1
    }
  ],
  "require_base64": false,
  "async_process": false
}'

Request URL

http://127.0.0.1:8888/v1/generation/text-to-image

Server response

Code | Details -- | -- 500Undocumented | Error: Internal Server ErrorResponse bodyDownloadInternal Server ErrorResponse headers content-length: 21 content-type: text/plain; charset=utf-8 date: Sat,04 Nov 2023 03:34:40 GMT server: uvicorn
konieshadow commented 10 months ago

Looks like an error related OpenCV dependency of Docker image. Fixed in v0.3.8.

rayadaschn commented 9 months ago

🙏 This problem seems to have reappeared in v0.3.22:

When I run python main.py

[Fooocus-API] Task queue size: 3, queue history size: 100
Traceback (most recent call last):
  File "/home/Fooocus-API/main.py", line 378, in <module>
    if prepare_environments(args):
  File "/home/Fooocus-API/main.py", line 286, in prepare_environments
    import modules.config as config
ModuleNotFoundError: No module named 'modules'

👀 It seems that the server container can not access github, so how to use it in China? (PS. The server can connect to github.com (140.82.114.4))