Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.3k
breaking: require framework_version, py_version for sklearn#1576
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
Merged
metrizable
merged 1 commit into
aws:zwei
from
metrizable:require-framework-version-sklearnJun 11, 2020
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
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 |
|---|---|---|
| @@ -18,8 +18,8 @@ | ||
| from sagemaker import fw_utils | ||
| import sagemaker | ||
| from sagemaker.fw_utils import model_code_key_prefix, python_deprecation_warning | ||
| from sagemaker.fw_registry import default_framework_uri | ||
| from sagemaker.fw_utils import model_code_key_prefix, validate_version_or_image_args | ||
| from sagemaker.model import FrameworkModel, MODEL_SERVER_WORKERS_PARAM_NAME | ||
| from sagemaker.predictor import RealTimePredictor, npy_serializer, numpy_deserializer | ||
| from sagemaker.sklearn import defaults | ||
| @@ -62,9 +62,9 @@ def __init__( | ||
| model_data, | ||
| role, | ||
| entry_point, | ||
| image=None, | ||
| framework_version=None, | ||
metrizable marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| py_version="py3", | ||
| framework_version=defaults.SKLEARN_VERSION, | ||
| image=None, | ||
| predictor_cls=SKLearnPredictor, | ||
| model_server_workers=None, | ||
| **kwargs | ||
| @@ -83,12 +83,19 @@ def __init__( | ||
| file which should be executed as the entry point to model | ||
| hosting. If ``source_dir`` is specified, then ``entry_point`` | ||
| must point to a file located at the root of ``source_dir``. | ||
| framework_version (str): Scikit-learn version you want to use for | ||
| executing your model training code. Defaults to ``None``. Required | ||
| unless ``image`` is provided. | ||
| py_version (str): Python version you want to use for executing your | ||
| model training code (default: 'py3'). Currently, 'py3' is the only | ||
| supported version. If ``None`` is passed in, ``image`` must be | ||
| provided. | ||
| image (str): A Docker image URI (default: None). If not specified, a | ||
| default image for Scikit-learn will be used. | ||
| py_version (str): Python version you want to use for executing your | ||
| model training code (default: 'py3'). | ||
| framework_version (str): Scikit-learn version you want to use for | ||
| executing your model training code. | ||
| If ``framework_version`` or ``py_version`` are ``None``, then | ||
| ``image`` is required. If also ``None``, then a ``ValueError`` | ||
| will be raised. | ||
| predictor_cls (callable[str, sagemaker.session.Session]): A function | ||
| to call to create a predictor with an endpoint name and | ||
| SageMaker ``Session``. If specified, ``deploy()`` returns the | ||
| @@ -105,17 +112,18 @@ def __init__( | ||
| :class:`~sagemaker.model.FrameworkModel` and | ||
| :class:`~sagemaker.model.Model`. | ||
| """ | ||
| validate_version_or_image_args(framework_version, py_version, image) | ||
| if py_version and py_version != "py3": | ||
| raise AttributeError( | ||
| "Scikit-learn image only supports Python 3. Please use 'py3' for py_version." | ||
| ) | ||
| self.framework_version = framework_version | ||
| self.py_version = py_version | ||
| super(SKLearnModel, self).__init__( | ||
| model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs | ||
| ) | ||
| if py_version == "py2": | ||
| logger.warning( | ||
| python_deprecation_warning(self.__framework_name__, defaults.LATEST_PY2_VERSION) | ||
| ) | ||
| self.py_version = py_version | ||
| self.framework_version = framework_version | ||
| self.model_server_workers = model_server_workers | ||
| def prepare_container_def(self, instance_type, accelerator_type=None): | ||
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.