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

[BUG]: AttributeError: type object 'Trainer' has no attribute 'add_argparse_args' #2938

Closed
pariskang opened this issue Feb 28, 2023 · 19 comments · Fixed by #3073
Closed

[BUG]: AttributeError: type object 'Trainer' has no attribute 'add_argparse_args' #2938

pariskang opened this issue Feb 28, 2023 · 19 comments · Fixed by #3073
Assignees
Labels
bug Something isn't working

Comments

@pariskang
Copy link

🐛 Describe the bug

Description:

When I running the command "python main.py --logdir /tmp/ -t -b configs/Teyvat/train_colossalai_teyvat.yaml" to rekoad the diffusion model, I encountered the following error:

AttributeError: type object 'Trainer' has no attribute 'add_argparse_args'
Steps to Reproduce:

Clone the repository.
Run the command "python main.py --logdir /tmp/ -t -b configs/Teyvat/train_colossalai_teyvat.yaml".
Expected Behavior:

The command should run without any errors.

Actual Behavior:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /root/ColossalAI/examples/images/diffusion/main.py:535 in │
│ │
│ 532 │ sys.path.append(os.getcwd()) │
│ 533 │ │
│ 534 │ parser = get_parser() │
│ ❱ 535 │ parser = Trainer.add_argparse_args(parser) │
│ 536 │ │
│ 537 │ opt, unknown = parser.parse_known_args() │
│ 538 │ if opt.name and opt.resume: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: type object 'Trainer' has no attribute 'add_argparse_args'

Additional Context:

The error message suggests that there is a problem with the "Trainer" object and its "add_argparse_args" attribute. Can u help me to resolve it. Thank u.

Environment

No response

@pariskang pariskang added the bug Something isn't working label Feb 28, 2023
@MichelleMa8
Copy link
Contributor

Sorry, we are fixing on it.

@Camille7777
Copy link
Contributor

Camille7777 commented Mar 9, 2023

Hello, could I know your version of lightning in your environment?

I had the same "AttributeError: type object 'Trainer' has no attribute 'add_argparse_args'" error with the lastest version of lightning==2.0.0rc1 (Release on Mar 2, 2023), but I tried with lightning==1.9.0 which is the same as https://github.com/hpcaitech/ColossalAI/blob/main/examples/images/diffusion/requirements.txt, the above bug disappeared.

@allanchan339
Copy link

Hi, same issue here, using stable version of pytorch lighnining=2.0, just installed from conda

@seungyeon-seo
Copy link

I have same issue. my version is 2.0.0

@beingPurple
Copy link

Same issue, version is 2.02

@EvergreenTree
Copy link

Lightning-AI/pytorch-lightning#16708

@Owen718
Copy link

Owen718 commented Jun 28, 2023

Same issue! version is 2.0.3

@mevanekanayake
Copy link

I installed pip install pytorch-lightning==1.06 and it WORKED!!

@Kalyanspunk
Copy link

same issue

@GKeppler
Copy link

GKeppler commented Sep 5, 2023

same issue wiht pl 2.0.8:

AttributeError: type object 'Trainer' has no attribute 'from_argparse_args'

@LightingMc
Copy link

Same error on pl_version:

'2.0.2'

@Alvov1
Copy link

Alvov1 commented Apr 3, 2024

Same here. Pl 2.2.1

@HuangJiameng
Copy link

I found this problem solved with pytorch_lightning==1.6.3

@oscar066
Copy link

same error with the pytorch_lightining == 2.2.4

@MasterHow
Copy link

same with 2.1.0

@soumickmj
Copy link

Same issue 2.3.3

@covix
Copy link

covix commented Sep 10, 2024

According to the doc support for Trainer.add_argparse_args has been dropped. There are new ways of managing args now.
Source: Lightning-AI/pytorch-lightning#19905 (comment)

@Bernice123
Copy link

same issue 2.4.0

@HoseinHashemi
Copy link

Same issue with pytorch-lightning 2.4.0

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