Skip to content

Commit e241907

Browse files
msaroufimpytorchmergebot
authored andcommitted
[BE] Remove Model Dump utility (pytorch#141540)
So I found this utility by accident, trying to find how many html files we have in the repo so I could convert them to markdown Turns out we package some html and js files in pytorch to visualize torchscript models. This seems kinda strange, probably shouldn't be in core, I removed the tests I could find. Maybe some internal tests will break but considering torchscript is being superseded might make sense to do this Last time there was a meaningful update to the test for this file was about 2 years ago by @digantdesai since then it's a bunch of routine upgrades It seems like this package is unused https://github.com/search?type=code&auto_enroll=true&q=torch.utils.model_dump&p=1 I skimmed through 5 pages of these and the only time this shows up in code search is when someone is either cloning pytorch or checking in their venv into github Pull Request resolved: pytorch#141540 Approved by: https://github.com/malfet
1 parent 533798e commit e241907

File tree

5 files changed

+2
-246
lines changed

5 files changed

+2
-246
lines changed

docs/source/conf.py

-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
"DistributedDataParallelCPU",
157157
# torch.utils
158158
"set_module",
159-
# torch.utils.model_dump
160159
"burn_in_info",
161160
"get_info_and_burn_skeleton",
162161
"get_inline_skeleton",

test/run_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ def __contains__(self, item):
433433
"test_mkldnn_verbose",
434434
"test_mkl_verbose",
435435
"test_mobile_optimizer",
436-
"test_model_dump",
437436
"test_model_exports_to_core_aten",
438437
"test_module_tracker",
439438
"test_monitor",

test/test_model_dump.py

-242
This file was deleted.

test/test_public_bindings.py

-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ def onerror(modname):
278278
for mod in pkgutil.walk_packages(torch.__path__, "torch.", onerror=onerror):
279279
modname = mod.name
280280
try:
281-
# TODO: fix "torch/utils/model_dump/__main__.py"
282-
# which calls sys.exit() when we try to import it
283281
if "__main__" in modname:
284282
continue
285283
importlib.import_module(modname)

torch/utils/model_dump/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import zipfile
7777
from pathlib import Path
7878
from typing import Dict
79+
import warnings
7980

8081
import torch.utils.show_pickle
8182

@@ -389,6 +390,7 @@ def get_info_and_burn_skeleton(path_or_bytesio, **kwargs):
389390

390391

391392
def main(argv, *, stdout=None):
393+
warnings.warn("torch.utils.model_dump is deprecated and will be removed in a future PyTorch release.")
392394
parser = argparse.ArgumentParser()
393395
parser.add_argument("--style", choices=["json", "html"])
394396
parser.add_argument("--title")

0 commit comments

Comments
 (0)