-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add a new tutorial: Building a Flask API server with PyTorch #537
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
Conversation
Deploy preview for pytorch-tutorials-preview ready! Built with commit 1401e89 https://deploy-preview-537--pytorch-tutorials-preview.netlify.com |
@jeffreyksmithjr for review. Questions to ask:
|
Hey @jeffreyksmithjr, any update on this? |
Thanks very much for thinking to add this @avinassh . I didn't see the notification before. I will review this shortly. |
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.
Lots of tiny easy things to do in one pass. A few are very optional.
transforms.CenterCrop(224), | ||
transforms.ToTensor(), | ||
transforms.Normalize( | ||
[0.485, 0.456, 0.406], |
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.
I know that you individually are not the source of these magic numbers within this codebase, but I still wish that their origin were more clearly called out. At least some sort of pointer about where they come from.
Thanks very much @avinassh for this well-conceived tutorial. I have a bunch of small things around clarity and language. Overall, this is a valuable contribution. Once we've got it wrapped up, I want to point to this from other locations as well, to help PT users find this resource. |
somehow I missed it. Really sorry. I will update the PR now. |
@jeffreyksmithjr Thank you so much for the PR review. Since I am a non-native English speaker, I ended up making a lot of grammatical mistakes. I have fixed the PR as per the review suggestions. Only one thing left is about transforms mean/std deviation magic numbers - #537 (comment) I have provided a link to torchvision's model doc, but it doesn't explain either how/why about those numbers Could you suggest me, what to add? |
@jspisak I have updated the PR :D |
@avinassh - thanks!! @jeffreyksmithjr - take a look and merge? |
# method? Or why it is a global variable? Loading a model can be an | ||
# expensive operation, memory, CPU wise. If we loaded the model in the | ||
# ``get_prediction`` method, then it will get unnecessarily loaded every | ||
# Did you notice that why ``model`` variable is not part of ``get_prediction`` |
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.
why
still is incorrect. It should just be Did you notice that model..
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.
oops, somehow I missed it. Sent another PR #583 to fix it.
Merging per Jeff's go ahead.. |
I think this a great tutorial, and I really appreciate you writing it @avinassh . Thanks for your patience with my various nits around writing style. Your solution to the magic numbers issue seems reasonable, since it doesn't originate in your work. Thank you for taking my feedback and getting this in. It turned out great and will be an asset to the community. |
Thank you so much @jeffreyksmithjr! It was really fun writing it. Thanks for your feedback, it was very helpful and I learnt quite a few things about writing a good tutorial :D |
Also, may I know when this will go live on https://pytorch.org/tutorials |
it should be live now, as soon as the CI finishes the job and pushes to the site. |
Add a new tutorial: Building a Flask API server with PyTorch
I was writing this for my blog, however, I noticed that PyTorch Tutorials does not have one on building an API. So I am submitting here. My apologies, since I did not discuss this here first. I think PyTorch Tutorial could really use this 😄