Attention-Refocusing / attention-refocusing

MIT License
113 stars 9 forks source link

RuntimeError: Error(s) in loading state_dict for FrozenCLIPEmbedder #2

Closed Z-MU-Z closed 1 year ago

Z-MU-Z commented 1 year ago

Hi! Thanks for your great work! when I run this command python guide_gligen.py --ckpt weights/gligen/diffusion_pytorch_model.bin --type counting --box_pickle data_evaluate_LLM/gpt_generated_box/counting.p

it throws the below error: Traceback (most recent call last): File "/mnt/nas/share/home/zmz/code/attention-refocusing/guide_gligen.py", line 539, in models = load_ckpt(meta_list[0]["ckpt"]) File "/mnt/nas/share/home/zmz/code/attention-refocusing/guide_gligen.py", line 88, in load_ckpt text_encoder.load_state_dict( saved_ckpt["text_encoder"] ) File "/home/zmz/miniconda3/envs/fsdet110/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1482, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for FrozenCLIPEmbedder: Unexpected key(s) in state_dict: "transformer.text_model.embeddings.position_ids".

Do you know how to fix this?

Z-MU-Z commented 1 year ago

After I reconfigured the environment following the official steps, the above bug seems to have been fixed. However, a new bug has emerged. Traceback (most recent call last): File "guide_gligen.py", line 587, in run(meta, models, info_files, args, starting_noise, k,i) File "guide_gligen.py", line 449, in run output_folder1 = os.path.join( args.folder, meta["save_folder_name"]+'_img') TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Attention-Refocusing commented 1 year ago

Hi, you should include --file_save in the script to run guide_gligen.py