deepspeedai / deepspeedai/DeepSpeed

TypeError: DeepSpeedZeroOptimizer is not an Optimizer

Open
#6,992 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Hello, I encountered an issue while integrating DeepSpeed. My code is written as follows:
`deepspeed_config_path = './deepspeed.json'
args = parse_arguments()

self.model, self.optimizer, _, _ = deepspeed.initialize(
args=args,
model=self.model,
training_data=trainset, # 传递训练数据
config=deepspeed_config_path
)and the content of my JSON file is as follows:{
"train_batch_size": 4,
"gradient_accumulation_steps": 1,
"optimizer": {
"type": "AdamW",
"params": {
"lr": 5.0e-4,
"weight_decay": 1.0e-5
}
},
"_comment": "scheduler定义的是学习率调度器.",
"scheduler": {
"type": "CosineAnnealingLR",
"params": {
"T_max": 10,
"eta_min": 5e-6
}
},
"fp16": {
"enabled": true
},
"_comment2": "选择zero2策略.",
"zero_optimization": {
"stage": 2
},
"gradient_clipping": 1.0,
"wall_clock_breakdown": true
}
`
However, when I run it, an error occurs. Could you please advise me on how to resolve this issue?
Thank you very much for your help!!!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the deepspeed.initialize call and the supplied deepspeed.json, then inspect the complete traceback and how the returned optimizer is consumed. Determine whether the failure occurs during initialization or downstream type checking; done means a reproducible diagnosis and a verified configuration or integration fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.