Skip to content

Commit 6b6e6e2

Browse files
authored
fix: trn1 instance family does not support volume size (#4828)
* fix: trn1 instance family does not support volume size * chore: cleanup code
1 parent 7b1a7ad commit 6b6e6e2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/sagemaker/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,11 +1457,11 @@ def volume_size_supported(instance_type: str) -> bool:
14571457
# Any instance type with a "d" in the instance family (i.e. c5d, p4d, etc)
14581458
# + g5 or g6 or p5 does not support attaching an EBS volume.
14591459
family = parts[0]
1460-
return (
1461-
"d" not in family
1462-
and not family.startswith("g5")
1463-
and not family.startswith("g6")
1464-
and not family.startswith("p5")
1460+
1461+
unsupported_families = ["g5", "g6", "p5", "trn1"]
1462+
1463+
return "d" not in family and not any(
1464+
family.startswith(prefix) for prefix in unsupported_families
14651465
)
14661466
except Exception as e:
14671467
raise ValueError(f"Failed to parse instance type '{instance_type}': {str(e)}")

tests/unit/test_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,8 @@ def test_volume_size_not_supported(self):
18151815
"local",
18161816
"local_gpu",
18171817
ParameterString(name="InstanceType", default_value="ml.m4.xlarge"),
1818+
"ml.trn1.32xlarge",
1819+
"ml.trn1n.32xlarge",
18181820
]
18191821

18201822
for instance in instances_that_dont_support_volume_size:

0 commit comments

Comments
 (0)