Closed muellerzr closed 3 days ago
Let me know how I can improve on this tool further so we can then get it going throughout anyone at HF that wants to use it 🤗
@BenjaminBossan what's missing here is the initial tuna check, which is why it's required (see the workflow).
We can eventually look at gutting it out, sure. However I think having both the visual option for debugging further + the condensed output here is valuable and is why we should still use tuna
itself.
Edit; I may be wrong here, sorry
@BenjaminBossan fully removed the requirement for tuna
there, however I still think it's useful for further debugging so left that in as part of the testcase class description :)
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
🔥
What does this PR do?
This PR introduces a CI which utilizes the
cProfile
timings and mytuna-interpreter
libraries to perform time-based import tests.It was reported by @stas00 that we were taking far too long to do basic things like
accelerate launch
, andtuna
can help visualize why by creating import graphs directing us to what is taking too long:I wrote a small library called tuna-interpreter that aims to take the best parts of
tuna
and work it into something parse-able that lets us run CIs off of it.After using the tool:
We can see a decrease of ~68%
How it works:
In its current form, we are going based off of a baseline
torch
import, since Accelerate relies on torch no matter what. BUT we should be no more than ~20% slower than the torch import overall. Anything more and we have some slip-up or timing problem.An example test looks like the following:
Where essentially we:
import_time
to run a particular python import called via-c
in subprocessmax_depth
is it should be enough to get your imports out of the slowdown trace, and show what external libraries you are really calling.An example failure is below, where we can clearly see what module chain had the slowdown:
Or:
If there are specific issues with using
tuna-interpreter
, please let me know, it's a very quickly hacked-together-but-working library for what we are doing, and open to improving it further after we battle-test itBefore submitting
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.
@SunMarc @BenjaminBossan @sayakpaul @Titus-von-Koeller @ArthurZucker @ydshieh @LysandreJik