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

NotImplementedError: Cannot copy out of meta tensor; no data! #75

Open
sjtuzhaoxh opened this issue Jul 13, 2023 · 1 comment
Open

NotImplementedError: Cannot copy out of meta tensor; no data! #75

sjtuzhaoxh opened this issue Jul 13, 2023 · 1 comment

Comments

@sjtuzhaoxh
Copy link

│ │
│ 403 │ │ │ │ device_map = infer_auto_device_map( │
│ 404 │ │ │ │ │ self, max_memory=max_memory, no_split_module_classes=no_split_module │
│ 405 │ │ │ │ ) │
│ ❱ 406 │ │ │ dispatch_model( │
│ 407 │ │ │ │ self, │
│ 408 │ │ │ │ device_map=device_map, │
│ 409 │ │ │ │ offload_dir=offload_dir, │
│ │
│ C:\Users\zhaoxianghui\AppData\Local\Programs\Python\Python310\lib\site-packages\accelerate\big_m │
│ odeling.py:355 in dispatch_model │
│ │
│ 352 │ │ and (not os.path.isdir(offload_dir) or not os.path.isfile(os.path.join(offload_d │
│ 353 │ ): │
│ 354 │ │ disk_state_dict = extract_submodules_state_dict(model.state_dict(), disk_modules │
│ ❱ 355 │ │ offload_state_dict(offload_dir, disk_state_dict) │
│ 356 │ │
│ 357 │ execution_device = { │
│ 358 │ │ name: main_device if device in ["cpu", "disk"] else device for name, device in d │
│ │
│ C:\Users\zhaoxianghui\AppData\Local\Programs\Python\Python310\lib\site-packages\accelerate\utils │
│ \offload.py:103 in offload_state_dict │
│ │
│ 100 │ os.makedirs(save_dir, exist_ok=True) │
│ 101 │ index = {} │
│ 102 │ for name, parameter in state_dict.items(): │
│ │
│ 34 │ │ # Need to reinterpret the underlined data as int16 since NumPy does not handle b │
│ 35 │ │ weight = weight.view(torch.int16) │
│ 36 │ │ dtype = "bfloat16" │
│ ❱ 37 │ array = weight.cpu().numpy() │
│ 38 │ tensor_file = os.path.join(offload_folder, f"{weight_name}.dat") │
│ 39 │ if index is not None: │
│ 40 │ │ if dtype is None: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
NotImplementedError: Cannot copy out of meta tensor; no data!

@sjtuzhaoxh
Copy link
Author

windows CPU python3.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant