Christina Theodoris commited on
Commit
aea4988
·
1 Parent(s): f17618a

clone rather than wrap tensors

Browse files
geneformer/collator_for_classification.py CHANGED
@@ -644,7 +644,8 @@ class DataCollatorForGeneClassification(DataCollatorForTokenClassification):
644
  def __call__(self, features):
645
  batch = self._prepare_batch(features)
646
 
647
- batch = {k: torch.tensor(v, dtype=torch.int64) for k, v in batch.items()}
 
648
  return batch
649
 
650
 
 
644
  def __call__(self, features):
645
  batch = self._prepare_batch(features)
646
 
647
+ # batch = {k: torch.tensor(v, dtype=torch.int64) for k, v in batch.items()}
648
+ batch = {k: torch.tensor(v.clone().detach(), dtype=torch.int64) if isinstance(v, torch.Tensor) else torch.tensor(v, dtype=torch.int64) for k, v in batch.items()}
649
  return batch
650
 
651