Skip to content

Instantly share code, notes, and snippets.

@hackyon
Created February 7, 2024 20:50
Show Gist options
  • Save hackyon/cd251c705aadb2bc77ffffcf0233c0ce to your computer and use it in GitHub Desktop.
Save hackyon/cd251c705aadb2bc77ffffcf0233c0ce to your computer and use it in GitHub Desktop.
Error test_eager_matches_sdpa_generate
with tempfile.TemporaryDirectory() as tmpdirname:
model.save_pretrained(tmpdirname)
dummy_attention_mask = inputs_dict.get("attention_mask", torch.ones_like(dummy_input))
model_sdpa = model_class.from_pretrained(
tmpdirname,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
> ).to(torch_device)
tests/test_modeling_common.py:3676:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/transformers/modeling_utils.py:2556: in to
return super().to(*args, **kwargs)
../../.local/lib/python3.11/site-packages/torch/nn/modules/module.py:1160: in to
return self._apply(convert)
../../.local/lib/python3.11/site-packages/torch/nn/modules/module.py:810: in _apply
module._apply(fn)
../../.local/lib/python3.11/site-packages/torch/nn/modules/module.py:810: in _apply
module._apply(fn)
../../.local/lib/python3.11/site-packages/torch/nn/modules/module.py:810: in _apply
module._apply(fn)
../../.local/lib/python3.11/site-packages/torch/nn/modules/module.py:833: in _apply
param_applied = fn(param)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
t = Parameter containing:
tensor(..., device='meta', size=(99,), dtype=torch.float16, requires_grad=True)
def convert(t):
if convert_to_format is not None and t.dim() in (4, 5):
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None,
non_blocking, memory_format=convert_to_format)
> return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
E NotImplementedError: Cannot copy out of meta tensor; no data!
../../.local/lib/python3.11/site-packages/torch/nn/modules/module.py:1158: NotImplementedError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment