nni icon indicating copy to clipboard operation
nni copied to clipboard

Pruner does not run in Python 3.7.x

Open adhocmaster opened this issue 1 year ago • 0 comments

Describe the issue: Literal is not available in the typing package of Python 3.7.x's. It can be fixed by importing from typing_extensions package.

\anaconda3\envs\compression\lib\site-packages\nni\compression\base\config.py in <module>
      7 from copy import deepcopy
      8 import re
----> 9 from typing import Any, Dict, List, Literal, Tuple
     10 
     11 from schema import Schema, Optional, Or

ImportError: cannot import name 'Literal' from 'typing' (...\lib\typing.py)

Environment:

  • NNI version: 3.0
  • Training service (local|remote|pai|aml|etc): local
  • Client OS: windows 10
  • Server OS (for remote mode only):
  • Python version: 3.7.9
  • PyTorch/TensorFlow version: 1.11.0
  • Is conda/virtualenv/venv used?: conda
  • Is running in Docker?: No

Configuration:

  • Experiment config (remember to remove secrets!): config_list = [{ 'op_types': ['Linear', 'Conv2d'], # types of layers to prune 'exclude_op_names': ['fc3'], # exclude specific layers 'sparse_ratio': 0.3 # mask 30% of the parameters }]
  • Search space:

Log message:

  • nnimanager.log:
  • dispatcher.log:
  • nnictl stdout and stderr:

How to reproduce it?:

adhocmaster avatar Jul 04 '24 20:07 adhocmaster