aiqm / torchani

Accurate Neural Network Potential on PyTorch
https://aiqm.github.io/torchani/
MIT License
461 stars 127 forks source link

cuaev tests fail with pytorch nightly #618

Closed rschireman closed 2 years ago

rschireman commented 2 years ago

Running python3 tests/test_cuaev.py fails when using pytorch nightly with the error:

TypeError: make_tensor() missing 2 required keyword-only arguments: 'dtype' and 'device'

This is due to the stable pytorch (1.11.0) defining the make_tensor function as:

def make_tensor( shape: Union[torch.Size, List[int], Tuple[int, ...]], device: Union[str, torch.device], dtype: torch.dtype, *, low: Optional[float] = None, high: Optional[float] = None, requires_grad: bool = False, noncontiguous: bool = False, exclude_zero: bool = False ) -> torch.Tensor:

while the nightly pytorch build switches the position of the device and dtype parameters:

def make_tensor( *shape: Union[int, torch.Size, List[int], Tuple[int, ...]], dtype: torch.dtype, device: Union[str, torch.device], low: Optional[float] = None, high: Optional[float] = None, requires_grad: bool = False, noncontiguous: bool = False, exclude_zero: bool = False ) -> torch.Tensor: