Skip to main content

Automated Distributed CNN inference at the Edge

Project description

AutoDiCE Project.

The source for this AutoDiCE project is available here. Python Logo

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)

# ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autodice-1.0.3.dev2.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

autodice-1.0.3.dev2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file autodice-1.0.3.dev2.tar.gz.

File metadata

  • Download URL: autodice-1.0.3.dev2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/65.6.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for autodice-1.0.3.dev2.tar.gz
Algorithm Hash digest
SHA256 5acbdcd808154dbb261fc33d46fb6fdd03cc9ce55e9bb5553a84274abd1c150e
MD5 7b6bf83e38be8a059fd10ee07b64a542
BLAKE2b-256 cff08cbdcf1d703aab834f20e1e5d735e87c1448a5527cb8edef9ac7eafaa62a

See more details on using hashes here.

File details

Details for the file autodice-1.0.3.dev2-py3-none-any.whl.

File metadata

  • Download URL: autodice-1.0.3.dev2-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/65.6.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for autodice-1.0.3.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 60a7d75242797ef90c0f8805d2629fb0175ce07e0692c79e03815c3619909079
MD5 e5f13428b971821901edb7cb4a94562a
BLAKE2b-256 9431347b693d86854b5f380326b059d47112aa9ba4385a2155d2a012e5a9bac0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page