# brocolli
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 PytorchCaffeParser
net = 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 PytorchOnnxParser
net = 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~
Raw data
{
"_id": null,
"home_page": "https://github.com/inisis/brocolli",
"name": "brocolli",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "machine-learning,pytorch,caffe,torchfx",
"author": "desmond",
"author_email": "desmond.yao@buaa.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/19/28/798faeeae85d69f932c928de59e8fc6386266913d76072a38d2a7a7aab34/brocolli-4.0.2.tar.gz",
"platform": null,
"description": "# brocolli\n\ntorch fx based pytorch model converter, including pytorch2caffe, pytorch2onnx. \ntorch fx based pytorch model quantizier.\n\n# Installation\n```\npip install brocolli\n```\n\n# How to use\n* torch2caffe\n * caffe installation\n ```bash\n pip install brocolli-caffe\n ```\n\n ```\n import torchvision.models as models\n from brocolli.converter.pytorch_caffe_parser import PytorchCaffeParser\n\n net = models.alexnet(pretrained=False)\n x = torch.rand(1, 3, 224, 224)\n pytorch_parser = PytorchCaffeParser(net, x)\n pytorch_parser.convert()\n pytorch_parser.save('alexnet')\n ```\n run this script until you see \"accuracy test passed\" on screen, then you can get alexnet.caffemodel and alexnet.prototxt under under current folder.\n\n* torch2onnx\n ```\n import torchvision.models as models\n from brocolli.converter.pytorch_onnx_parser import PytorchOnnxParser\n\n net = models.alexnet(pretrained=False)\n x = torch.rand(1, 3, 224, 224)\n pytorch_parser = PytorchOnnxParser(net, x)\n pytorch_parser.convert()\n pytorch_parser.save('alexnet.onnx')\n ```\n run this script until you see \"accuracy test passed\" on screen, then you can get alexnet.onnx under current folder.\n\n# Contact\n QQ Group: 597059928\n \n ![image](https://raw.githubusercontent.com/inisis/brocolli/master/imgs/QGRPOUP.png)\n \n# Show your support\n Give a \ud83c\udf1f if this project helpes~\n",
"bugtrack_url": null,
"license": "",
"summary": "everything in pytorch",
"version": "4.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/inisis/brocolli/issues",
"Homepage": "https://github.com/inisis/brocolli"
},
"split_keywords": [
"machine-learning",
"pytorch",
"caffe",
"torchfx"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "33b3b002dce57ba18c8c86c80f652ad36b834cdf10709b80365f4e2c407ea5f3",
"md5": "0122d493a4e3099b2be627cd06f366b9",
"sha256": "85830e117d5c4c3791df8e06abd39c0bfd710028b610f5e541c203c041c91fa4"
},
"downloads": -1,
"filename": "brocolli-4.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0122d493a4e3099b2be627cd06f366b9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 118078,
"upload_time": "2023-05-23T11:46:17",
"upload_time_iso_8601": "2023-05-23T11:46:17.997468Z",
"url": "https://files.pythonhosted.org/packages/33/b3/b002dce57ba18c8c86c80f652ad36b834cdf10709b80365f4e2c407ea5f3/brocolli-4.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1928798faeeae85d69f932c928de59e8fc6386266913d76072a38d2a7a7aab34",
"md5": "91dc3cfbb1e204ecbb080199f7841723",
"sha256": "16b2ff08f44b4322e58437bb074b44b89dc41e9061596c129afd46c48012006b"
},
"downloads": -1,
"filename": "brocolli-4.0.2.tar.gz",
"has_sig": false,
"md5_digest": "91dc3cfbb1e204ecbb080199f7841723",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 60615,
"upload_time": "2023-05-23T11:46:20",
"upload_time_iso_8601": "2023-05-23T11:46:20.106261Z",
"url": "https://files.pythonhosted.org/packages/19/28/798faeeae85d69f932c928de59e8fc6386266913d76072a38d2a7a7aab34/brocolli-4.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-23 11:46:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "inisis",
"github_project": "brocolli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "brocolli"
}