# AutoDiCE Project.
[The source for this AutoDiCE project is available here][src].
![Python Logo](https://www.python.org/static/community_logos/python-logo.png "Sample inline image")
# How to use the Partition
```
### Prepare AlexNet Model and Computing nodes
### mapping.json Template (AlexNet):
{"lenovo_cpu0": ["conv1_1", "conv1_2", "norm1_1", "pool1_1", "conv2_1", "conv2_2", "norm2_1", "pool2_1", "conv3_1", "conv3_2", "conv4_1", "conv4_2", "conv5_1", "conv5_2", "pool5_1", "OC2_DUMMY_0", "fc6_1", "fc6_2"], "lenovo_cpu1": ["fc6_3", "fc7_1", "fc7_2", "fc7_3", "fc8_1", "prob_1"]}
### Quick Start.
import os,sys
from partition.interface import *
if __name__ == '__main__':
output_dirs= './models'
if not os.path.exists(output_dirs):
# Create a new directory because it does not exist
os.makedirs(output_dirs)
print("The output directory %s is created!" % (output_dirs))
origin_model = "bvlcalexnet-9.onnx"
### Can be downloaded from:
# https://github.com/onnx/models/blob/main/vision/classification/alexnet/model/bvlcalexnet-9.onnx
input_model = format_onnx(origin_model)
model = onnx.load(input_model)
# resourceid = { 1:'lenovo_cpu0', 2:'lenovo_cpu1'}
platforms = ['lenovo']
### How the layers in alexnet model distribute over two computing nodes???
random_map = {
"lenovo_cpu0":
["conv1_1", "conv1_2", "norm1_1", "pool1_1", "conv2_1",
"conv2_2", "norm2_1", "pool2_1", "conv3_1", "conv3_2",
"conv4_1", "conv4_2", "conv5_1", "conv5_2", "pool5_1",
"OC2_DUMMY_0", "fc6_1", "fc6_2"],
"lenovo_cpu1":
["fc6_3", "fc7_1", "fc7_2", "fc7_3", "fc8_1", "prob_1"]
}
InputSpecs = Interface(model=input_model, mappings=random_map, platforms=platforms)
#cppname, NodesList, ComputingNodes
### Generate Cpp Files for Multinode-Inference.
GenerateCode = EngineCode(
CppName = "./models/multinode",
Platforms = InputSpecs.platforms,
NodesList = InputSpecs.nodes,
ComputingNodes = InputSpecs.computingnodes,
ValueInfos = InputSpecs.value_map,
Inputs = InputSpecs.inputs,
Outputs = InputSpecs.outputs,
Benchmark = False)
# ...
```
[packaging guide]: https://packaging.python.org
[distribution tutorial]: https://packaging.python.org/tutorials/packaging-projects/
[src]: https://github.com/parrotsky/AutoDiCE
[rst]: http://docutils.sourceforge.net/rst.html
[md]: https://tools.ietf.org/html/rfc7764#section-3.5 "CommonMark variant"
[md use]: https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
Raw data
{
"_id": null,
"home_page": "https://github.com/parrotsky/AutoDiCE",
"name": "autodice",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.1, <4",
"maintainer_email": "",
"keywords": "CodeGeneration,Deep Learning,development",
"author": "Parrotsky",
"author_email": "x.guo3@uva.nl",
"download_url": "https://files.pythonhosted.org/packages/cf/f0/8cbdcf1d703aab834f20e1e5d735e87c1448a5527cb8edef9ac7eafaa62a/autodice-1.0.3.dev2.tar.gz",
"platform": null,
"description": "# AutoDiCE Project.\n[The source for this AutoDiCE project is available here][src].\n![Python Logo](https://www.python.org/static/community_logos/python-logo.png \"Sample inline image\")\n\n\n# How to use the Partition \n```\n### Prepare AlexNet Model and Computing nodes\n### mapping.json Template (AlexNet):\n{\"lenovo_cpu0\": [\"conv1_1\", \"conv1_2\", \"norm1_1\", \"pool1_1\", \"conv2_1\", \"conv2_2\", \"norm2_1\", \"pool2_1\", \"conv3_1\", \"conv3_2\", \"conv4_1\", \"conv4_2\", \"conv5_1\", \"conv5_2\", \"pool5_1\", \"OC2_DUMMY_0\", \"fc6_1\", \"fc6_2\"], \"lenovo_cpu1\": [\"fc6_3\", \"fc7_1\", \"fc7_2\", \"fc7_3\", \"fc8_1\", \"prob_1\"]}\n\n### Quick Start.\nimport os,sys\n \nfrom partition.interface import *\n\nif __name__ == '__main__':\n\n output_dirs= './models'\n if not os.path.exists(output_dirs):\n # Create a new directory because it does not exist\n os.makedirs(output_dirs)\n print(\"The output directory %s is created!\" % (output_dirs))\n\n origin_model = \"bvlcalexnet-9.onnx\"\n ### Can be downloaded from:\n # https://github.com/onnx/models/blob/main/vision/classification/alexnet/model/bvlcalexnet-9.onnx\n input_model = format_onnx(origin_model)\n model = onnx.load(input_model)\n # resourceid = { 1:'lenovo_cpu0', 2:'lenovo_cpu1'}\n platforms = ['lenovo']\n\n ### How the layers in alexnet model distribute over two computing nodes???\n random_map = {\n \"lenovo_cpu0\":\n [\"conv1_1\", \"conv1_2\", \"norm1_1\", \"pool1_1\", \"conv2_1\",\n \"conv2_2\", \"norm2_1\", \"pool2_1\", \"conv3_1\", \"conv3_2\",\n \"conv4_1\", \"conv4_2\", \"conv5_1\", \"conv5_2\", \"pool5_1\",\n \"OC2_DUMMY_0\", \"fc6_1\", \"fc6_2\"],\n \"lenovo_cpu1\":\n [\"fc6_3\", \"fc7_1\", \"fc7_2\", \"fc7_3\", \"fc8_1\", \"prob_1\"]\n }\n \n\n InputSpecs = Interface(model=input_model, mappings=random_map, platforms=platforms)\n #cppname, NodesList, ComputingNodes\n ### Generate Cpp Files for Multinode-Inference.\n GenerateCode = EngineCode(\n CppName = \"./models/multinode\",\n Platforms = InputSpecs.platforms,\n NodesList = InputSpecs.nodes,\n ComputingNodes = InputSpecs.computingnodes,\n ValueInfos = InputSpecs.value_map,\n Inputs = InputSpecs.inputs,\n Outputs = InputSpecs.outputs,\n Benchmark = False)\n\n# ...\n```\n\n \n\n[packaging guide]: https://packaging.python.org\n[distribution tutorial]: https://packaging.python.org/tutorials/packaging-projects/\n[src]: https://github.com/parrotsky/AutoDiCE\n[rst]: http://docutils.sourceforge.net/rst.html\n[md]: https://tools.ietf.org/html/rfc7764#section-3.5 \"CommonMark variant\"\n[md use]: https://packaging.python.org/specifications/core-metadata/#description-content-type-optional\n",
"bugtrack_url": null,
"license": "",
"summary": "Automated Distributed CNN inference at the Edge",
"version": "1.0.3.dev2",
"project_urls": {
"Bug Reports": "https://github.com/parrotsky/AutoDiCE/issues",
"Funding": "https://donate.pypi.org",
"Homepage": "https://github.com/parrotsky/AutoDiCE",
"Say Thanks!": "https://github.com/parrotsky/AutoDiCE",
"Source": "https://github.com/parrotsky/AutoDiCE"
},
"split_keywords": [
"codegeneration",
"deep learning",
"development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9431347b693d86854b5f380326b059d47112aa9ba4385a2155d2a012e5a9bac0",
"md5": "e5f13428b971821901edb7cb4a94562a",
"sha256": "60a7d75242797ef90c0f8805d2629fb0175ce07e0692c79e03815c3619909079"
},
"downloads": -1,
"filename": "autodice-1.0.3.dev2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e5f13428b971821901edb7cb4a94562a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.1, <4",
"size": 21395,
"upload_time": "2023-07-05T14:46:06",
"upload_time_iso_8601": "2023-07-05T14:46:06.315700Z",
"url": "https://files.pythonhosted.org/packages/94/31/347b693d86854b5f380326b059d47112aa9ba4385a2155d2a012e5a9bac0/autodice-1.0.3.dev2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cff08cbdcf1d703aab834f20e1e5d735e87c1448a5527cb8edef9ac7eafaa62a",
"md5": "7b6bf83e38be8a059fd10ee07b64a542",
"sha256": "5acbdcd808154dbb261fc33d46fb6fdd03cc9ce55e9bb5553a84274abd1c150e"
},
"downloads": -1,
"filename": "autodice-1.0.3.dev2.tar.gz",
"has_sig": false,
"md5_digest": "7b6bf83e38be8a059fd10ee07b64a542",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.1, <4",
"size": 23542,
"upload_time": "2023-07-05T14:46:08",
"upload_time_iso_8601": "2023-07-05T14:46:08.009197Z",
"url": "https://files.pythonhosted.org/packages/cf/f0/8cbdcf1d703aab834f20e1e5d735e87c1448a5527cb8edef9ac7eafaa62a/autodice-1.0.3.dev2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-05 14:46:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "parrotsky",
"github_project": "AutoDiCE",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "autodice"
}