QData / TextAttack

TextAttack 🐙 is a Python framework for adversarial attacks, data augmentation, and model training in NLP https://textattack.readthedocs.io/en/master/
https://textattack.readthedocs.io/en/master/
MIT License
2.92k stars 389 forks source link

a2t bug #754

Open ko120 opened 11 months ago

ko120 commented 11 months ago

Describe the bug A clear and concise description of what the bug is. image

To Reproduce Steps to reproduce the behavior:

  1. Run following command textattack ...
  2. Run following code ...
  3. See error

Expected behavior A clear and concise description of what you expected to happen. It ask us to input truncate_words_to Screenshots or Traceback If applicable, add screenshots to help explain your problem. Also, copy and paste tracebacks produced by the bug. image

System Information (please complete the following information):

Additional context Add any other context about the problem here.

qiyanjun commented 11 months ago

@jinyongyoo mind to take a look?

jinyongyoo commented 11 months ago

@ko120 @qiyanjun

Looks like the issue is with the truncate_words_to keyword argument which isn't part of GreedyWordSwapWIR. The argument was add in PR #747. @qiyanjun Could you share the background behind the PR and why that argument might have been added?

xcegin commented 5 months ago

I have come across the same issue yesterday, suprised to see this hanging here from November. Any updates?

qiyanjun commented 5 months ago

Sorry for the delay.. will take a careful look

PR #747 , added a max length constraint in

search_method = GreedyWordSwapWIR(wir_method="gradient")

    max_len = getattr(model_wrapper, "max_length", None) or min(
        1024, model_wrapper.tokenizer.model_max_length, model_wrapper.model.config.max_position_embeddings - 2
    )
    search_method = GreedyWordSwapWIR(wir_method="gradient", truncate_words_to=max_len)
xcegin commented 5 months ago

In the GreedyWordSwapWIR class from the PR here, I dont see any argument truncate_words argument in the __init__ method of the class. Maybe an oversight (I am no contributor though)?

qiyanjun commented 5 months ago

Please feel free to submit a PR to fix this..Sent from my iPhoneOn Apr 25, 2024, at 12:16, JanCe @.***> wrote: In the GreedyWordSwapWIR class from the PR here, I dont see any argument truncate_words argument in the init method of the class. Maybe an oversight (I am no contributor though)?

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