Skip to content

RuntimeError: unsupported operation: some elements of the input tensor and the written-to tensor refer to a single memory location. Please clone() the tensor before performing the operation. #22

@collabgear

Description

@collabgear

Hello,

When starting the train_gencad.py as mentioned in the README, I am getting the subject error.
Below is the full cli with stack trace:

GenCAD/GenCAD$ python train_gencad.py csr -name test -gpu 0

/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/model/cond_ldm.py:368: FutureWarning: torch.cuda.amp.autocast(args...) is deprecated. Please use torch.amp.autocast('cuda', args...) instead.
@autocast(enabled = False)

[INFO] GPU: 0

Total trainable params: 6.72 million

EPOCH[1/10]: 38%|
| 28955/76265 [13:45<24:56, 31.61it/s, loss_cmd=1.42, loss_args=5.49]Traceback (most recent call last):
File "/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/train_gencad.py", line 187, in
train_model(args.model, args)
File "/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/train_gencad.py", line 57, in train_model
ae_trainer.train(train_loader=train_loader, val_loader=val_loader, val_loader_all=val_loader_all, ckpt=args.ckpt_path)
File "/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/trainer/autoencoder_trainer.py", line 188, in train
outputs, loss_dict = self.validate_one_step(val_data)
File "/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/trainer/autoencoder_trainer.py", line 86, in validate_one_step
loss_dict = self.loss_fn(outputs)
File "/home/collabgear/miniconda3/envs/gencad_env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/collabgear/miniconda3/envs/gencad_env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
return forward_call(*args, **kwargs)
File "/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/utils/loss.py", line 26, in forward
padding_mask = get_padding_mask(tgt_commands, seq_dim=-1, extended=True) * visibility_mask.unsqueeze(-1)
File "/media/collabgear/SSD-M2-1TB/PycharmProjects/GenCAD/GenCAD/utils/model_utils.py", line 44, in get_padding_mask
torch.narrow(padding_mask, seq_dim, 3, S-3).add
(torch.narrow(padding_mask, seq_dim, 0, S-3)).clamp
(max=1)
RuntimeError: unsupported operation: some elements of the input tensor and the written-to tensor refer to a single memory location. Please clone() the tensor before performing the operation.

I had to use Pytorch of the version 2.71 as the most recent one does not support my GPU ( due to CUDA support ).
Could it be related?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions