# Runnig a model with tvm debugger

**URL:** <https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869>\
**Category:** Questions\
**Created:** [April 30, 2021, 11:32am UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869 "2021-04-30T11:32:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahooora](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/sahooora/32/2300_2.png) [@sahooora](https://discuss.tvm.apache.org/u/sahooora)\
**Post date:** [April 30, 2021, 11:32am UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/1 "2021-04-30T11:32:29Z")

</div>

Hi everybody,

I used tvm debugger based on the description came [here](https://tvm.apache.org/docs/dev/debugger.html#how-to-use-debugger).

The following line gives me 3 files: output\_tensors.params, executaion\_trace.json, and graph\_dump.json.

I get different output\_tensors.params file for every run!! Does anyone know why the parameters file is different from one run to another?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [May 3, 2021, 4:05pm UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/2 "2021-05-03T16:05:00Z")

</div>

This is a known bug. There is current a PR fixing it here: [[Graph Executor Debugger] Fix parameter dump by mehrdadh · Pull Request #7903 · apache/tvm · GitHub](https://github.com/apache/tvm/pull/7903)

---

<div class="post-metadata">

**Author:** ![sahooora](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/sahooora/32/2300_2.png) [@sahooora](https://discuss.tvm.apache.org/u/sahooora)\
**Post date:** [May 3, 2021, 7:16pm UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/3 "2021-05-03T19:16:24Z")

</div>

Thank you so much for your response! I saw the PR is merged to the master branch now so I’ve cloned the latest version but I still have the same issue!

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [May 3, 2021, 10:12pm UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/4 "2021-05-03T22:12:07Z")

</div>

hi @sahooora,

could you double-check you’re driving the model with the same inputs and parameters each time? if so, could you provide some more info such as which revision of TVM you’re using and some scripts we can use to reproduce your error?

thanks, Andrew

---

<div class="post-metadata">

**Author:** ![sahooora](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/sahooora/32/2300_2.png) [@sahooora](https://discuss.tvm.apache.org/u/sahooora)\
**Post date:** [May 5, 2021, 9:18am UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/5 "2021-05-05T09:18:26Z")

</div>

Hi @areusch,

Yes, I’m using the same input and params in each run but with `graph_executor.create` I get 2 different `output_tensors.params` in 2 runs.

I use commit `8c56ce3b9076` of TVM. I uploaded my code, model, and input image [here](https://gofile.io/d/FidK9Z) for reproducing the issue.

Thanks

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [May 5, 2021, 4:24pm UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/6 "2021-05-05T16:24:49Z")

</div>

Use this code to construct the graph\_executor:

```python
from tvm.contrib.debugger.graph_debugger import GraphModuleDebug
m = GraphModuleDebug(exe["debug_create"]("default", dev)), [dev], exe.get_json())

```

I’ve encountered errors with `graph_debugger.create` in the past but I haven’t had a chance to figure out what is wrong.

---

<div class="post-metadata">

**Author:** ![hzshao](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/h/9dc877/32.png) [@hzshao](https://discuss.tvm.apache.org/u/hzshao)\
**Post date:** [May 14, 2021, 3:29am UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/7 "2021-05-14T03:29:17Z")

</div>

Hi, I have also met problem when using the same code, have you solved it?

---

<div class="post-metadata">

**Author:** ![Wheest](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/wheest/32/607_2.png) [@Wheest](https://discuss.tvm.apache.org/u/Wheest)\
**Post date:** [September 22, 2021, 9:58am UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/8 "2021-09-22T09:58:45Z")

</div>

Hi there,

I have also been facing this issue.

I have found that the version described in the [documentation](https://tvm.apache.org/docs/dev/debugger.html) still causes issues, and I have not been able to get it working.

I got the [alternative approach using GraphModuleDebug](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/6) suggested earlier working, however the API has changed since this comment was posted, so I had to modify it a bit.

I have a simple standalone script that has both approaches, switch between them by passing the flag `--mode`, either `tutorial` or `forum` (or `normal` - with no debugger runtime).

You can find the [code here](https://gist.github.com/Wheest/9ad2d6a47bbd2cfaa4be530c68ba2f6c).

The working version of `GraphModuleDebug` is thus:

```auto
m = GraphModuleDebug(
    lib["debug_create"]("default", dev),
    [dev],
    lib.graph_json,
    dump_root="/tmp/tvmdbg",
)

```

Is this considered the canonical way of running the debugger now? Or is there a way to get `debug_executor` working?

In both cases, does this require a docs update?

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [September 22, 2021, 8:53pm UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/9 "2021-09-22T20:53:44Z")

</div>

I don’t think there is any conical way of creating the debugger. Its done in different ways all over the place.

---

<div class="post-metadata">

**Author:** ![zgh551](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/zgh551/32/6107_2.png) [@zgh551](https://discuss.tvm.apache.org/u/zgh551)\
**Post date:** [October 14, 2021, 9:57am UTC](https://discuss.tvm.apache.org/t/runnig-a-model-with-tvm-debugger/9869/10 "2021-10-14T09:57:55Z")

</div>

I have the same problem with you,the output\_tensor.params file is changed in each run debugger with the same input and params.The module output also is err.
