Skip to content

[BUG] AttributeError: 'FusedAdam' object has no attribute 'refresh_fp32_params' #7132

Open
@jinwx

Description

@jinwx

I loaded a pretrained checkpoint using the following code:

model_engine.load_checkpoint(
    checkpoint_dir,
    ckpt_id,
    load_optimizer_states=False,
    load_lr_scheduler_states=False,
    load_module_only=True
)

However, I encountered the following error:

...
  File "/opt/conda/envs/ptca/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 2815, in load_checkpoint
    load_path, client_states = self._load_checkpoint(load_dir,
  File "/opt/conda/envs/ptca/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 2909, in _load_checkpoint
    self.optimizer.refresh_fp32_params()
AttributeError: 'FusedAdam' object has no attribute 'refresh_fp32_params'

A few details about my setup:

  • I did not enable ZeRO or FP16.
  • This issue did not occur in DeepSpeed 0.9.

After checking the source code, I noticed a change that might be related to this issue. In this commit, the following code:

if self.optimizer is not None and self.fp16_enabled():
    self.optimizer.refresh_fp32_params()

was changed to:

if self.optimizer is not None:
    self.optimizer.refresh_fp32_params()

It seems that the FusedAdam optimizer does not have the method refresh_fp32_params().

ds_report output:

--------------------------------------------------
DeepSpeed C++/CUDA extension op report
--------------------------------------------------
NOTE: Ops not installed will be just-in-time (JIT) compiled at
      runtime if needed. Op compatibility means that your system
      meet the required dependencies to JIT install the op.
--------------------------------------------------
JIT compiled ops requires ninja
ninja .................. [OKAY]
--------------------------------------------------
op name ................ installed .. compatible
--------------------------------------------------
async_io ............... [NO] ....... [OKAY]
fused_adam ............. [NO] ....... [OKAY]
cpu_adam ............... [NO] ....... [OKAY]
cpu_adagrad ............ [NO] ....... [OKAY]
cpu_lion ............... [NO] ....... [OKAY]
 [WARNING]  Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH
evoformer_attn ......... [NO] ....... [NO]
fp_quantizer ........... [NO] ....... [OKAY]
fused_lamb ............. [NO] ....... [OKAY]
fused_lion ............. [NO] ....... [OKAY]
2025-03-11 17:02:35,003 root [INFO] - gcc -pthread -B /opt/conda/envs/ptca/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/envs/ptca/include -fPIC -O2 -isystem /opt/conda/envs/ptca/include -fPIC -c /tmp/tmp45k1f5pw/test.c -o /tmp/tmp45k1f5pw/test.o
2025-03-11 17:02:35,032 root [INFO] - gcc -pthread -B /opt/conda/envs/ptca/compiler_compat /tmp/tmp45k1f5pw/test.o -L/usr/local/cuda -L/usr/local/cuda/lib64 -lcufile -o /tmp/tmp45k1f5pw/a.out
/usr/bin/ld: /usr/local/cuda/lib64/libcufile.so: undefined reference to `dlvsym'
/usr/bin/ld: /usr/local/cuda/lib64/libcufile.so: undefined reference to `dlopen'
/usr/bin/ld: /usr/local/cuda/lib64/libcufile.so: undefined reference to `dlclose'
/usr/bin/ld: /usr/local/cuda/lib64/libcufile.so: undefined reference to `dlerror'
/usr/bin/ld: /usr/local/cuda/lib64/libcufile.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
gds .................... [NO] ....... [NO]
inference_core_ops ..... [NO] ....... [OKAY]
cutlass_ops ............ [NO] ....... [OKAY]
transformer_inference .. [NO] ....... [OKAY]
quantizer .............. [NO] ....... [OKAY]
ragged_device_ops ...... [NO] ....... [OKAY]
ragged_ops ............. [NO] ....... [OKAY]
random_ltd ............. [NO] ....... [OKAY]
 [WARNING]  sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.4
 [WARNING]  using untested triton version (3.0.0), only 1.0.0 is known to be compatible
sparse_attn ............ [NO] ....... [NO]
spatial_inference ...... [NO] ....... [OKAY]
transformer ............ [NO] ....... [OKAY]
stochastic_transformer . [NO] ....... [OKAY]
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/opt/conda/envs/ptca/lib/python3.10/site-packages/torch']
torch version .................... 2.4.1
deepspeed install path ........... ['/opt/conda/envs/ptca/lib/python3.10/site-packages/deepspeed']
deepspeed info ................... 0.15.1, unknown, unknown
torch cuda version ............... 12.4
torch hip version ................ None
nvcc version ..................... 12.4
deepspeed wheel compiled w. ...... torch 2.4, cuda 12.4
shared memory (/dev/shm) size .... 209.00 GB

System info:

  • OS: Ubuntu 20.04
  • GPU count and types: one machine with x2 A100
  • Python version: 3.10.15

Unfortunately it’s a bit difficult for me to provide a minimal reproducible script, but I hope the information above is sufficient. I think it might be an issue with how I’m using it, but I’m not quite familiar with DeepSpeed and maybe you can spot the problem. Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtraining

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions