Skip to content
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

Notebook: ThunderFX tutorial #1524

Merged
merged 10 commits into from
Dec 12, 2024
Merged

Notebook: ThunderFX tutorial #1524

merged 10 commits into from
Dec 12, 2024

Conversation

kiya00
Copy link
Collaborator

@kiya00 kiya00 commented Dec 6, 2024

Before submitting
  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Add tutorial for thunder as torch.compile backend

cc @Borda @apaz-cli

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 6, 2024
@mruberry
Copy link
Collaborator

mruberry commented Dec 6, 2024

Great stuff, @kiya00! Notebooks like this are invaluable. I was asked for a notebook explaining more about ThunderFX just the other day.

I made some comments using ReviewNB. I'm curious to hear your thoughts! They also propose changing some of the current UX to make the notebook easier to understand.

@kiya00 kiya00 mentioned this pull request Dec 9, 2024
@kiya00 kiya00 marked this pull request as draft December 9, 2024 18:23
@kiya00 kiya00 force-pushed the thunderfx_tutorial branch from 40dc5f5 to a82416e Compare December 10, 2024 20:12
@kiya00
Copy link
Collaborator Author

kiya00 commented Dec 10, 2024

Hi all, I modified it to a simple introduction of thunderfx, and ignored the #1532 for now

@kiya00 kiya00 marked this pull request as ready for review December 10, 2024 20:16
@kiya00 kiya00 force-pushed the thunderfx_tutorial branch from a82416e to 14eedf9 Compare December 10, 2024 20:19
@mruberry
Copy link
Collaborator

Hi all, I modified it to a simple introduction of thunderfx, and ignored the #1532 for now

That's awesome, and #1535 is merged now, too!

notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
notebooks/hello_world_thunderfx.ipynb Show resolved Hide resolved
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Updates look great, @kiya00! I thought the story was really straightforward and a great start to help practitioners learn about ThunderFX. I made some wording suggestions, and I have one question about the absolute difference in the model example.

It would be cool, but is not necessary, if we could include something interactive in the demo so that instead of relying on comparing output tensor discrepancies readers felt like they could compare the quality of the thunderfx compiled model vs. the eager model. Offering an interactive chat prompt is probably too computationally intensive, but maybe in the future we should think about an image generation model. (Doesn't have to be part of this PR.)

This XLA notebook uses stable diffusion, as an example:

https://github.com/pytorch/xla/blob/master/contrib/kaggle/pytorch-xla-2-0-on-kaggle.ipynb

and I think that's visually interesting. Again, something to consider for the future, not today.

@mruberry
Copy link
Collaborator

@kiya00
Copy link
Collaborator Author

kiya00 commented Dec 11, 2024

This notebook may also be causing an error in the CI:

https://dev.azure.com/Lightning-AI/Tutorials/_build/results?buildId=221933&view=logs&j=7e5b35f3-25b5-5ac7-f3c6-076eb2046208&t=93498b9b-50d0-54cd-9f79-979d23ce2520

Yes and it's strange that Torch nightly has no problem with it, Torch 2.4 does. I'll fix it tomorrow

It would be cool, but is not necessary, if we could include something interactive in the demo so that instead of relying on comparing output tensor discrepancies readers felt like they could compare the quality of the thunderfx compiled model vs. the eager model. Offering an interactive chat prompt is probably too computationally intensive, but maybe in the future we should think about an image generation model. (Doesn't have to be part of this PR.)

That's good idea, we could have another notebook or maybe demos would be more appropriate to show using Thunder to run interactive chat and image generation model

@kiya00 kiya00 force-pushed the thunderfx_tutorial branch from 17d5082 to 9d2bb2e Compare December 12, 2024 11:13
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

This is a great first notebook introducing ThunderFX. I made one last suggestion for you review, @kiya00, to explain the deviation between ThunderFX and PyTorch's default results.

@kiya00
Copy link
Collaborator Author

kiya00 commented Dec 12, 2024

Hi @mruberry , thanks for the review! I added the comment to explain t deviation

@mruberry
Copy link
Collaborator

Hi @mruberry , thanks for the review! I added the comment to explain t deviation

Oh sorry, would you add it as a text cell, not a comment in the code?

@kiya00
Copy link
Collaborator Author

kiya00 commented Dec 12, 2024

ah, sure, I got it wrong, let me add it in the text cell

@mruberry mruberry enabled auto-merge (squash) December 12, 2024 17:36
@mruberry mruberry merged commit de2bbd5 into main Dec 12, 2024
41 checks passed
@mruberry mruberry deleted the thunderfx_tutorial branch December 12, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants