AttributeError: 'Parameter' object has no attribute 'named_children'
See original GitHub issueDescribe the bug
Hi, friends, I meet a problem I hope to get your help.
When I run the code as follow:
`from diffusers import StableDiffusionPipeline import torch
pipe = StableDiffusionPipeline.from_pretrained(“PATH_OF_MODEL/stable-diffusion”,device_map=“auto”,torch_type=torch.float16, revision=“fp16”) ` I save the model in the path “PATH_OF_MODEL/stable-diffusion” from the https://huggingface.co/CompVis/stable-diffusion-v1-4/tree/main Then, I get the error as follow:
ftfy or spacy is not installed using BERT BasicTokenizer instead of ftfy. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/diffusers/pipeline_utils.py", line 517, in from_pretrained loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs) File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2265, in from_pretrained device_map = infer_auto_device_map( File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/accelerate/utils/modeling.py", line 480, in infer_auto_device_map max_layer_size, max_layer_names = get_max_layer_size(modules_to_treat, module_sizes, no_split_module_classes) File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/accelerate/utils/modeling.py", line 261, in get_max_layer_size modules_children = list(module.named_children()) AttributeError: 'Parameter' object has no attribute 'named_children'
My environment: python=3.9.13, diffusers=0.5.1 torch=1.12.1, transformers = 4.12.1, spacy = 3.4.1,accelerate=0.13.1 which run on ubuntu=22.04.
I don’t know why, I sincerely to get your team help.Thanks,bro!
Reproduction
`from diffusers import StableDiffusionPipeline import torch
pipe = StableDiffusionPipeline.from_pretrained(“PATH_OF_MODEL/stable-diffusion”,device_map=“auto”,torch_type=torch.float16, revision=“fp16”)’
Logs
`ftfy or spacy is not installed using BERT BasicTokenizer instead of ftfy.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/diffusers/pipeline_utils.py", line 517, in from_pretrained
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2265, in from_pretrained
device_map = infer_auto_device_map(
File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/accelerate/utils/modeling.py", line 480, in infer_auto_device_map
max_layer_size, max_layer_names = get_max_layer_size(modules_to_treat, module_sizes, no_split_module_classes)
File "/home/klyuhang9/miniconda3/envs/PY_TEST/lib/python3.9/site-packages/accelerate/utils/modeling.py", line 261, in get_max_layer_size
modules_children = list(module.named_children())
AttributeError: 'Parameter' object has no attribute 'named_children'
System Info
My environment: python=3.9.13, diffusers=0.5.1 torch=1.12.1, transformers = 4.12.1, spacy = 3.4.1,accelerate=0.13.1 which run on ubuntu=22.04.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Patch is out on Pypi.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.