brycedrennan / imaginAIry

Pythonic AI generation of images and videos
MIT License
7.94k stars 441 forks source link

aimg server - "TypeError: Base64Bytes.validate() takes 2 positional arguments but 3 were given" #380

Closed ChristopherDaigle closed 1 year ago

ChristopherDaigle commented 1 year ago

When running the server, I receive a TypeError . Am unable to generate or edit an image based on this.

Larger log of error below: ```shell (venv_patio) (base) A_USER@A_MACHINE patio_gen % aimg A_PATH/lib/python3.10/site-packages/pydantic/_internal/_fields.py:127: UserWarning: Field "model_config_path" has conflict with protected namespace "model_". You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`. warnings.warn( Usage: aimg [OPTIONS] COMMAND [ARGS]... 🤖🧠 ImaginAIry. Pythonic generation of images via AI Options: --help Show this message and exit. Commands: colorize Colorize images using AI. describe Generate text descriptions of images. edit Edit an image via AI. edit-demo Make some fun pre-set edits to input photos. imagine Generate images via AI. model-list Print list of available models. prep-images Prepare a folder of images for training. prune-ckpt Prune a checkpoint file. server Run a HTTP API server. system-info Display system information. train-concept Teach the model a new concept (a person, thing, style,... upscale Upscale an image 4x using AI. version Print the version. Starting imaginAIry shell... 🤖🧠> server 2023-09-25 11:18:44,478 [INFO] imaginairy.cli.run_api:17: Starting HTTP API server at http://0.0.0.0:8000 INFO: Started server process [50211] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: 127.0.0.1:52180 - "GET /Inter.ttf HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52181 - "GET /Inter.ttf HTTP/1.1" 304 Not Modified 2023-09-25 11:19:00,617 [INFO] imaginairy.api:170: 🖼 Generating 1/1: "Bowl of steaming hot ramen with a perfect egg in the center, surrounded by thin slices of meat, green onions, and nori, with a flavorful broth and perfect noodles, high detail, focused on texture and steam" 512x512px negative-prompt:"Ugly, duplication, duplicates, mutilation, deformed, mutilated, mutation, twisted body, disfigured, bad anatomy, out of frame, extra fingers, mutated hands, poorly drawn hands, extra limbs, malformed limbs, missing arms, extra arms, missing legs, extra legs, mutated hands, extra hands, fused fingers, missing fingers, extra fingers, long neck, small head, closed eyes, rolling eyes, weird eyes, smudged face, blurred face, poorly drawn face, mutation, mutilation, cloned face, strange mouth, grainy, blurred, blurry, writing, calligraphy, signature, text, watermark, bad art," seed:None prompt-strength:7.5 steps:16 sampler-type:k_dpmpp_2m init-image-strength:0.2 model:SD-1.5 2023-09-25 11:19:00,814 [DEBUG] imaginairy.model_manager:315: Loading model weights from: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt 2023-09-25 11:19:00,814 [DEBUG] imaginairy.model_manager:316: Loading model config from: configs/stable-diffusion-v1.yaml 2023-09-25 11:19:00,814 [DEBUG] imaginairy.utils.model_cache:344: Loading model: ('stable-diffusion', ('config_path', 'configs/stable-diffusion-v1.yaml'), ('weights_location', 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt'), ('half_mode', None), ('for_training', False)) 2023-09-25 11:19:00,814 [DEBUG] imaginairy.utils.model_cache:153: GPU cache: 0 items; 0.0 MB; Max: 62259.2 MB; CPU cache: 0 items; 0.0 MB; Max: 0.0 MB; mem_free_total: 22992.8 MB; Ram Free: 38321.3 MB; 2023-09-25 11:19:00,814 [DEBUG] imaginairy.utils.model_cache:154: Ensuring 1951.0 MB of GPU space. 2023-09-25 11:19:03,297 [DEBUG] imaginairy.utils:66: Instantiation of took 2.423119332990609 seconds 2023-09-25 11:19:03,537 [DEBUG] imaginairy.utils:66: Instantiation of took 4.292000085115433e-06 seconds 2023-09-25 11:19:03,537 [DEBUG] imaginairy.utils:66: Instantiation of took 0.23940949991811067 seconds 2023-09-25 11:19:04,948 [DEBUG] imaginairy.utils:66: Instantiation of took 1.2937187500065193 seconds 2023-09-25 11:19:04,951 [DEBUG] imaginairy.utils:66: Instantiation of took 4.078184957965277 seconds 2023-09-25 11:19:04,952 [INFO] imaginairy.model_manager:54: Loading model /Users/christopherdaigle/.cache/huggingface/hub/models--runwayml--stable-diffusion-v1-5/snapshots/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt onto mps:0 backend... 2023-09-25 11:19:07,394 [DEBUG] imaginairy.utils.model_cache:352: Model loaded: ('stable-diffusion', ('config_path', 'configs/stable-diffusion-v1.yaml'), ('weights_location', 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt'), ('half_mode', None), ('for_training', False)) Used -6511194931.200001 2023-09-25 11:19:07,396 [DEBUG] imaginairy.utils.model_cache:153: GPU cache: 0 items; 0.0 MB; Max: 62259.2 MB; CPU cache: 0 items; 0.0 MB; Max: 0.0 MB; mem_free_total: 16780.5 MB; Ram Free: 27967.6 MB; 2023-09-25 11:19:07,396 [DEBUG] imaginairy.utils.model_cache:154: Ensuring 4067.4 MB of GPU space. 2023-09-25 11:19:07,456 [DEBUG] imaginairy.utils.model_cache:246: moving ('stable-diffusion', ('config_path', 'configs/stable-diffusion-v1.yaml'), ('weights_location', 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt'), ('half_mode', None), ('for_training', False)) to gpu Global seed set to 697049987 Global seed set to 697049987 2023-09-25 11:19:07,685 [DEBUG] imaginairy.utils:178: Made noise of size [1, 4, 64, 64] from seed 697049987. md5:251211a44f391c11a2641b93fb271a71 100%|███████████████████████████████████████████| 15/15 [00:09<00:00, 1.59it/s] 2023-09-25 11:19:19,742 [INFO] imaginairy.api:631: Image Generated. Timings: conditioning:0.20s sampling:9.51s decoding:0.52s safety-filter:1.93s total:12.19s Unhandled error: Base64Bytes.validate() takes 2 positional arguments but 3 were given Traceback (most recent call last): File "A_PATH/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/cors.py", line 91, in __call__ await self.simple_response(scope, receive, send, request_headers=headers) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/cors.py", line 146, in simple_response await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ raise exc File "A_PATH/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "A_PATH/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__ raise e File "A_PATH/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__ await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "A_PATH/lib/python3.10/site-packages/fastapi/routing.py", line 273, in app raw_response = await run_endpoint_function( File "A_PATH/lib/python3.10/site-packages/fastapi/routing.py", line 190, in run_endpoint_function return await dependant.call(**values) File "A_PATH/lib/python3.10/site-packages/imaginairy/http/stablestudio/routes.py", line 32, in generate image = StableStudioImage(id=str(uuid.uuid4()), blob=img_base64) File "A_PATH/lib/python3.10/site-packages/pydantic/main.py", line 165, in __init__ __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__) TypeError: Base64Bytes.validate() takes 2 positional arguments but 3 were given INFO: 127.0.0.1:52180 - "POST /api/stablestudio/generate HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "A_PATH/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] File "A_PATH/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__ return await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/fastapi/applications.py", line 292, in __call__ await super().__call__(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__ await self.middleware_stack(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__ raise exc File "A_PATH/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/cors.py", line 91, in __call__ await self.simple_response(scope, receive, send, request_headers=headers) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/cors.py", line 146, in simple_response await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ raise exc File "A_PATH/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "A_PATH/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__ raise e File "A_PATH/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__ await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "A_PATH/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "A_PATH/lib/python3.10/site-packages/fastapi/routing.py", line 273, in app raw_response = await run_endpoint_function( File "A_PATH/lib/python3.10/site-packages/fastapi/routing.py", line 190, in run_endpoint_function return await dependant.call(**values) File "A_PATH/lib/python3.10/site-packages/imaginairy/http/stablestudio/routes.py", line 32, in generate image = StableStudioImage(id=str(uuid.uuid4()), blob=img_base64) File "A_PATH/lib/python3.10/site-packages/pydantic/main.py", line 165, in __init__ __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__) TypeError: Base64Bytes.validate() takes 2 positional arguments but 3 were given ^CINFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [50211] 🤖🧠> quit ```
brycedrennan commented 1 year ago

Fixed in just released 13.2.1

ChristopherDaigle commented 1 year ago

Works for me now! Thanks @brycedrennan !