Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inisis/brocolli
Everything in Torch Fx
https://github.com/inisis/brocolli
caffe onnx pytorch quantization
Last synced: 4 days ago
JSON representation
Everything in Torch Fx
- Host: GitHub
- URL: https://github.com/inisis/brocolli
- Owner: inisis
- License: mit
- Created: 2019-02-01T17:17:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-07T15:53:50.000Z (8 months ago)
- Last Synced: 2025-01-30T09:03:53.094Z (12 days ago)
- Topics: caffe, onnx, pytorch, quantization
- Language: Python
- Homepage:
- Size: 5.9 MB
- Stars: 341
- Watchers: 9
- Forks: 64
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# brocolli (Deprecated, this repo is no longer maintained)
torch fx based pytorch model converter, including pytorch2caffe, pytorch2onnx.
torch fx based pytorch model quantizier.# Installation
```
pip install brocolli
```# How to use
* torch2caffe
* caffe installation
```bash
pip install brocolli-caffe
``````
import torchvision.models as models
from brocolli.converter.pytorch_caffe_parser import PytorchCaffeParsernet = models.alexnet(pretrained=False)
x = torch.rand(1, 3, 224, 224)
pytorch_parser = PytorchCaffeParser(net, x)
pytorch_parser.convert()
pytorch_parser.save('alexnet')
```
run this script until you see "accuracy test passed" on screen, then you can get alexnet.caffemodel and alexnet.prototxt under under current folder.* torch2onnx
```
import torchvision.models as models
from brocolli.converter.pytorch_onnx_parser import PytorchOnnxParsernet = models.alexnet(pretrained=False)
x = torch.rand(1, 3, 224, 224)
pytorch_parser = PytorchOnnxParser(net, x)
pytorch_parser.convert()
pytorch_parser.save('alexnet.onnx')
```
run this script until you see "accuracy test passed" on screen, then you can get alexnet.onnx under current folder.# Contact
QQ Group: 597059928
![image](https://raw.githubusercontent.com/inisis/brocolli/master/imgs/QGRPOUP.png)
# Show your support
Give a 🌟 if this project helpes~