You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experiencing an issue when trying to use the AttackArgs class from the TextAttack library outside of the command line. I'm attempting to use the class programmatically in my Python script, but the arguments I provide are not correctly assigned.
When I run the code, the num_examples values are not updated and remain at their default values. However, it seems that other arguments like num_successful_examples or log_to_csv are being correctly assigned.
I suspect this might be related to the class implementation, specifically the _add_parser_args method, which seems to be designed for command-line usage. Is there a way to use the AttackArgs class programmatically in a Python script without relying on the command line interface? Any guidance or suggestions would be appreciated.
Thank you for your assistance.
System Information:
OS: MacOS Ventura 13.1
Textattack version: 0.3.8
The text was updated successfully, but these errors were encountered:
I discovered that the issue with num_examples being set to None is due to the following code snippet in the AttackArgs class:
def post_init(self):
if self.num_successful_examples:
self.num_examples = None
This is causing num_examples to be set to None when a value is assigned to num_successful_examples.
I would like to understand if this behavior is intentional and, if so, the rationale behind it. Is it to prevent users from specifying both num_examples and num_successful_examples simultaneously? If this is a design choice, could you please provide guidance on how to use these options properly in cases where we want to limit the total number of examples while also specifying the number of successful adversarial examples desired? If this is a bug, can you suggest a workaround or provide an update to fix the issue?
Hello,
I am experiencing an issue when trying to use the AttackArgs class from the TextAttack library outside of the command line. I'm attempting to use the class programmatically in my Python script, but the arguments I provide are not correctly assigned.
Here's a code snippet demonstrating my problem:
When I run the code, the num_examples values are not updated and remain at their default values. However, it seems that other arguments like num_successful_examples or log_to_csv are being correctly assigned.
I suspect this might be related to the class implementation, specifically the _add_parser_args method, which seems to be designed for command-line usage. Is there a way to use the AttackArgs class programmatically in a Python script without relying on the command line interface? Any guidance or suggestions would be appreciated.
Thank you for your assistance.
System Information:
The text was updated successfully, but these errors were encountered: