-
Notifications
You must be signed in to change notification settings - Fork 21
Could not load random states #9
Copy link
Copy link
Open
Description
I've tried to run your checkpoints for inference. But when I ran the command accelerate launch --num_processes=1 --gpu_ids 0 --main_process_port 46529 run.py -C baseline_m.toml -M test --ckpt_path best, I got the following error:
Using device: 0
08-19 20:14:05: Begin testing...
08-19 20:14:05: Loading states from /root/faithjiang/projects/spiking-fullsubnet/recipes/intel_ndns/spike_fsb/exp/baseline_s/checkpoints/best
/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/checkpointing.py:212: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state_dict = torch.load(input_model_file, map_location=map_location)
08-19 20:14:05: All model weights loaded successfully
/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/checkpointing.py:220: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
optimizer_state = torch.load(input_optimizer_file, map_location=map_location)
08-19 20:14:05: All optimizer states loaded successfully
/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/checkpointing.py:228: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
scheduler.load_state_dict(torch.load(input_scheduler_file))
08-19 20:14:05: All scheduler states loaded successfully
08-19 20:14:05: All dataloader sampler states loaded successfully
/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/checkpointing.py:251: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
states = torch.load(input_dir.joinpath(f"{RNG_STATE_NAME}_{process_index}.pkl"))
08-19 20:14:05: Could not load random states
Traceback (most recent call last):
File "/root/faithjiang/projects/spiking-fullsubnet/recipes/intel_ndns/spike_fsb/run.py", line 187, in <module>
run(config, args.resume)
File "/root/faithjiang/projects/spiking-fullsubnet/recipes/intel_ndns/spike_fsb/run.py", line 133, in run
trainer.test(test_dataloaders, config["meta"]["ckpt_path"])
File "/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/root/faithjiang/projects/spiking-fullsubnet/audiozen/trainer/base_trainer_gan_accelerate_ddp_validate.py", line 393, in test
self._load_checkpoint(ckpt_path)
File "/root/faithjiang/projects/spiking-fullsubnet/audiozen/trainer/base_trainer_gan_accelerate_ddp_validate.py", line 173, in _load_checkpoint
self.accelerator.load_state(ckpt_path)
File "/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/accelerator.py", line 3156, in load_state
self.step = override_attributes["step"]
KeyError: 'step'
Traceback (most recent call last):
File "/root/miniconda3/envs/spiking-fullsubnet/bin/accelerate", line 10, in <module>
sys.exit(main())
File "/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main
args.func(args)
File "/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1106, in launch_command
simple_launcher(args)
File "/root/miniconda3/envs/spiking-fullsubnet/lib/python3.10/site-packages/accelerate/commands/launch.py", line 704, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/root/miniconda3/envs/spiking-fullsubnet/bin/python3.10', 'run.py', '-C', 'baseline_s.toml', '-M', 'test', '--ckpt_path', 'best']' returned non-zero exit status 1.
Could you please help me figure this out? Thank you for any help you can provide.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels