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

Minor error on example distillation script #11441

Closed
2 of 3 tasks
jaimeenahn opened this issue Apr 26, 2021 · 0 comments
Closed
2 of 3 tasks

Minor error on example distillation script #11441

jaimeenahn opened this issue Apr 26, 2021 · 0 comments

Comments

@jaimeenahn
Copy link
Contributor

jaimeenahn commented Apr 26, 2021

Environment info

  • transformers version: 4.5.1
  • Platform: Linux-4.18.0-147.el8.x86_64-x86_64-with-Ubuntu-16.04-xenial
  • Python version: 3.7.10
  • PyTorch version (GPU?): 1.6.0 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Using GPU in script?: True
  • Using distributed or parallel set-up in script?: True

Who can help

I think @VictorSanh might help since it's about a minor bug in distillation.

Information

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

The problem arises when using:

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

examples/research_projects/distillation

The tasks I am working on is:

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

It's not GLUE/SQUaD but official BookCorpus and Wikipedia datasets from datasets

To reproduce

Steps to reproduce the behavior:

  1. Convert concatenation of bookcorpus and Wikipedia text from datasets to txt file.
  2. Separate it with \n
  3. Run scripts following A. Preparing the data
Traceback (most recent call last):
  File "train.py", line 322, in <module>
    main()
  File "train.py", line 223, in main
    init_gpu_params(args)
  File "/volume/compression_and_distillation/transformers/examples/distillation/utils.py", line 55, in init_gpu_params
    if params.n_gpu <= 0:
AttributeError: 'Namespace' object has no attribute 'n_gpu'
Traceback (most recent call last):
  File "train.py", line 322, in <module>
    main()
  File "train.py", line 223, in main
    init_gpu_params(args)
  File "/volume/compression_and_distillation/transformers/examples/distillation/utils.py", line 55, in init_gpu_params
    if params.n_gpu <= 0:
AttributeError: 'Namespace' object has no attribute 'n_gpu'
Traceback (most recent call last):
  File "train.py", line 322, in <module>
    main()
  File "train.py", line 223, in main
    init_gpu_params(args)
  File "/volume/compression_and_distillation/transformers/examples/distillation/utils.py", line 55, in init_gpu_params
    if params.n_gpu <= 0:
AttributeError: 'Namespace' object has no attribute 'n_gpu'
Traceback (most recent call last):
  File "train.py", line 322, in <module>
    main()
  File "train.py", line 223, in main
    init_gpu_params(args)
  File "/volume/compression_and_distillation/transformers/examples/distillation/utils.py", line 55, in init_gpu_params
    if params.n_gpu <= 0:
AttributeError: 'Namespace' object has no attribute 'n_gpu'
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/venv/distill/lib/python3.7/site-packages/torch/distributed/launch.py", line 261, in <module>
    main()
  File "/home/venv/distill/lib/python3.7/site-packages/torch/distributed/launch.py", line 257, in main
    cmd=cmd)

Expected behavior

The error comes because of the inconsistency of variable name as n_gpu in the trainer.py script but gpus in parsing.

It can easily be solved changing gpus when parsing to n_gpu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant