Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cannot have the model.py file after training my lstm model over sst2 datatset without adversarial training #807

Open
@SkyWarrior123

Description

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

To Reproduce
Steps to reproduce the behavior:

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

Expected behavior
There should be a module.py file generated after training lstm over sst2 dataset using the command below

textattack train --model lstm --dataset sst2 --epochs 20 --early-stopping-epochs 3

Screenshots or Traceback
While trying to attack my best_trained model using the command below

textattack attack --model-from-file ./outputs/2024-11-28-11-41-55-920215/best_model/model.py \
--dataset-from-huggingface sst2 \
--attack-recipe deepwordbug \
--log-to-txt results_deepwordbug.txt
textattack: Loading datasets dataset sst2, split train.
textattack: Loading model and tokenizer from file: ./outputs/2024-11-28-11-41-55-920215/best_model/model.py
textattack: Loading module from `./outputs/2024-11-28-11-41-55-920215/best_model/model.py`.
Traceback (most recent call last):
 File "/Users/skywarrior/Desktop/texattack/textattack-env-310/lib/python3.10/site-packages/textattack/model_args.py", line 192, in _create_model_from_args
 model_module = load_module_from_file(args.model_from_file)
 File "/Users/skywarrior/Desktop/texattack/textattack-env-310/lib/python3.10/site-packages/textattack/shared/utils/importing.py", line 63, in load_module_from_file
 spec.loader.exec_module(module)
 File "<frozen importlib._bootstrap_external>", line 879, in exec_module
 File "<frozen importlib._bootstrap_external>", line 1016, in get_code
 File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/Users/skywarrior/Desktop/texattack/./outputs/2024-11-28-11-41-55-920215/best_model/model.py'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "/Users/skywarrior/Desktop/texattack/textattack-env-310/bin/textattack", line 8, in <module>
 sys.exit(main())
 File "/Users/skywarrior/Desktop/texattack/textattack-env-310/lib/python3.10/site-packages/textattack/commands/textattack_cli.py", line 49, in main
 func.run(args)
 File "/Users/skywarrior/Desktop/texattack/textattack-env-310/lib/python3.10/site-packages/textattack/commands/attack_command.py", line 31, in run
 model_wrapper = ModelArgs._create_model_from_args(attack_args)
 File "/Users/skywarrior/Desktop/texattack/textattack-env-310/lib/python3.10/site-packages/textattack/model_args.py", line 194, in _create_model_from_args
 raise ValueError(f"Failed to import file {args.model_from_file}.")
ValueError: Failed to import file ./outputs/2024-11-28-11-41-55-920215/best_model/model.py.
  • The contents of the best_model ss
    image

System Information (please complete the following information):

  • OS: MacOs
  • Library versions (e.g. torch==1.7.0, transformers==3.3.0)
  • Textattack version

Additional context
I am trying to reproduce the textattack paper's adversarial training figure the image is attached below

image

Can someone please help me to reproduce the above figure I would be very grateful to learn and understand why it is or not reproducible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /