hpcaitech / ColossalAI

Making large AI models cheaper, faster and more accessible
https://www.colossalai.org
Apache License 2.0
38.77k stars 4.34k forks source link

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

Closed pariskang closed 1 year ago

pariskang commented 1 year ago

🐛 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

MichelleMa8 commented 1 year ago

Sorry, we are fixing on it.

Camille7777 commented 1 year ago

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 commented 1 year ago

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

seungyeon-seo commented 1 year ago

I have same issue. my version is 2.0.0

beingPurple commented 1 year ago

Same issue, version is 2.02

EvergreenTree commented 1 year ago

https://github.com/Lightning-AI/lightning/pull/16708

Owen718 commented 1 year ago

Same issue! version is 2.0.3

mevanekanayake commented 1 year ago

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

Kalyanspunk commented 1 year ago

same issue

GKeppler commented 1 year ago

same issue wiht pl 2.0.8:

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

LightingMc commented 1 year ago

Same error on pl_version:

'2.0.2'

Alvov1 commented 7 months ago

Same here. Pl 2.2.1

HuangJiameng commented 5 months ago

I found this problem solved with pytorch_lightning==1.6.3

oscar066 commented 5 months ago

same error with the pytorch_lightining == 2.2.4

MasterHow commented 5 months ago

same with 2.1.0

soumickmj commented 3 months ago

Same issue 2.3.3

covix commented 1 month ago

According to the doc support for Trainer.add_argparse_args has been dropped. There are new ways of managing args now. Source: https://github.com/Lightning-AI/pytorch-lightning/issues/19905#issuecomment-2153201978

Bernice123 commented 1 month ago

same issue 2.4.0

HoseinHashemi commented 1 month ago

Same issue with pytorch-lightning 2.4.0