项目作者: Peidong-Wang

项目描述 :
An Operation Counter for Efficient Audio/Speech Processing Networks
高级语言: Python
项目地址: git://github.com/Peidong-Wang/OCEAN.git
创建时间: 2020-10-21T16:33:48Z
项目社区:https://github.com/Peidong-Wang/OCEAN

开源协议:Apache License 2.0

下载


How to Install and Use

  1. Installation:

python setup.py install

  1. A simple example:

Define PyTorch model and its (dummy) input:

  1. import torch
  2. from torchvision.models import resnet18
  3. model = resnet18()
  4. inputs = torch.randn(1, 3, 224, 224)

Measure the number of MACs using profile_macs:

  1. from ocean import profile_macs
  2. macs = profile_macs(model, inputs)
  1. Examples:

Check out the egs/ folder.

  1. Handler registration:

For warnings like UserWarning: No handlers found: "aten::<a specific operation>". Skipped., please register the missing handler to ocean/handlers.py.

Updates and Acknowledgement

  1. The default version of OCEAN now uses torch.jit.trace as in torchprofile: https://github.com/zhijian-liu/torchprofile.
  2. The THOP (https://github.com/Lyken17/pytorch-OpCounter.git) based version is saved to the thop branch.

Slack Group

https://join.slack.com/t/ocean-zdz3431/shared_invite/zt-jns0uib8-7nEYX8HNq0eq3LYq2Lj8rw