-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: add pytorch 1.8.1 for huggingface #2639
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,12 @@ | |
import logging | ||
import os | ||
import re | ||
import pdb | ||
|
||
from sagemaker import utils | ||
from sagemaker.spark import defaults | ||
from sagemaker.spark import defaults | ||
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. Got added twice? |
||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -39,7 +42,10 @@ def retrieve( | |
distribution=None, | ||
base_framework_version=None, | ||
): | ||
|
||
"""Retrieves the ECR URI for the Docker image matching the given arguments. | ||
Ideally this function should not be called directly, rather it should be called from the | ||
fit() function inside framework estimator. | ||
|
||
Args: | ||
framework (str): The name of the framework or algorithm. | ||
|
@@ -56,7 +62,11 @@ def retrieve( | |
image_scope (str): The image type, i.e. what it is used for. | ||
Valid values: "training", "inference", "eia". If ``accelerator_type`` is set, | ||
``image_scope`` is ignored. | ||
container_version (str): the version of docker image | ||
container_version (str): the version of docker image. | ||
Ideally the value of parameter is should be created inside the framework. | ||
For custom use, see the list of supported container versions: | ||
https://github.com/aws/deep-learning-containers/blob/master/available_images.md | ||
(default: None). | ||
distribution (dict): A dictionary with information on how to run distributed training | ||
(default: None). | ||
|
||
|
@@ -66,10 +76,12 @@ def retrieve( | |
Raises: | ||
ValueError: If the combination of arguments specified is not supported. | ||
""" | ||
|
||
config = _config_for_framework_and_scope(framework, image_scope, accelerator_type) | ||
original_version = version | ||
version = _validate_version_and_set_if_needed(version, config, framework) | ||
version_config = config["versions"][_version_for_config(version, config)] | ||
|
||
if framework == HUGGING_FACE_FRAMEWORK: | ||
if version_config.get("version_aliases"): | ||
full_base_framework_version = version_config["version_aliases"].get( | ||
|
@@ -79,9 +91,12 @@ def retrieve( | |
_validate_arg(full_base_framework_version, list(version_config.keys()), "base framework") | ||
version_config = version_config.get(full_base_framework_version) | ||
|
||
|
||
py_version = _validate_py_version_and_set_if_needed(py_version, version_config, framework) | ||
version_config = version_config.get(py_version) or version_config | ||
|
||
|
||
|
||
registry = _registry_from_region(region, version_config["registries"]) | ||
hostname = utils._botocore_resolver().construct_endpoint("ecr", region)["hostname"] | ||
|
||
|
@@ -90,12 +105,16 @@ def retrieve( | |
processor = _processor( | ||
instance_type, config.get("processors") or version_config.get("processors") | ||
) | ||
#if container version is available in .json file, utilize that | ||
if "container_version" in version_config.keys(): | ||
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. can we use |
||
container_version = version_config['container_version'][processor] | ||
|
||
if framework == HUGGING_FACE_FRAMEWORK: | ||
pt_or_tf_version = ( | ||
re.compile("^(pytorch|tensorflow)(.*)$").match(base_framework_version).group(2) | ||
) | ||
tag_prefix = f"{pt_or_tf_version}-transformers{original_version}" | ||
|
||
else: | ||
tag_prefix = version_config.get("tag_prefix", version) | ||
|
||
|
@@ -105,6 +124,8 @@ def retrieve( | |
py_version, | ||
container_version, | ||
) | ||
|
||
|
||
if _should_auto_select_container_version(instance_type, distribution): | ||
container_versions = { | ||
"tensorflow-2.3-gpu-py37": "cu110-ubuntu18.04-v3", | ||
|
@@ -119,8 +140,12 @@ def retrieve( | |
"pytorch-1.6.0-gpu-py36": "cu110-ubuntu18.04", | ||
"pytorch-1.6-gpu-py3": "cu110-ubuntu18.04-v3", | ||
"pytorch-1.6.0-gpu-py3": "cu110-ubuntu18.04", | ||
"pytorch-1.8.1-gpu-py3": "cu111-ubuntu18.04" | ||
} | ||
|
||
|
||
key = "-".join([framework, tag]) | ||
|
||
if key in container_versions: | ||
tag = "-".join([tag, container_versions[key]]) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can be removed.