Visualising internals when making calls/initialising

I’m digging into the internals of fastai a lot more and find that I keep going to the github repo and digging through code but it feels inefficient. Is there a way to visualise (similar to a graph) the calls, initialisations being performed when something is done in fastai?

Ideally this would be done within a notebook environment so it would produce a directed graph.

I’ve looked into some Python libraries but there doesn’t seem to be many notebook ones.

Has anyone come across this before?

Hi ModdingLeo hope your having a jolly day!

I found the following video A simple trick to understand fastai function) very helpful for looking at how functions work in fastai and other libraries.

Maybe you will find it useful also, its not a visualisation but you examine the code using notebooks.

Cheers mrfabulous1 :smiley: :smiley:

The best way I know of is to trace the code with a debugger. Even so, it is still hard to get a sense of how the parts of fastai interact. It takes time and patience to build up a mental picture. AFAIK, there is no roadmap in the docs.

With PyCharm, you set breakpoints in fastai, attach to the notebook process, and run a cell. When a bp is hit, you can trace from it. Details are found in these forums. I assume that vscode follows a similar process.

I understand it’s not exactly what you are looking for. For generating an actual call graph, I would suggest looking into some kind of profiler.

HTH :slightly_smiling_face:

You can try this from the python standard library trace — Trace or track Python statement execution — Python 3.9.6 documentation