puzzler10 / constraint_enforcing_reward

Code for the paper "A Constraint-Enforcing Reward for Adversarial Attacks on Text Classifiers"
https://arxiv.org/abs/2405.11904
Apache License 2.0
0 stars 0 forks source link

Issue regarding the decorator method #1

Open SachinVashisth opened 3 weeks ago

SachinVashisth commented 3 weeks ago

Hi I was trying to run the code using python run.py but I am getting this error: TypeError: _DecoratorContextManager.clone() got an unexpected keyword argument 'input_ids'

in the line 138 of trainer.py file: pp_output = self.pp_model.generate_with_grad(

I looked into possible solutions for it:

The same error has been talked on this huggingface forum: Same error with a possible solution here: Answer But when I used this solution, it gave me another error in line 411.

I may be getting this error due to some issues while installing the packages. Actually, when I tried to create conda virtual environment using environment.yml file, I was getting error in installing multiple packages. So, I used env_setup.md instead to create a smaller working environment.

puzzler10 commented 3 weeks ago

Thanks for checking this out.

Yeah, it's a package versioning issue. It's probably either something with the undecorated package or the transformers version. Start with the packages in environment.yml, they're what I've used, although I know there's dependency clashes.

A productionised version of this code would have had all those dependency issues ironed out, but there's no incentive for that in academia, and I'm sadly out of energy to maintain the code.

SachinVashisth commented 3 weeks ago

Hi, Thanks for responding.

My error was resolved. It was due to a version issue.

But when I try to run this command: python -m baselines.py --ds_name rotten_tomatoes

Then, it gives the message: No module named baselines.py

Can you please provide the python file baselines.py.