Had to hack animatediff_ui.py set_p function for API to work #489
Replies: 1 comment
-
Ok, I've fixed it with Claude's help, when it started to tell me to start hacking into the source files I had to come here first to ask. I did however hack the animatediff_ui.py file, I adjusted the the set_p function to skip it and it works on API now. def set_p(self, p: StableDiffusionProcessing):
|
Beta Was this translation helpful? Give feedback.
-
I've looked over:
https://github.com/continue-revolution/sd-webui-animatediff/blob/master/docs/how-to-use.md#parameters
And I've looked over:
https://github.com/continue-revolution/sd-webui-animatediff/blob/master/scripts/animatediff_ui.py#L26
My non-coding self has been relying on Claude to write my code for me and it's come up with:
`class AnimateDiffAPI:
def init(self, url):
self.url = url
print(f"Initialized AnimateDiffAPI with URL: {self.url}")
if name == "main":
anim_api = AnimateDiffAPI(url="http://127.0.0.1:7860")
anim_api.generate_animation(
prompt="a cute puppy playing in a garden",
negative_prompt="ugly, deformed, mutated, scary, creepy, zombie, monster",
#steps=20,
#sampler_name="Euler",
#cfg_scale=7,
#width=512,
#height=512,
model="mm_sd15_v3.safetensors",
format=["GIF"],
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
)`
And when I run the API it's as if it's expecting me to give video source for CN.
`env "D:\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Launching Web UI with arguments: --xformers --medvram --api
CivitAI Browser+: Aria2 RPC started
ControlNet preprocessor location: D:\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2024-03-28 14:27:41,595 - ControlNet - INFO - ControlNet v1.1.442
2024-03-28 14:27:41,874 - ControlNet - INFO - ControlNet v1.1.442
Loading weights [18ed2b6c48] from D:\stable-diffusion-webui\models\Stable-diffusion\xxmix9realistic_v40.safetensors
Creating model from config: D:\stable-diffusion-webui\configs\v1-inference.yaml
Applying attention optimization: xformers... done.
Model loaded in 2.0s (load weights from disk: 0.1s, create model: 0.5s, apply weights to model: 0.9s, calculate empty prompt: 0.4s).
2024-03-28 14:27:44,866 - ControlNet - INFO - ControlNet UI callback registered.
Deforum ControlNet support: enabled
Running on local URL: http://127.0.0.1:7860
To create a public link, set
share=True
inlaunch()
.Startup time: 37.5s (prepare environment: 10.1s, import torch: 10.4s, import gradio: 2.2s, setup paths: 2.7s, initialize shared: 0.4s, other imports: 1.3s, load scripts: 5.3s, create ui: 3.6s, gradio launch: 0.6s, add APIs: 0.7s).
2024-03-28 14:28:28,252 - AnimateDiff - INFO - AnimateDiff process start.
2024-03-28 14:28:28,252 - AnimateDiff - INFO - Loading motion module mm_sd15_v3.safetensors from D:\stable-diffusion-webui\extensions\sd-webui-animatediff\model\mm_sd15_v3.safetensors
2024-03-28 14:28:28,310 - AnimateDiff - INFO - Guessed mm_sd15_v3.safetensors architecture: MotionModuleType.AnimateDiffV3
2024-03-28 14:28:33,051 - AnimateDiff - INFO - Injecting motion module mm_sd15_v3.safetensors into SD1.5 UNet input blocks.
2024-03-28 14:28:33,052 - AnimateDiff - INFO - Injecting motion module mm_sd15_v3.safetensors into SD1.5 UNet output blocks.
2024-03-28 14:28:33,053 - AnimateDiff - INFO - Setting DDIM alpha.
2024-03-28 14:28:33,217 - AnimateDiff - INFO - Injection finished.
*** Error running before_process: D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\scripts.py", line 776, in before_process
script.before_process(p, *script_args)
File "D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff.py", line 65, in before_process
params.set_p(p)
File "D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff_ui.py", line 180, in set_p
extract_frames_from_video(self)
File "D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff_utils.py", line 108, in extract_frames_from_video
assert params.video_source, "You need to specify cond hint for ControlNet."
AssertionError: You need to specify cond hint for ControlNet.
0%| | 0/20 [00:00<?, ?it/s]*** Error executing callback cfg_denoiser_callback for D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\script_callbacks.py", line 230, in cfg_denoiser_callback
c.callback(params)
File "D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff_infv2v.py", line 102, in animatediff_on_cfg_denoiser
ad_params.text_cond = ad_params.prompt_scheduler.multi_cond(cfg_params.text_cond, prompt_closed_loop)
AttributeError: 'NoneType' object has no attribute 'multi_cond'
5%|██▊ | 1/20 [00:03<01:01, 3.24s/it]*** Error executing callback cfg_denoiser_callback for D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\script_callbacks.py", line 230, in cfg_denoiser_callback
c.callback(params)
File "D:\stable-diffusion-webui\extensions\sd-webui-animatediff\scripts\animatediff_infv2v.py", line 175, in animatediff_on_cfg_denoiser
cfg_params.text_cond = ad_params.text_cond
AttributeError: 'AnimateDiffProcess' object has no attribute 'text_cond'`
I want to only do a text to animated video, no extra CN here but seems I'm not sending proper API and I can't figure it out, even has Claude stumped so I ask here how to set proper params. Sorry for so noob.
Beta Was this translation helpful? Give feedback.
All reactions