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

[Tutorial] Demo showing how to run a pruned 🤗 model. #5975

Merged
merged 5 commits into from
Jul 2, 2020

Conversation

jwfromm
Copy link
Contributor

@jwfromm jwfromm commented Jul 1, 2020

This tutorial demonstrates how to load and run a sparse model from the popular transformers module from Hugging Face (🤗). Very recently a 95% sparse version of BERT was made publicly available however 🤗 was unable to achieve speedups using existing frameworks. Using this script, TVM enables a 2-3X speedup by converting appropriate dense layers to sparse dense layers. I think this will be a useful tutorial for user's interested in sparse networks and may be good PR for TVM as a small collaboration with 🤗. Thanks @antinucleon for helping getting this all working!

@jwfromm
Copy link
Contributor Author

jwfromm commented Jul 1, 2020

@masahi, @vinx13, @binarybana can you take a look and let me know what you think?

@tqchen
Copy link
Member

tqchen commented Jul 1, 2020

cc @antinucleon @junrushao1994

@masahi
Copy link
Member

masahi commented Jul 1, 2020

I liked emojis in the PR:)

How about adding a sample output, with avx2 or 512?

Copy link
Contributor

@binarybana binarybana left a comment

Choose a reason for hiding this comment

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

Looks great! Made some edits.

tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
tutorials/frontend/deploy_sparse.py Outdated Show resolved Hide resolved
@merrymercy
Copy link
Member

merrymercy commented Jul 2, 2020

How long does this tutorial take to run?
If it takes a lot of time, it is better to provide some sample outputs, so readers can know what is expected.
Otherwise, it is better to let it run on the CI server, so we can get output from the web server and make sure the tutorial is always runnable.

@jwfromm
Copy link
Contributor Author

jwfromm commented Jul 2, 2020

@merrymercy it's fairly quick, I commented out the run command due to dependencies rather than the run time. This tutorial requires tensorflow 2.2 (our servers currently use 2.1) and transformers. If we think its worth updating the server build then we can run this for real.

@u99127
Copy link
Contributor

u99127 commented Jul 2, 2020

@merrymercy it's fairly quick, I commented out the run command due to dependencies rather than the run time. This tutorial requires tensorflow 2.2 (our servers currently use 2.1) and transformers. If we think its worth updating the server build then we can run this for real.

A +1 for updating TF versions and keeping this running out of the box.

@tqchen tqchen merged commit a519292 into apache:master Jul 2, 2020
@tqchen
Copy link
Member

tqchen commented Jul 2, 2020

Thanks everyone, this is merged, will ping the thread again once we have TF 2.2 landed in the CI

@Wheest
Copy link
Contributor

Wheest commented Jul 9, 2020

Note that the .ipynb version of the tutorial doesn't work when running benchmark(), since it uses the __file__ variable in import_graphdef(), which is not defined in most notebook environments. Alternative approach to getting path may be needed.

There are also a lot of dependencies for the tutorial (e.g. transformers, tensorflow) which may not be in a user's environment. Should an Install dependencies section be added à la?

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.

7 participants