TextAttack icon indicating copy to clipboard operation
TextAttack copied to clipboard

a2t bug

Open ko120 opened this issue 2 years ago • 6 comments

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):

  • OS: [e.g. MacOS, Linux, Windows]
  • Library versions (e.g. torch==1.7.0, transformers==3.3.0)
  • Textattack version

Additional context Add any other context about the problem here.

ko120 avatar Oct 12 '23 02:10 ko120

@jinyongyoo mind to take a look?

qiyanjun avatar Nov 05 '23 02:11 qiyanjun

@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?

jinyongyoo avatar Nov 07 '23 09:11 jinyongyoo

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

xcegin avatar Apr 25 '24 12:04 xcegin

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)

qiyanjun avatar Apr 25 '24 15:04 qiyanjun

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)?

xcegin avatar Apr 25 '24 16:04 xcegin

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: @.***>

qiyanjun avatar Apr 25 '24 16:04 qiyanjun