microsoft / nni

An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
https://nni.readthedocs.io
MIT License
14k stars 1.81k forks source link

Torch version error when running ModelSpeedup? #5616

Open aidevmin opened 1 year ago

aidevmin commented 1 year ago

Describe the issue:

Environment:

Configuration:

Log message:

How to reproduce it?:

When I running model speedup, this error is happen

model.0.conv  sparsity :  0.5
model.1.conv  sparsity :  0.5
model.2.conv  sparsity :  0.5
Traceback (most recent call last):
  File "pruning_nni.py", line 252, in <module>
    detect()
  File "pruning_nni.py", line 72, in detect
    ModelSpeedup(model, torch.rand(1, 3, 640, 640).to(device), masks).speedup_model()
  File "/opt/conda/lib/python3.8/site-packages/nni/compression/pytorch/speedup/compressor.py", line 73, in __init__
    self.torch_graph = build_module_graph(model, self.dummy_input)
  File "/opt/conda/lib/python3.8/site-packages/nni/common/graph_utils.py", line 25, in build_module_graph
    return TorchModuleGraph(model, dummy_input)
  File "/opt/conda/lib/python3.8/site-packages/nni/common/graph_utils.py", line 265, in __init__
    super().__init__(model, dummy_input, traced_model)
  File "/opt/conda/lib/python3.8/site-packages/nni/common/graph_utils.py", line 58, in __init__
    assert torch.__version__ >= '1.3.1'
AssertionError

I check Torch version is 1.10.0a0+3fd9dcf and it seem meet the above condition. Please check again? Thanks.

J-shang commented 1 year ago

hello, could you have a try directly with torch.__version__ >= '1.3.1' image

Lijiaoa commented 1 year ago

Did you have any updates to report? @aidevmin