Skip to content

Improved documentation and tests about input and output functions #17

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
merged 11 commits into from
Dec 18, 2017

Conversation

mvsusp
Copy link
Contributor

@mvsusp mvsusp commented Dec 11, 2017

No description provided.

README.rst Outdated
@@ -1377,7 +1377,7 @@ An example of ``output_fn`` for the accept type "application/python-pickle" can

import numpy as np

def output_fn(data, accepts):
def output_fn(prediction_result, accepts):
"""An output_fn that dumps a pickled numpy as response"""
if request_content_type == "application/python-pickle":
return np.dumps(data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should data be changed to prediction_result here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that for consistency, look at the code block below here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant for line 1383 - sorry for the confusion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

README.rst Outdated
@@ -1377,7 +1377,7 @@ An example of ``output_fn`` for the accept type "application/python-pickle" can

import numpy as np

def output_fn(data, accepts):
def output_fn(prediction_result, accepts):
"""An output_fn that dumps a pickled numpy as response"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change 'numpy' to 'object' for consistency with the above change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

README.rst Outdated
@@ -1386,6 +1386,9 @@ An example of ``output_fn`` for the accept type "application/python-pickle" can
# if the content type is not supported.
pass

A example with the ``input_fn`` and ``output_fn`` above can be find in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two small changes:

  • remove 'the'
  • s/find in/found

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok



def input_fn(mode, batch_size, data_dir):
def _input_fn(mode, batch_size):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better if this method's name were a little more distinct from input_fn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point.


def input_fn(serialized_data, content_type):
data = pickle.loads(serialized_data)
return data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could make this a one-line method: return pickle.loads(serialized_data)

@@ -19,12 +22,34 @@
from tests.integ import DATA_DIR, REGION
from tests.integ.timeout import timeout_and_delete_endpoint, timeout

PICKLE_CONTENT_TYPE = "application/python-pickle"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use single quotes instead of double quotes for consistency with the rest of the SDK

laurenyu
laurenyu previously approved these changes Dec 11, 2017
@laurenyu
Copy link
Contributor

also, don't forget imperative mood with the overall commit message :)

jesterhazy
jesterhazy previously approved these changes Dec 11, 2017
@mvsusp mvsusp merged commit f298f54 into aws:master Dec 18, 2017
@mvsusp mvsusp deleted the mvs-master branch December 18, 2017 18:51
laurenyu added a commit to laurenyu/sagemaker-python-sdk that referenced this pull request May 31, 2018
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
Add LDA Topic Modeling directory and example notebook

Merging in preparation for our meeting tomorrow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants