-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feature: Add PyTorch 1.13.1 to SDK #3587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f34555b
d4cdf64
67eb6b2
bf203e3
238f1b8
9b25f3f
1a6ad3c
4189054
d598c07
9109fa1
ac5471f
8cb53db
a6ad8ba
42d8b6f
53e1a83
32f37d1
d3a7822
3968264
44e0f18
3099993
5f1d22a
62dce63
dcef8d4
b0cbaf0
64bb0e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,8 @@ | |
"huggingface_training_compiler", | ||
) | ||
|
||
PYTORCH_RENEWED_GPU = "ml.g4dn.xlarge" | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--sagemaker-client-config", action="store", default=None) | ||
|
@@ -221,22 +223,26 @@ def mxnet_eia_latest_py_version(): | |
|
||
@pytest.fixture(scope="module", params=["py2", "py3"]) | ||
def pytorch_training_py_version(pytorch_training_version, request): | ||
if Version(pytorch_training_version) < Version("1.5.0"): | ||
return request.param | ||
if Version(pytorch_training_version) >= Version("1.13"): | ||
return "py39" | ||
elif Version(pytorch_training_version) >= Version("1.9"): | ||
return "py38" | ||
else: | ||
elif Version(pytorch_training_version) >= Version("1.5.0"): | ||
return "py3" | ||
else: | ||
return request.param | ||
|
||
|
||
@pytest.fixture(scope="module", params=["py2", "py3"]) | ||
def pytorch_inference_py_version(pytorch_inference_version, request): | ||
if Version(pytorch_inference_version) < Version("1.4.0"): | ||
return request.param | ||
if Version(pytorch_inference_version) >= Version("1.13"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same applies to this function pytorch_inference_py_version as above: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be 1.4.0 for inference. 1.5.0 for training. otherwise the new logic is fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for catching this! |
||
return "py39" | ||
elif Version(pytorch_inference_version) >= Version("1.9"): | ||
return "py38" | ||
else: | ||
elif Version(pytorch_inference_version) >= Version("1.4.0"): | ||
return "py3" | ||
else: | ||
return request.param | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
|
@@ -252,9 +258,13 @@ def huggingface_pytorch_training_py_version(huggingface_pytorch_training_version | |
|
||
|
||
@pytest.fixture(scope="module") | ||
def huggingface_training_compiler_pytorch_version(huggingface_training_compiler_version): | ||
def huggingface_training_compiler_pytorch_version( | ||
huggingface_training_compiler_version, | ||
): | ||
versions = _huggingface_base_fm_version( | ||
huggingface_training_compiler_version, "pytorch", "huggingface_training_compiler" | ||
huggingface_training_compiler_version, | ||
"pytorch", | ||
"huggingface_training_compiler", | ||
) | ||
if not versions: | ||
pytest.skip( | ||
|
@@ -265,9 +275,13 @@ def huggingface_training_compiler_pytorch_version(huggingface_training_compiler_ | |
|
||
|
||
@pytest.fixture(scope="module") | ||
def huggingface_training_compiler_tensorflow_version(huggingface_training_compiler_version): | ||
def huggingface_training_compiler_tensorflow_version( | ||
huggingface_training_compiler_version, | ||
): | ||
versions = _huggingface_base_fm_version( | ||
huggingface_training_compiler_version, "tensorflow", "huggingface_training_compiler" | ||
huggingface_training_compiler_version, | ||
"tensorflow", | ||
"huggingface_training_compiler", | ||
) | ||
if not versions: | ||
pytest.skip( | ||
|
@@ -289,19 +303,25 @@ def huggingface_training_compiler_tensorflow_py_version( | |
|
||
|
||
@pytest.fixture(scope="module") | ||
def huggingface_training_compiler_pytorch_py_version(huggingface_training_compiler_pytorch_version): | ||
def huggingface_training_compiler_pytorch_py_version( | ||
huggingface_training_compiler_pytorch_version, | ||
): | ||
return "py38" | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def huggingface_pytorch_latest_training_py_version(huggingface_training_pytorch_latest_version): | ||
def huggingface_pytorch_latest_training_py_version( | ||
huggingface_training_pytorch_latest_version, | ||
): | ||
return ( | ||
"py38" if Version(huggingface_training_pytorch_latest_version) >= Version("1.9") else "py36" | ||
) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def huggingface_pytorch_latest_inference_py_version(huggingface_inference_pytorch_latest_version): | ||
def huggingface_pytorch_latest_inference_py_version( | ||
huggingface_inference_pytorch_latest_version, | ||
): | ||
return ( | ||
"py38" | ||
if Version(huggingface_inference_pytorch_latest_version) >= Version("1.9") | ||
|
@@ -477,7 +497,8 @@ def pytorch_ddp_py_version(): | |
|
||
|
||
@pytest.fixture( | ||
scope="module", params=["1.10", "1.10.0", "1.10.2", "1.11", "1.11.0", "1.12", "1.12.0"] | ||
scope="module", | ||
params=["1.10", "1.10.0", "1.10.2", "1.11", "1.11.0", "1.12", "1.12.0"], | ||
) | ||
def pytorch_ddp_framework_version(request): | ||
return request.param | ||
|
@@ -511,6 +532,23 @@ def gpu_instance_type(sagemaker_session, request): | |
return "ml.p3.2xlarge" | ||
|
||
|
||
@pytest.fixture() | ||
def gpu_pytorch_instance_type(sagemaker_session, request): | ||
if "pytorch_inference_version" in request.fixturenames: | ||
fw_version = request.getfixturevalue("pytorch_inference_version") | ||
else: | ||
fw_version = request.param | ||
|
||
region = sagemaker_session.boto_session.region_name | ||
if region in NO_P3_REGIONS: | ||
if Version(fw_version) >= Version("1.13"): | ||
return PYTORCH_RENEWED_GPU | ||
else: | ||
return "ml.p2.xlarge" | ||
else: | ||
return "ml.p3.2xlarge" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def gpu_instance_type_list(sagemaker_session, request): | ||
region = sagemaker_session.boto_session.region_name | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a significant change in default behavior of this function pytorch_training_py_version.
if Version(pytorch_training_version) >= Version("1.13"):
return "py39"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't. the difference is smoother logic processing with the same results as before, with the addition of py39 for 1.13 and above. the other logic was in reverse where it looked at lower versions before newer versions. this process has less logic hits as newer versions are used more than older. Anything under 1.5.0 still has request.param, between 1.9 and 1.5.0 uses py3 above 1.9 uses py38, same as old. the inclusion is 1.13 which is py39. this is valid and tested. Also, this is training and the code is also training's code which is used with inference as well.
Did notice it should be 1.5.0 and not just 1.5.. fixing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I agree that this is a refactoring and doesn't change the code meaning. And sorry about the wrong lower version. The Version("1.5") and Version("1.5.0") have the same effect though.