[FX] Added fuser tutorial by Chillee · Pull Request #1356 · pytorch/tutorials (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation45 Commits9 Checks0 Files changed

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

Chillee

Not sure how to test it in notebook format.

Also, perhaps I'd like to bake in the output somehow? It would be somewhat embarassing if the fused version was slower due to noise :)

@Chillee

@netlify

@Chillee

@Chillee

jamesr66a

@Chillee

gchanan

.. Code Transformations with FX
.. customcarditem::
:header: Building a Convolution/Batch Norm fuser in FX
:card_description: Build a simple FX interpreter to record the runtime of op, module, and function calls and report statistics

Choose a reason for hiding this comment

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

are the card description and images correct? They look like they belong to other tutorials?

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

I put that because it's just a generic PyTorch logo:
image

And wasn't sure if I should copy that into a new filename or if we should come up with some logo to use

gchanan

@@ -215,6 +215,15 @@ Welcome to PyTorch Tutorials
🔗 advanced/super_resolution_with_onnxruntime.html
:tags: Production
.. Code Transformations with FX
.. customcarditem::
:header: Building a Convolution/Batch Norm fuser in FX

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

I agree the terminology is confusing, but I think fusion is an acceptable (and more widely understood) term. If we add a fusion tutorial later I'd be glad to rename it to something to avoid name conflicts.

gchanan

gchanan

gchanan

gchanan

gchanan

gchanan

gchanan

gchanan

gchanan

gchanan

gchanan

@Chillee

Base automatically changed from master to main

February 16, 2021 19:33

Base automatically changed from main to master

February 16, 2021 19:37

gchanan

gchanan

jamesr66a

Choose a reason for hiding this comment

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

Looks good to me!

.. Code Transformations with FX
.. customcarditem::
:header: Building a Convolution/Batch Norm fuser in FX
:card_description: Build a simple FX interpreter to record the runtime of op, module, and function calls and report statistics

Choose a reason for hiding this comment

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

I put that because it's just a generic PyTorch logo:
image

And wasn't sure if I should copy that into a new filename or if we should come up with some logo to use

# accessing the computational graph. FX resolves this problem by symbolically
# tracing the actual operations called, so that we can track the computations
# through the `forward` call, nested within Sequential modules, or wrapped in
# an user-defined module.

Choose a reason for hiding this comment

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

nit: a user-defined module

Choose a reason for hiding this comment

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

🤔 Shouldn't it be an before user? Since user starts with a vowel?

Choose a reason for hiding this comment

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

the rule is based on the sound, not the letter.

fused_model = fuse(model)
print(fused_model.code)
inp = torch.randn(5, 1, 1, 1)

Choose a reason for hiding this comment

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

Should we run this on a more realistic input shape?

Choose a reason for hiding this comment

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

I just wrote all the conv/batch norm modules to operate on a [1,1,1] shape. We're not measuring the performance of this module so I don't think it matters.

@Chillee

jamesr66a

@brianjo

@brianjo

@brianjo brianjo changed the base branch from master to 1.8-RC5-TEST

March 4, 2021 13:05

@brianjo

brianjo added a commit that referenced this pull request

Mar 4, 2021

Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Guanheng Zhang zhangguanheng@devfair0197.h2.fair Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Guanheng Zhang zhangguanheng@devfair0197.h2.fair Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Brian Johnson brianjo@fb.com

Summary: Tutorial which places a pipe on GPUs 0 and 1 and another Pipe on GPUs 2 and 3. Both pipe replicas are replicated via DDP. One process drives GPUs 0 and 1 and another drives GPUs 2 and 3.

Co-authored-by: pritam pritam.damania@fb.com

Hopefully that's the last one

Last one

Co-authored-by: moto 855818+mthrok@users.noreply.github.com Co-authored-by: Guanheng George Zhang 6156351+zhangguanheng66@users.noreply.github.com Co-authored-by: Guanheng Zhang zhangguanheng@devfair0197.h2.fair Co-authored-by: James Reed jamesreed@fb.com Co-authored-by: Horace He horacehe2007@yahoo.com Co-authored-by: Pritam Damania 9958665+pritamdamania87@users.noreply.github.com Co-authored-by: pritam pritam.damania@fb.com Co-authored-by: Nikita Shulga nshulga@fb.com

rodrigo-techera pushed a commit to Experience-Monks/tutorials that referenced this pull request

Nov 29, 2021

Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Guanheng Zhang zhangguanheng@devfair0197.h2.fair Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Guanheng Zhang zhangguanheng@devfair0197.h2.fair Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Brian Johnson brianjo@fb.com

Co-authored-by: Brian Johnson brianjo@fb.com

Summary: Tutorial which places a pipe on GPUs 0 and 1 and another Pipe on GPUs 2 and 3. Both pipe replicas are replicated via DDP. One process drives GPUs 0 and 1 and another drives GPUs 2 and 3.

Co-authored-by: pritam pritam.damania@fb.com

Hopefully that's the last one

Last one

Co-authored-by: moto 855818+mthrok@users.noreply.github.com Co-authored-by: Guanheng George Zhang 6156351+zhangguanheng66@users.noreply.github.com Co-authored-by: Guanheng Zhang zhangguanheng@devfair0197.h2.fair Co-authored-by: James Reed jamesreed@fb.com Co-authored-by: Horace He horacehe2007@yahoo.com Co-authored-by: Pritam Damania 9958665+pritamdamania87@users.noreply.github.com Co-authored-by: pritam pritam.damania@fb.com Co-authored-by: Nikita Shulga nshulga@fb.com