continue-revolution / sd-forge-animatediff

AnimateDiff for Stable Diffusion WebUI Forge, mirror for https://github.com/continue-revolution/sd-webui-animatediff/tree/forge/master
93 stars 5 forks source link

[Bug]: API not working properly #2

Closed amanjain1397appy closed 3 months ago

amanjain1397appy commented 4 months ago

Is there an existing issue for this?

Have you read FAQ on README?

What happened?

I have installed the latest sd-webui-forge and also added this sd-forge-animatediff extension. In the UI, the AnimateDiff process is working fine, but as soon I try to replicate the process via the API, I am getting the following error.

Screenshot 2024-02-17 at 6 45 39 PM

I am using the following payload:

{
  "prompt": "(masterpiece, best quality:1.2), (anime), 1girl, looking at viewer, smile, hair ornament, bow, closed mouth, collarbone, upper body, flower, short sleeves, red hair, sky, day, cloud, black dress, blue sky, fur trim, facial mark, own hands together, bandaged arm, black collar, bandaged hand, (extremely_beautiful_detailed_anime_face)",
  "negative_prompt": "((naked)), ((nudity)), ((vagina)), ((penis)), ((breasts)), ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy, <BadDream:1>, by <bad-artist:1>, <UnrealisticDream:1>, <bad_prompt_version2:1>, <bad-hands-5:1>, by <bad-artist-anime:1>, <easynegative:1>",
  "steps": 20,
  "sampler_name": "Euler a",
  "cfg_scale": 4,
  "batch_size": 1,
  "n_iter": 1,
  "width": 512,
  "height": 512,
  "tiling": false,
  "alwayson_scripts": {
    "AnimateDiff": {
      "args": [
        {
          "model": "mm_sd_v15_v2.ckpt",
          "format": [
            "PNG",
            "Frame"
          ],
          "enable": true,
          "video_length": 16,
          "fps": 8,
          "loop_number": 0,
          "closed_loop": "R+P",
          "batch_size": 16,
          "stride": 1,
          "overlap": -1,
          "interp": "Off",
          "interp_x": 10,
          "latent_power": 1,
          "latent_scale": 32,
          "last_frame": null,
          "latent_power_last": 1,
          "latent_scale_last": 32,
          "request_id": ""
        }
      ]
    }
  }
}

Steps to reproduce the problem

  1. Open any Python environment, and write the given payload, and hit the /sdapi/v1/txt2img api
  2. Check the command line logs

What should have happened?

I should have gotten a list of base64 strings in the response.

Commit where the problem happens

webui: Forge 1.7.0 (latest) extension: sd-forge-animatediff

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No

Console logs

*** Error running before_process: /content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py
    Traceback (most recent call last):
      File "/content/stable-diffusion-webui/modules/scripts.py", line 790, in before_process
        script.before_process(p, *script_args)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py", line 52, in before_process
        params = get_animatediff_arg(p)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff_utils.py", line 25, in get_animatediff_arg
        p.script_args[script.args_from] = animatediff_arg
    TypeError: 'tuple' object does not support item assignment

---
*** Error running before_process_batch: /content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py
    Traceback (most recent call last):
      File "/content/stable-diffusion-webui/modules/scripts.py", line 806, in before_process_batch
        script.before_process_batch(p, *script_args, **kwargs)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py", line 63, in before_process_batch
        if params.enable and isinstance(p, StableDiffusionProcessingImg2Img) and not params.is_i2i_batch:
    AttributeError: 'dict' object has no attribute 'enable'

---
*** Error running process_batch: /content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py
    Traceback (most recent call last):
      File "/content/stable-diffusion-webui/modules/scripts.py", line 822, in process_batch
        script.process_batch(p, *script_args, **kwargs)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py", line 68, in process_batch
        if params.enable:
    AttributeError: 'dict' object has no attribute 'enable'

---
*** Error running process_before_every_sampling: /content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py
    Traceback (most recent call last):
      File "/content/stable-diffusion-webui/modules/scripts.py", line 830, in process_before_every_sampling
        script.process_before_every_sampling(p, *script_args, **kwargs)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py", line 73, in process_before_every_sampling
        if params.enable:
    AttributeError: 'dict' object has no attribute 'enable'

---
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 15.78it/s]
*** Error running postprocess_batch_list: /content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py00:01<00:00, 16.55it/s]
    Traceback (most recent call last):
      File "/content/stable-diffusion-webui/modules/scripts.py", line 854, in postprocess_batch_list
        script.postprocess_batch_list(p, pp, *script_args, **kwargs)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py", line 78, in postprocess_batch_list
        if params.enable:
    AttributeError: 'dict' object has no attribute 'enable'

---
*** Error running postprocess: /content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py
    Traceback (most recent call last):
      File "/content/stable-diffusion-webui/modules/scripts.py", line 838, in postprocess
        script.postprocess(p, processed, *script_args)
      File "/content/stable-diffusion-webui/extensions/sd-webui-animatediff/scripts/animatediff.py", line 83, in postprocess
        if params.enable:
    AttributeError: 'dict' object has no attribute 'enable'

---
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 15.44it/s]
API 2024-02-17 13:13:38.412828 200 http/1.1 POST /sdapi/v1/txt2img 122.161.69.214 1.4987███████████████████████████████| 20/20 [00:01<00:00, 16.55it/s]

Additional information

No response

continue-revolution commented 4 months ago

will fix soon today

prog-ape commented 4 months ago

Has this been resolved? The test still doesn't work!

yuchen1984 commented 4 months ago

Same problem still. The original version of sd-webui-animatediff (2.0.0a) also has got the problems in the API mode when adding ControlNets. The same payload configuration that used to be working well under 1.13.1 now fails.

Hope they can be fixed ASAP

yuchen1984 commented 4 months ago

FYI I made an unofficial hacky fix to v2.0.0a and the A1111 API now seems to work correctly for Animatediff+ControlNet .

https://github.com/continue-revolution/sd-webui-animatediff/compare/master...yuchen1984:sd-webui-animatediff:v2.0.0a-api-fix

I guess a similar fix can be applied to the forge versions v2.0.1f as well by modifying the related codes

continue-revolution commented 3 months ago

hopefully in today's new version it is working properly. if not, let me know.