Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_glue.py script error on stsb task #444

Closed
2 of 4 tasks
Leonezz opened this issue Oct 28, 2022 · 0 comments · Fixed by #454
Closed
2 of 4 tasks

run_glue.py script error on stsb task #444

Leonezz opened this issue Oct 28, 2022 · 0 comments · Fixed by #454
Labels
bug Something isn't working

Comments

@Leonezz
Copy link

Leonezz commented Oct 28, 2022

Environment info

  • adapter-transformers version:
  • Platform:
  • Python version:
  • PyTorch version (GPU?):
  • Tensorflow version (GPU?):
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Information

Model I am using (Bert, XLNet ...): BERT

Language I am using the model on (English, Chinese ...): Chinese

Adapter setup I am using (if any): pfeiffer

The problem arises when using:

  • the official example scripts: (give details below)
  • my own modified scripts: (give details below)

I am using the official run_glue.py script on stsb task, and the error occurs:

Traceback (most recent call last):
  File "/root/adapter-transformers/examples/pytorch/text-classification/run_glue.py", line 642, in <module>
    main()
  File "/root/adapter-transformers/examples/pytorch/text-classification/run_glue.py", line 360, in main
    id2label={i: v for i, v in enumerate(label_list)} if num_labels > 0 else None,
UnboundLocalError: local variable 'label_list' referenced before assignment

I think it may be because that the add_classification_head requires id2label for all glue tasks but there is not one for stsb task. So I change the num_labels > 0 to num_labels > 1 on the run_glue.py line 360 and it works for me.

The tasks I am working on is:

  • an official GLUE/SQUaD task: (give the name)
  • my own task or dataset: (give details below)

To reproduce

Steps to reproduce the behavior:

Expected behavior

@Leonezz Leonezz added the bug Something isn't working label Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant