cure-lab / MMA-Diffusion

[CVPR2024] MMA-Diffusion: MultiModal Attack on Diffusion Models
Other
135 stars 7 forks source link

textual_attack.py的token_gradient方法在return处出现one_hot.grad为None而报错 #1

Open Thunderank opened 5 months ago

Thunderank commented 5 months ago

QQ截图20240413232149 如图所示,经过loss.backward之后one_hot仍为None类型

Windy4096 commented 5 months ago

hello, do u solve the problem?

Thunderank commented 5 months ago

hello, do u solve the problem?

No,I'm still stuck in here. I have tested all relevent variables and now suspect that something goes wrong with the "CosineSimilarityLoss" class

yangyijune commented 5 months ago

Hi! Have you resolved this issue? I haven't come across this problem myself. It's possible that there might be some gradient blocking codes in your transformers package's clip_modeling.py, such as @torch.no_grad(), which could be affecting the process.

1998v7 commented 4 months ago

Have you solved this problem?

Thunderank commented 4 months ago

没有,我这边按照readme的步骤配置的环境,使用mma_diffusion_environment.yml安装的依赖,然后也按照readme中的提示修改了transformer源代码添加了属性,但运行的时候报的错就是token_gradient(model, tokenizer, control, target_embeddings)函数中的return one_hot.grad.clone()一行提示AttributeError: 'NoneType' object has no attribute 'clone',输出发现one_hot对象不包含grad属性。 目前为止仍没有解决这一问题,但也没有遇到过hugg报错API失效的问题。

------------------ 原始邮件 ------------------ 发件人: "cure-lab/MMA-Diffusion" @.>; 发送时间: 2024年5月26日(星期天) 中午11:27 @.>; @.**@.>; 主题: Re: [cure-lab/MMA-Diffusion] textual_attack.py的token_gradient方法在return处出现one_hot.grad为None而报错 (Issue #1)

您好 请问您有碰到过hugg报错API失效吗?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>