Skip to content

Commit

Permalink
Merge pull request #88 from microsoft/master
Browse files Browse the repository at this point in the history
pull
  • Loading branch information
chicm-ms authored May 28, 2020
2 parents 3ea0b89 + 5a911b3 commit cf3fb20
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ With authors' permission, we listed a set of NNI usage examples and relevant art
Join IM discussion groups:
|Gitter||WeChat|
|----|----|----|
|![image](https://user-images.githubusercontent.com/39592018/80665738-e0574a80-8acc-11ea-91bc-0836dc4cbf89.png)| OR |![image](https://github.com/JSong-Jia/NNI-user-group/blob/master/user%20group%20code_0512.png)|
|<img src="https://user-images.githubusercontent.com/39592018/80665738-e0574a80-8acc-11ea-91bc-0836dc4cbf89.png" width="180"/>| OR |<img src="https://user-images.githubusercontent.com/39592018/83108240-113d9600-a0f2-11ea-91f8-8754af11a0ee.png" width="180"/>|


## Related Projects
Expand Down
2 changes: 1 addition & 1 deletion docs/en_US/Compressor/ModelSpeedup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For each module, we should prepare four functions, three for shape inference and
## Usage

```python
from nni.compression.speedup.torch import ModelSpeedup
from nni.compression.torch import ModelSpeedup
# model: the model you want to speed up
# dummy_input: dummy input of the model, given to `jit.trace`
# masks_file: the mask file created by pruning algorithms
Expand Down
3 changes: 1 addition & 2 deletions examples/model_compress/model_speedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import torch.nn.functional as F
from torchvision import datasets, transforms
from models.cifar10.vgg import VGG
from nni.compression.speedup.torch import ModelSpeedup
from nni.compression.torch import apply_compression_results
from nni.compression.torch import apply_compression_results, ModelSpeedup

torch.manual_seed(0)
use_mask = True
Expand Down
9 changes: 3 additions & 6 deletions src/sdk/pynni/nni/compression/torch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

from .pruning import *
from .quantization import *
from .compressor import Compressor, Pruner, Quantizer
from .pruners import *
from .weight_rank_filter_pruners import *
from .activation_rank_filter_pruners import *
from .quantizers import *
from .apply_compression import apply_compression_results
from .gradient_rank_filter_pruners import *
from .speedup import ModelSpeedup
8 changes: 8 additions & 0 deletions src/sdk/pynni/nni/compression/torch/pruning/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

from .pruners import *
from .weight_rank_filter_pruners import *
from .activation_rank_filter_pruners import *
from .apply_compression import apply_compression_results
from .gradient_rank_filter_pruners import *
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import logging
import torch
from schema import And, Optional
from .utils import CompressorSchema
from .compressor import Pruner
from ..utils.config_validation import CompressorSchema
from ..compressor import Pruner

__all__ = ['ActivationAPoZRankFilterPruner', 'ActivationMeanRankFilterPruner']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import logging
import torch
from .compressor import Pruner
from ..compressor import Pruner

__all__ = ['TaylorFOWeightFilterPruner']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import logging
import torch
from schema import And, Optional
from .compressor import Pruner
from .utils import CompressorSchema
from ..utils.config_validation import CompressorSchema
from ..compressor import Pruner

__all__ = ['LevelPruner', 'AGP_Pruner', 'SlimPruner', 'LotteryTicketPruner']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import logging
import torch
from schema import And, Optional
from .utils import CompressorSchema
from .compressor import Pruner
from ..utils.config_validation import CompressorSchema
from ..compressor import Pruner

__all__ = ['L1FilterPruner', 'L2FilterPruner', 'FPGMPruner']

Expand Down
4 changes: 4 additions & 0 deletions src/sdk/pynni/nni/compression/torch/quantization/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

from .quantizers import *
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import logging
import torch
from schema import Schema, And, Or, Optional
from .utils import CompressorSchema
from .compressor import Quantizer, QuantGrad, QuantType
from ..utils.config_validation import CompressorSchema
from ..compressor import Quantizer, QuantGrad, QuantType

__all__ = ['NaiveQuantizer', 'QAT_Quantizer', 'DoReFaQuantizer', 'BNNQuantizer']

Expand Down
3 changes: 1 addition & 2 deletions src/sdk/pynni/tests/test_model_speedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from torchvision.models.resnet import resnet18
from unittest import TestCase, main

from nni.compression.torch import L1FilterPruner, apply_compression_results
from nni.compression.speedup.torch import ModelSpeedup
from nni.compression.torch import L1FilterPruner, apply_compression_results, ModelSpeedup

torch.manual_seed(0)

Expand Down

0 comments on commit cf3fb20

Please sign in to comment.