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

#17
by wxiaoke - opened

load model:NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty() instead of torch.nn.Module.to() when moving module from meta to a different device.

model = AutoModel.from_pretrained(
'jinaai/jina-reranker-m0',
torch_dtype="auto",
trust_remote_code=True,
attn_implementation="flash_attention_2"
)

model.to('cuda')# or 'cpu' if no GPU is available
model.eval()

I also find this problem when processing "model.to('cuda')". T_T

Same here.

Sign up or log in to comment