出现了非常多的问题,痛苦
1.首先是下载基础模型
手动下载所有模型并创建目录放到对应的地方
文件路径问题是最简单也是最麻烦的,简单是只要把原来指向huggingface和openai之类要联网下载的路径改为存放文件的本地路径就行,一定要是绝对路径,不带文件名。麻烦是因为要改的地方又多又杂,根据报错挨个改吧
运行:
python -m scripts.animate --config configs/prompts/2-Lyriel.yaml
2.报错:RuntimeError: don't know how to restore data location of torch.storage.UntypedStorage (tagged with gpu)
Traceback (most recent call last):
File "/opt/conda/envs/animatediff/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/conda/envs/animatediff/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/data/AnimateDiff/scripts/animate.py", line 124, in <module>
main(args)
File "/data/AnimateDiff/scripts/animate.py", line 62, in main
pipeline = load_weights(
File "/data/AnimateDiff/animatediff/utils/util.py", line 109, in load_weights
motion_module_state_dict = torch.load(motion_module_path, map_location="gpu")
File "/opt/conda/envs/animatediff/lib/python3.10/site-packages/torch/serialization.py", line 789, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/opt/conda/envs/animatediff/lib/python3.10/site-packages/torch/serialization.py", line 1131, in _load
result = unpickler.load()
File "/opt/conda/envs/animatediff/lib/python3.10/site-packages/torch/serialization.py", line 1101, in persistent_load
load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
File "/opt/conda/envs/animatediff/lib/python3.10/site-packages/torch/serialization.py", line 1083, in load_tensor
wrap_storage=restore_location(storage, location),
File "/opt/conda/envs/animatediff/lib/python3.10/site-packages/torch/serialization.py", line 1052, in restore_location
return default_restore_location(storage, map_location)
File "/opt/conda/envs/animatediff/lib/python3.10/site-packages/torch/serialization.py", line 218, in default_restore_location
raise RuntimeError("don't know how to restore data location of "
RuntimeError: don't know how to restore data location of torch.storage.UntypedStorage (tagged with gpu)
解决方法:
【报错记录】RuntimeError: don‘t know how to restore data location of torch.FloatStorage (tagged with CPU)-CSDN博客
model.load_state_dict(torch.load(args.pre_train, map_location='CPU'),strict=True)
改为:
model.load_state_dict(torch.load(args.pre_train, map_location={'0':'CPU'}), strict=True)
问题得以解决。
3.UnboundLocalError: local variable 'dreambooth_state_dict' referenced before assignment
load dreambooth model from /data/AnimateDiff/models/DreamBooth_LoRA
Traceback (most recent call last):
File "/opt/conda/envs/animatediff/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/conda/envs/animatediff/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/data/AnimateDiff/scripts/animate.py", line 124, in <module>
main(args)
File "/data/AnimateDiff/scripts/animate.py", line 62, in main
pipeline = load_weights(
File "/data/AnimateDiff/animatediff/utils/util.py", line 129, in load_weights
converted_vae_checkpoint = convert_ldm_vae_checkpoint(dreambooth_state_dict, animation_pipeline.vae.config)
UnboundLocalError: local variable 'dreambooth_state_dict' referenced before assignment
怎么会有这种错误,我又没改函数定义。。这应该是作者应该操心的呀
解决方法:改了一下函数声明的位置
啊啊啊!终于run起来了吗!
不过只是一个app.py。。接下来解决test