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

Cannot copy out of meta tensor; no data! when half process #652

Open
Paxwell-Paxwell opened this issue Nov 18, 2024 · 0 comments
Open

Cannot copy out of meta tensor; no data! when half process #652

Paxwell-Paxwell opened this issue Nov 18, 2024 · 0 comments

Comments

@Paxwell-Paxwell
Copy link

Paxwell-Paxwell commented Nov 18, 2024

README.md: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 167/167 [00:00<00:00, 2.09MB/s]
Repo card metadata block was not found. Setting CardData to empty.
val.jsonl.zst: 100%|███████████████████████████████████████████████████████████████████████████████████████| 471M/471M [00:01<00:00, 241MB/s]
Generating validation split: 100%|█████████████████████████████████████████████████████████| 214670/214670 [00:07<00:00, 28813.68 examples/s]
AWQ: 0%| | 0/80 [00:00<?, ?it/s]
AWQ: 61%|████████████████████████████████████████████████████████████▋ | 49/80 [46:39<29:31, 57.14s/it]
Traceback (most recent call last):
File "/workspace/convert_awq.py", line 43, in
model.quantize(tokenizer, quant_config=quant_config)
File "/workspace/myenv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/awq/models/base.py", line 238, in quantize
self.quantizer.quantize()
File "/workspace/myenv/lib/python3.10/site-packages/awq/quantize/quantizer.py", line 159, in quantize
input_feat = self._get_input_feat(self.modules[i], named_linears)
File "/workspace/myenv/lib/python3.10/site-packages/awq/quantize/quantizer.py", line 633, in _get_input_feat
self.inps = self._module_forward(self.inps, layer, module_kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/awq/quantize/quantizer.py", line 247, in _module_forward
module_output = module(x, **module_kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/accelerate/hooks.py", line 165, in new_forward
args, kwargs = module._hf_hook.pre_forward(module, *args, **kwargs)
File "/workspace/myenv/lib/python3.10/site-packages/accelerate/hooks.py", line 364, in pre_forward
return send_to_device(args, self.execution_device), send_to_device(
File "/workspace/myenv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 175, in send_to_device
return honor_type(
File "/workspace/myenv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 82, in honor_type
return type(obj)(generator)
File "/workspace/myenv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 176, in
tensor, (send_to_device(t, device, non_blocking=non_blocking, skip_keys=skip_keys) for t in tensor)
File "/workspace/myenv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 156, in send_to_device
return tensor.to(device, non_blocking=non_blocking)
NotImplementedError: Cannot copy out of meta tensor; no data!

A100 80gb
ram 128

print("Loading model with offloading...")
model_init_kwargs = {"max_memory": {0: "70GIB", "cpu": "120GiB"}}
model = AutoAWQForCausalLM.from_pretrained(model_path ,
use_cache=False,
**model_init_kwargs)

tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)

quantization_config = AwqConfig(
bits=quant_config["w_bit"],
group_size=quant_config["q_group_size"],
zero_point=quant_config["zero_point"],
version=quant_config["version"].lower(),
)

config = AutoConfig.from_pretrained(model_path)
config.quantization_config = quantization_config

model.quantize(tokenizer, quant_config=quant_config)

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