File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,13 @@ def teardown(self) -> None:
39
39
40
40
@staticmethod
41
41
@override
42
- def parse_devices (devices : Union [int , str , List [ int ] ]) -> int :
42
+ def parse_devices (devices : Union [int , str ]) -> int :
43
43
"""Accelerator device parsing logic."""
44
44
return _parse_cpu_cores (devices )
45
45
46
46
@staticmethod
47
47
@override
48
- def get_parallel_devices (devices : Union [int , str , List [ int ] ]) -> List [torch .device ]:
48
+ def get_parallel_devices (devices : Union [int , str ]) -> List [torch .device ]:
49
49
"""Gets parallel devices for the Accelerator."""
50
50
devices = _parse_cpu_cores (devices )
51
51
return [torch .device ("cpu" )] * devices
@@ -72,12 +72,12 @@ def register_accelerators(cls, accelerator_registry: _AcceleratorRegistry) -> No
72
72
)
73
73
74
74
75
- def _parse_cpu_cores (cpu_cores : Union [int , str , List [ int ] ]) -> int :
75
+ def _parse_cpu_cores (cpu_cores : Union [int , str ]) -> int :
76
76
"""Parses the cpu_cores given in the format as accepted by the ``devices`` argument in the
77
77
:class:`~lightning.pytorch.trainer.trainer.Trainer`.
78
78
79
79
Args:
80
- cpu_cores: An int > 0.
80
+ cpu_cores: An int > 0 or a string that can be converted to an int > 0 .
81
81
82
82
Returns:
83
83
An int representing the number of processes
Original file line number Diff line number Diff line change @@ -48,13 +48,13 @@ def teardown(self) -> None:
48
48
49
49
@staticmethod
50
50
@override
51
- def parse_devices (devices : Union [int , str , List [ int ] ]) -> int :
51
+ def parse_devices (devices : Union [int , str ]) -> int :
52
52
"""Accelerator device parsing logic."""
53
53
return _parse_cpu_cores (devices )
54
54
55
55
@staticmethod
56
56
@override
57
- def get_parallel_devices (devices : Union [int , str , List [ int ] ]) -> List [torch .device ]:
57
+ def get_parallel_devices (devices : Union [int , str ]) -> List [torch .device ]:
58
58
"""Gets parallel devices for the Accelerator."""
59
59
devices = _parse_cpu_cores (devices )
60
60
return [torch .device ("cpu" )] * devices
You can’t perform that action at this time.
0 commit comments