├── testing ├── json_test.py ├── README.md ├── yaml_test.py ├── test.yaml ├── example.py ├── resource_test.py ├── simple_test.py ├── int8_test.py ├── pype_test.py ├── n_worker_test.py ├── qsub_test.py ├── multiprocessing_test.py ├── multi_predict_test.py ├── basic_test.py ├── non_ray_multiprocessing_test.py ├── multi_model_test.py ├── utilization_test.py └── model_test.py ├── dkeras ├── config │ ├── __init__.py │ ├── process_config.py │ └── config.py ├── servers │ ├── __init__.py │ └── data_server.py ├── system │ ├── __init__.py │ ├── ray_profiler.py │ ├── sys_profiler.py │ └── hw_profiler.py ├── utils │ ├── __init__.py │ ├── temp_1567491337_8741772 │ │ └── worker_script │ ├── temp_1567491548_9361358 │ │ └── worker_script │ ├── sys_functions.py │ └── qsub_functions.py ├── workers │ ├── __init__.py │ └── worker.py ├── autoscaler │ ├── __init__.py │ └── autoscaler.py ├── benchmarks │ ├── __init__.py │ └── model_benchmark.py ├── .DS_Store ├── __init__.py └── worker.py ├── docs ├── source │ ├── data_parallelism.rst │ ├── getting_started.rst │ ├── model_config.rst │ ├── troubleshooting.rst │ ├── development_tips.rst │ ├── dkeras_api.rst │ ├── worker.rst │ ├── design.rst │ ├── data_server.rst │ ├── contact.rst │ ├── install.rst │ ├── basic.rst │ ├── multi_model.rst │ ├── profiling.rst │ ├── why.rst │ ├── index.rst │ └── conf.py ├── build │ ├── html │ │ ├── _sources │ │ │ ├── getting_started.rst.txt │ │ │ ├── data_parallelism.rst.txt │ │ │ ├── model_config.rst.txt │ │ │ ├── troubleshooting.rst.txt │ │ │ ├── development_tips.rst.txt │ │ │ ├── dkeras_api.rst.txt │ │ │ ├── worker.rst.txt │ │ │ ├── design.rst.txt │ │ │ ├── model_api.rst.txt │ │ │ ├── data_server.rst.txt │ │ │ ├── contact.rst.txt │ │ │ ├── install.rst.txt │ │ │ ├── basic.rst.txt │ │ │ ├── multi_model.rst.txt │ │ │ ├── profiling.rst.txt │ │ │ ├── why.rst.txt │ │ │ └── index.rst.txt │ │ ├── _static │ │ │ ├── custom.css │ │ │ ├── file.png │ │ │ ├── minus.png │ │ │ ├── plus.png │ │ │ ├── dkeras_logo.png │ │ │ ├── fonts │ │ │ │ ├── Lato-Bold.ttf │ │ │ │ ├── Inconsolata.ttf │ │ │ │ ├── Lato-Regular.ttf │ │ │ │ ├── Lato │ │ │ │ │ ├── lato-bold.eot │ │ │ │ │ ├── lato-bold.ttf │ │ │ │ │ ├── lato-bold.woff │ │ │ │ │ ├── lato-bold.woff2 │ │ │ │ │ ├── lato-italic.eot │ │ │ │ │ ├── lato-italic.ttf │ │ │ │ │ ├── lato-italic.woff │ │ │ │ │ ├── lato-italic.woff2 │ │ │ │ │ ├── lato-regular.eot │ │ │ │ │ ├── lato-regular.ttf │ │ │ │ │ ├── lato-regular.woff │ │ │ │ │ ├── lato-regular.woff2 │ │ │ │ │ ├── lato-bolditalic.eot │ │ │ │ │ ├── lato-bolditalic.ttf │ │ │ │ │ ├── lato-bolditalic.woff │ │ │ │ │ └── lato-bolditalic.woff2 │ │ │ │ ├── Inconsolata-Bold.ttf │ │ │ │ ├── RobotoSlab-Bold.ttf │ │ │ │ ├── Inconsolata-Regular.ttf │ │ │ │ ├── RobotoSlab-Regular.ttf │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ ├── fontawesome-webfont.woff2 │ │ │ │ └── RobotoSlab │ │ │ │ │ ├── roboto-slab-v7-bold.eot │ │ │ │ │ ├── roboto-slab-v7-bold.ttf │ │ │ │ │ ├── roboto-slab-v7-bold.woff │ │ │ │ │ ├── roboto-slab-v7-bold.woff2 │ │ │ │ │ ├── roboto-slab-v7-regular.eot │ │ │ │ │ ├── roboto-slab-v7-regular.ttf │ │ │ │ │ ├── roboto-slab-v7-regular.woff │ │ │ │ │ └── roboto-slab-v7-regular.woff2 │ │ │ ├── documentation_options.js │ │ │ ├── css │ │ │ │ └── badge_only.css │ │ │ ├── js │ │ │ │ └── theme.js │ │ │ └── pygments.css │ │ ├── .DS_Store │ │ ├── objects.inv │ │ ├── _images │ │ │ ├── profile.png │ │ │ ├── dkeras_design.png │ │ │ └── inference_comparison.png │ │ ├── .buildinfo │ │ ├── searchindex.js │ │ ├── data_parallelism.html │ │ ├── getting_started.html │ │ ├── py-modindex.html │ │ ├── model_config.html │ │ ├── design.html │ │ ├── data_server.html │ │ ├── search.html │ │ ├── why.html │ │ ├── worker.html │ │ ├── contact.html │ │ ├── development_tips.html │ │ ├── troubleshooting.html │ │ ├── install.html │ │ ├── basic.html │ │ └── genindex.html │ ├── .DS_Store │ └── doctrees │ │ ├── basic.doctree │ │ ├── index.doctree │ │ ├── why.doctree │ │ ├── contact.doctree │ │ ├── design.doctree │ │ ├── install.doctree │ │ ├── worker.doctree │ │ ├── dkeras_api.doctree │ │ ├── environment.pickle │ │ ├── model_api.doctree │ │ ├── profiling.doctree │ │ ├── data_server.doctree │ │ ├── model_config.doctree │ │ ├── multi_model.doctree │ │ ├── getting_started.doctree │ │ ├── troubleshooting.doctree │ │ ├── data_parallelism.doctree │ │ └── development_tips.doctree ├── .DS_Store ├── Makefile └── make.bat ├── requirements.txt ├── .DS_Store ├── .idea ├── .DS_Store ├── encodings.xml ├── misc.xml ├── vcs.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml ├── dkeras.iml └── workspace.xml ├── assets ├── .DS_Store ├── profile.png ├── dkeras_logo.png ├── perf_graph.PNG ├── dkeras_design.png └── inference_comparison.png ├── setup.py ├── cleanup.py ├── LICENSE └── README.md /testing/json_test.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/config/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/servers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/system/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/workers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/autoscaler/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dkeras/benchmarks/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/data_parallelism.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/getting_started.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/model_config.rst: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/build/html/_sources/getting_started.rst.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/build/html/_sources/data_parallelism.rst.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/build/html/_sources/model_config.rst.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ray 2 | argparse 3 | psutil 4 | numpy 5 | keras -------------------------------------------------------------------------------- /docs/source/troubleshooting.rst: -------------------------------------------------------------------------------- 1 | Troubleshooting 2 | =============== -------------------------------------------------------------------------------- /docs/source/development_tips.rst: -------------------------------------------------------------------------------- 1 | Development Tips 2 | ================ -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/.DS_Store -------------------------------------------------------------------------------- /docs/build/html/_sources/troubleshooting.rst.txt: -------------------------------------------------------------------------------- 1 | Troubleshooting 2 | =============== -------------------------------------------------------------------------------- /docs/build/html/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* This file intentionally left blank. */ 2 | -------------------------------------------------------------------------------- /.idea/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/.idea/.DS_Store -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/.DS_Store -------------------------------------------------------------------------------- /docs/build/html/_sources/development_tips.rst.txt: -------------------------------------------------------------------------------- 1 | Development Tips 2 | ================ -------------------------------------------------------------------------------- /assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/assets/.DS_Store -------------------------------------------------------------------------------- /assets/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/assets/profile.png -------------------------------------------------------------------------------- /dkeras/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/dkeras/.DS_Store -------------------------------------------------------------------------------- /docs/build/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/.DS_Store -------------------------------------------------------------------------------- /assets/dkeras_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/assets/dkeras_logo.png -------------------------------------------------------------------------------- /assets/perf_graph.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/assets/perf_graph.PNG -------------------------------------------------------------------------------- /assets/dkeras_design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/assets/dkeras_design.png -------------------------------------------------------------------------------- /docs/build/html/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/.DS_Store -------------------------------------------------------------------------------- /docs/source/dkeras_api.rst: -------------------------------------------------------------------------------- 1 | dKeras API 2 | ========== 3 | 4 | .. autoclass:: dkeras.dKeras 5 | :members: -------------------------------------------------------------------------------- /docs/build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/objects.inv -------------------------------------------------------------------------------- /docs/source/worker.rst: -------------------------------------------------------------------------------- 1 | Worker 2 | ====== 3 | 4 | .. autoclass:: dkeras.workers.worker.worker_task 5 | :members: -------------------------------------------------------------------------------- /assets/inference_comparison.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/assets/inference_comparison.png -------------------------------------------------------------------------------- /dkeras/utils/temp_1567491337_8741772/worker_script: -------------------------------------------------------------------------------- 1 | 2 | ray start --redis-address=10.212.62.88:33799 3 | sleep 3600 4 | -------------------------------------------------------------------------------- /dkeras/utils/temp_1567491548_9361358/worker_script: -------------------------------------------------------------------------------- 1 | 2 | ray start --redis-address=10.212.62.88:33772 3 | sleep 3600 4 | -------------------------------------------------------------------------------- /docs/build/doctrees/basic.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/basic.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/why.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/why.doctree -------------------------------------------------------------------------------- /docs/build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/file.png -------------------------------------------------------------------------------- /docs/build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/minus.png -------------------------------------------------------------------------------- /docs/build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/plus.png -------------------------------------------------------------------------------- /docs/build/doctrees/contact.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/contact.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/design.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/design.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/install.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/install.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/worker.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/worker.doctree -------------------------------------------------------------------------------- /docs/build/html/_images/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_images/profile.png -------------------------------------------------------------------------------- /docs/build/html/_sources/dkeras_api.rst.txt: -------------------------------------------------------------------------------- 1 | dKeras API 2 | ========== 3 | 4 | .. autoclass:: dkeras.dKeras 5 | :members: -------------------------------------------------------------------------------- /docs/source/design.rst: -------------------------------------------------------------------------------- 1 | Design 2 | ====== 3 | 4 | .. image:: ../../assets/dkeras_design.png 5 | :alt: Inference Comparison -------------------------------------------------------------------------------- /docs/build/doctrees/dkeras_api.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/dkeras_api.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/build/doctrees/model_api.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/model_api.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/profiling.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/profiling.doctree -------------------------------------------------------------------------------- /docs/build/html/_sources/worker.rst.txt: -------------------------------------------------------------------------------- 1 | Worker 2 | ====== 3 | 4 | .. autoclass:: dkeras.workers.worker.worker_task 5 | :members: -------------------------------------------------------------------------------- /docs/build/doctrees/data_server.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/data_server.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/model_config.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/model_config.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/multi_model.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/multi_model.doctree -------------------------------------------------------------------------------- /docs/build/html/_static/dkeras_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/dkeras_logo.png -------------------------------------------------------------------------------- /docs/build/doctrees/getting_started.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/getting_started.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/troubleshooting.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/troubleshooting.doctree -------------------------------------------------------------------------------- /docs/build/html/_images/dkeras_design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_images/dkeras_design.png -------------------------------------------------------------------------------- /docs/build/html/_sources/design.rst.txt: -------------------------------------------------------------------------------- 1 | Design 2 | ====== 3 | 4 | .. image:: ../../assets/dkeras_design.png 5 | :alt: Inference Comparison -------------------------------------------------------------------------------- /docs/build/html/_sources/model_api.rst.txt: -------------------------------------------------------------------------------- 1 | dKeras Model API 2 | ================ 3 | 4 | .. autoclass:: dkeras.dKeras 5 | :members: 6 | -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /docs/source/data_server.rst: -------------------------------------------------------------------------------- 1 | Data Server 2 | =========== 3 | 4 | .. autoclass:: dkeras.servers.data_server.DataServer 5 | :members: 6 | -------------------------------------------------------------------------------- /docs/build/doctrees/data_parallelism.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/data_parallelism.doctree -------------------------------------------------------------------------------- /docs/build/doctrees/development_tips.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/doctrees/development_tips.doctree -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Inconsolata.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Inconsolata.ttf -------------------------------------------------------------------------------- /testing/README.md: -------------------------------------------------------------------------------- 1 | # dKeras Tests 2 | 3 | ## ResNet50 Test 4 | 5 | ``` bash 6 | python resnet50_test.py --n_workers=20 --n_data=2000 7 | ``` 8 | -------------------------------------------------------------------------------- /testing/yaml_test.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | 3 | with open('test.yaml', 'r') as f: 4 | doc = yaml.load(f, Loader=yaml.FullLoader) 5 | print(doc) -------------------------------------------------------------------------------- /dkeras/autoscaler/autoscaler.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division -------------------------------------------------------------------------------- /dkeras/system/ray_profiler.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division -------------------------------------------------------------------------------- /docs/build/html/_images/inference_comparison.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_images/inference_comparison.png -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bold.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bold.ttf -------------------------------------------------------------------------------- /docs/build/html/_sources/data_server.rst.txt: -------------------------------------------------------------------------------- 1 | Data Server 2 | =========== 3 | 4 | .. autoclass:: dkeras.servers.data_server.DataServer 5 | :members: 6 | -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Inconsolata-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Inconsolata-Bold.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bold.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bold.woff2 -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-italic.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-italic.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab-Bold.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-italic.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-italic.woff2 -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-regular.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-regular.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-regular.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-regular.woff2 -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab-Regular.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bolditalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bolditalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2 -------------------------------------------------------------------------------- /dkeras/__init__.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | #-*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | from dkeras.dkeras import dKeras -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff -------------------------------------------------------------------------------- /docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkeras-project/dkeras/HEAD/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /testing/test.yaml: -------------------------------------------------------------------------------- 1 | model1: 2 | file: None 3 | CPUs: 1 4 | GPUs: 0 5 | n_workers: 4 6 | ip_address: 192.168.0.102 7 | model2: 8 | file: None 9 | CPUs: 4 10 | GPUs: 0 11 | n_workers: 2 12 | ip_address: 192.168.0.102 -------------------------------------------------------------------------------- /docs/build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 65a395df7b8ec435b66a3ace53131695 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/source/contact.rst: -------------------------------------------------------------------------------- 1 | Contact 2 | ======= 3 | 4 | The fastest way to get help with any issues with dKeras is through the official GitHub 5 | repository: 6 | 7 | `dKeras GitHub Repository `_ 8 | 9 | The official email for the dKeras project is dkerasproject@gmail.com. -------------------------------------------------------------------------------- /dkeras/system/sys_profiler.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | import keras 8 | 9 | 10 | class SystemProfiler(object): 11 | 12 | def __init__(self): 13 | pass 14 | 15 | def verify_keras(self): 16 | pass -------------------------------------------------------------------------------- /docs/build/html/_sources/contact.rst.txt: -------------------------------------------------------------------------------- 1 | Contact 2 | ======= 3 | 4 | The fastest way to get help with any issues with dKeras is through the official GitHub 5 | repository: 6 | 7 | `dKeras GitHub Repository `_ 8 | 9 | The official email for the dKeras project is dkerasproject@gmail.com. -------------------------------------------------------------------------------- /testing/example.py: -------------------------------------------------------------------------------- 1 | # Ideas 2 | """ 3 | server = dkeras.DataServer() 4 | 5 | model1.link(model3) 6 | 7 | model1.postprocess = lambda z: np.float16(z) 8 | 9 | server = model1 + model2 + model3 10 | 11 | server.add(camera1, dest=('m1', 'm2')) 12 | 13 | server.add_address('192.168.1.42') 14 | """ 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /testing/resource_test.py: -------------------------------------------------------------------------------- 1 | import time 2 | import ray 3 | 4 | 5 | @ray.remote(num_cpus=0.1) 6 | def test(): 7 | time.sleep(10) 8 | return 1 9 | 10 | 11 | def main(): 12 | ray.init() 13 | 14 | workers = [test.remote() for _ in range(40)] 15 | print(ray.get(workers)) 16 | 17 | 18 | if __name__ == "__main__": 19 | main() 20 | -------------------------------------------------------------------------------- /docs/build/html/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | var DOCUMENTATION_OPTIONS = { 2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), 3 | VERSION: '0.0.1', 4 | LANGUAGE: 'None', 5 | COLLAPSE_INDEX: false, 6 | FILE_SUFFIX: '.html', 7 | HAS_SOURCE: true, 8 | SOURCELINK_SUFFIX: '.txt', 9 | NAVIGATION_WITH_KEYS: false 10 | }; -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from distutils.core import setup 4 | from setuptools import find_packages 5 | 6 | setup(name='dkeras', 7 | version='0.01', 8 | description='Distributed Keras Engine', 9 | author='Stephen Offer', 10 | author_email='offerstephen@gmail.com', 11 | url='https://github.com/dkeras-project/dkeras/', 12 | packages=find_packages(), 13 | ) 14 | -------------------------------------------------------------------------------- /docs/source/install.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ************ 3 | 4 | dKeras can be installed either through PyPI or from source: 5 | 6 | Install from PyPI 7 | ----------------- 8 | 9 | *dKeras is currently not available on PyPI, install from source instead* 10 | 11 | >>> pip install dkeras 12 | 13 | Install from Source 14 | ------------------- 15 | 16 | >>> git clone https://github.com/dkeras-project/dkeras.git 17 | >>> cd dkeras 18 | >>> pip install -e . 19 | 20 | -------------------------------------------------------------------------------- /docs/build/html/_sources/install.rst.txt: -------------------------------------------------------------------------------- 1 | Installation 2 | ************ 3 | 4 | dKeras can be installed either through PyPI or from source: 5 | 6 | Install from PyPI 7 | ----------------- 8 | 9 | *dKeras is currently not available on PyPI, install from source instead* 10 | 11 | >>> pip install dkeras 12 | 13 | Install from Source 14 | ------------------- 15 | 16 | >>> git clone https://github.com/dkeras-project/dkeras.git 17 | >>> cd dkeras 18 | >>> pip install -e . 19 | 20 | -------------------------------------------------------------------------------- /testing/simple_test.py: -------------------------------------------------------------------------------- 1 | from tensorflow.keras.applications import ResNet50 2 | from dkeras import dKeras 3 | import numpy as np 4 | import ray 5 | 6 | ray.init() 7 | 8 | data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 9 | 10 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=4) 11 | preds = model.predict(data) 12 | ray.timeline('test') 13 | 14 | 15 | """ 16 | int8: 17 | 155.15053375276426 18 | 19 | 6.444483995437622 155.17146147122887 20 | 21 | """ -------------------------------------------------------------------------------- /testing/int8_test.py: -------------------------------------------------------------------------------- 1 | from tensorflow.keras.applications import ResNet50 2 | from dkeras import dKeras 3 | import numpy as np 4 | import time 5 | import ray 6 | 7 | ray.init() 8 | 9 | n_data = 100 10 | data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 11 | 12 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=4) 13 | 14 | start_time = time.time() 15 | preds = model.predict(data, int8_cvrt=True) 16 | elapsed = time.time() - start_time 17 | print(elapsed, n_data/elapsed) -------------------------------------------------------------------------------- /testing/pype_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | #-*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | import pype 8 | import ray 9 | 10 | from tensorflow.keras.applications import ResNet50 11 | 12 | def main(): 13 | pype.init_ray() 14 | server = pype.Server.remote() 15 | server.add.remote('data', use_locking=False) 16 | server.add.remote('weights', use_locking=False) 17 | 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/dkeras.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /docs/source/basic.rst: -------------------------------------------------------------------------------- 1 | Basic Inference Example 2 | ======================= 3 | 4 | dKeras maintains the same API as Keras, the only differences are the addition 5 | of functions to maintain distributed systems and arguements. 6 | 7 | .. code-block:: python 8 | 9 | from tensorflow.keras.applications import ResNet50 10 | from dkeras import dKeras 11 | import numpy as np 12 | 13 | data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 14 | 15 | model = dKeras(ResNet50, wait_for_workers=True, n_workers=4) 16 | preds = model.predict(data) 17 | -------------------------------------------------------------------------------- /docs/build/html/_sources/basic.rst.txt: -------------------------------------------------------------------------------- 1 | Basic Inference Example 2 | ======================= 3 | 4 | dKeras maintains the same API as Keras, the only differences are the addition 5 | of functions to maintain distributed systems and arguements. 6 | 7 | .. code-block:: python 8 | 9 | from tensorflow.keras.applications import ResNet50 10 | from dkeras import dKeras 11 | import numpy as np 12 | 13 | data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 14 | 15 | model = dKeras(ResNet50, wait_for_workers=True, n_workers=4) 16 | preds = model.predict(data) 17 | -------------------------------------------------------------------------------- /testing/n_worker_test.py: -------------------------------------------------------------------------------- 1 | from tensorflow.keras.applications import ResNet50 2 | from dkeras import dKeras 3 | import numpy as np 4 | import time 5 | import ray 6 | 7 | ray.init() 8 | data = np.random.uniform(-1, 1, (1000, 224, 224, 3)) 9 | 10 | for i in range(1, 51): 11 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=i) 12 | 13 | start_time = time.time() 14 | preds = model.predict(data) 15 | elapsed = time.time() - start_time 16 | 17 | model.close() 18 | print("{}\n{} Workers\tTime: {}\tFPS: {}".format('-' * 80, i, elapsed, 1000 / elapsed)) 19 | time.sleep(3) 20 | -------------------------------------------------------------------------------- /docs/source/multi_model.rst: -------------------------------------------------------------------------------- 1 | Multiple Model Inference 2 | ======================== 3 | 4 | .. code-block:: python 5 | 6 | from tensorflow.keras.applications import ResNet50, MobileNet 7 | from dkeras import dKeras 8 | import numpy as np 9 | import ray 10 | 11 | ray.init() 12 | model1 = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=3) 13 | model2 = dKeras(MobileNet, weights='imagenet', wait_for_workers=True, n_workers=3) 14 | 15 | test_data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 16 | 17 | model1.predict(test_data) 18 | model2.predict(test_data) 19 | 20 | model1.close() 21 | model2.close() 22 | 23 | -------------------------------------------------------------------------------- /docs/build/html/_sources/multi_model.rst.txt: -------------------------------------------------------------------------------- 1 | Multiple Model Inference 2 | ======================== 3 | 4 | .. code-block:: python 5 | 6 | from tensorflow.keras.applications import ResNet50, MobileNet 7 | from dkeras import dKeras 8 | import numpy as np 9 | import ray 10 | 11 | ray.init() 12 | model1 = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=3) 13 | model2 = dKeras(MobileNet, weights='imagenet', wait_for_workers=True, n_workers=3) 14 | 15 | test_data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 16 | 17 | model1.predict(test_data) 18 | model2.predict(test_data) 19 | 20 | model1.close() 21 | model2.close() 22 | 23 | -------------------------------------------------------------------------------- /testing/qsub_test.py: -------------------------------------------------------------------------------- 1 | from tensorflow.keras.applications import ResNet50 2 | from dkeras import dKeras 3 | from dkeras.utils.qsub_functions import init_pbs_ray 4 | import numpy as np 5 | import time 6 | import ray 7 | 8 | init_pbs_ray() 9 | print(ray.nodes()) 10 | 11 | data = np.random.uniform(-1, 1, (10000, 224, 224, 3)) 12 | 13 | start_time = time.time() 14 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=500) 15 | elapsed = time.time() - start_time 16 | 17 | print("Workers initialized after {}".format(elapsed)) 18 | 19 | start_time = time.time() 20 | preds = model.predict(data) 21 | elapsed = time.time() - start_time 22 | 23 | print("Preds after {}".format(elapsed)) 24 | -------------------------------------------------------------------------------- /cleanup.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | #-*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | import os 8 | 9 | def main(): 10 | # OSX Cleanup 11 | dirpath = os.path.dirname(os.path.abspath(__file__)) 12 | for root, dirs, files in os.walk(dirpath): 13 | for d in dirs: 14 | if d in ['__pycache__']: 15 | path = os.path.join(root, d) 16 | 17 | print("Removing: {}".format(path)) 18 | os.system('rm -rf {}'.format(path)) 19 | 20 | print("Removing dKeras.egg-info") 21 | os.system('rm -rf {}'.format(os.path.join(dirpath,'dKeras.egg-info'))) 22 | 23 | 24 | if __name__ == "__main__": 25 | main() -------------------------------------------------------------------------------- /docs/source/profiling.rst: -------------------------------------------------------------------------------- 1 | Profiling 2 | ========= 3 | 4 | .. code-block:: python 5 | 6 | from tensorflow.keras.applications import ResNet50 7 | from dkeras import dKeras 8 | import numpy as np 9 | import ray 10 | 11 | ray.init() 12 | 13 | data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 14 | 15 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=4) 16 | preds = model.predict(data) 17 | ray.timeline('output') 18 | 19 | To view the trace, open Chrome and go to chrome://tracing and open the output file and 20 | the Chrome tracing tool will show a timeline of the worker processes. 21 | 22 | .. image:: ../../assets/profile.png 23 | :alt: Inference Comparison -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/build/html/_sources/profiling.rst.txt: -------------------------------------------------------------------------------- 1 | Profiling 2 | ========= 3 | 4 | .. code-block:: python 5 | 6 | from tensorflow.keras.applications import ResNet50 7 | from dkeras import dKeras 8 | import numpy as np 9 | import ray 10 | 11 | ray.init() 12 | 13 | data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 14 | 15 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=4) 16 | preds = model.predict(data) 17 | ray.timeline('output') 18 | 19 | To view the trace, open Chrome and go to chrome://tracing and open the output file and 20 | the Chrome tracing tool will show a timeline of the worker processes. 21 | 22 | .. image:: ../../assets/profile.png 23 | :alt: Inference Comparison -------------------------------------------------------------------------------- /testing/multiprocessing_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import time 9 | 10 | import numpy as np 11 | from tensorflow.keras.applications import ResNet50 12 | 13 | from dkeras import dKeras 14 | import ray 15 | 16 | 17 | def main(): 18 | 19 | n_data = 80 20 | test_data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 21 | model = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=4) 22 | 23 | start_time = time.time() 24 | preds = model.predict(test_data, use_multiprocessing=True, multiprocessing_workers=4) 25 | elapsed = time.time() - start_time 26 | 27 | model.close() 28 | 29 | 30 | if __name__ == "__main__": 31 | main() 32 | -------------------------------------------------------------------------------- /dkeras/utils/sys_functions.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import socket 9 | 10 | from netifaces import AF_INET, ifaddresses, interfaces 11 | 12 | 13 | def get_port(): 14 | tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 15 | tcp.bind(('', 0)) 16 | addr, port = tcp.getsockname() 17 | tcp.close() 18 | return addr, port 19 | 20 | 21 | def get_addr(iface_name): 22 | for ifaceName in interfaces(): 23 | addresses = [i['addr'] for i in 24 | ifaddresses(ifaceName).setdefault(AF_INET, 25 | [{'addr': 'No IP addr'}])] 26 | if ifaceName == iface_name: 27 | return addresses 28 | 29 | -------------------------------------------------------------------------------- /docs/source/why.rst: -------------------------------------------------------------------------------- 1 | Why Use dKeras? 2 | --------------- 3 | 4 | Distributed deep learning can be essential for production systems where you 5 | need fast inference but don't want expensive hardware accelerators or when 6 | researchers need to train large models made up of distributable parts. 7 | 8 | This becomes a challenge for developers because they'll need expertise in not 9 | only deep learning but also distributed systems. A production team might also 10 | need a machine learning optimization engineer to use neural network 11 | optimizers in terms of precision changes, layer fusing, or other techniques. 12 | 13 | Distributed inference is a simple way to get better inference FPS. The graph 14 | below shows how non-optimized, out-of-box models from default frameworks can 15 | be quickly sped up through data parallelism: -------------------------------------------------------------------------------- /docs/build/html/_sources/why.rst.txt: -------------------------------------------------------------------------------- 1 | Why Use dKeras? 2 | --------------- 3 | 4 | Distributed deep learning can be essential for production systems where you 5 | need fast inference but don't want expensive hardware accelerators or when 6 | researchers need to train large models made up of distributable parts. 7 | 8 | This becomes a challenge for developers because they'll need expertise in not 9 | only deep learning but also distributed systems. A production team might also 10 | need a machine learning optimization engineer to use neural network 11 | optimizers in terms of precision changes, layer fusing, or other techniques. 12 | 13 | Distributed inference is a simple way to get better inference FPS. The graph 14 | below shows how non-optimized, out-of-box models from default frameworks can 15 | be quickly sped up through data parallelism: -------------------------------------------------------------------------------- /dkeras/config/process_config.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | 8 | import dkeras.config.config as config 9 | 10 | 11 | type_dict = { 12 | 'CPU_OVERLOAD_LIMIT': float, 13 | 'N_CPUS_PER_SERVER': int, 14 | 'N_CPUS_PER_WORKER': int 15 | } 16 | 17 | 18 | def verify_types(): 19 | """ 20 | 21 | :return: None 22 | """ 23 | local_vars = list(locals().keys()) 24 | config_vars = dir(config) 25 | 26 | for v_name in type_dict.keys(): 27 | var = config.__dict__[v_name] 28 | if not isinstance(var, type_dict[v_name]): 29 | raise TypeError( 30 | "Config variable should be type: {}, not type: {}".format( 31 | type_dict[v], type(var).__name__)) 32 | 33 | 34 | if __name__ == "__main__": 35 | verify_types() -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | -------------------------------------------------------------------------------- /testing/multi_predict_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import time 9 | 10 | import numpy as np 11 | from tensorflow.keras.applications import ResNet50 12 | 13 | from dkeras import dKeras 14 | import ray 15 | 16 | 17 | def main(): 18 | ray.init() 19 | n_data = 20 20 | model = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=3) 21 | 22 | for i in range(5): 23 | test_data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 24 | start_time = time.time() 25 | preds_1 = model.predict(test_data) 26 | elapsed = time.time() - start_time 27 | print(np.asarray(preds_1).shape) 28 | print("Time elapsed: {}\nFPS: {}".format(elapsed, n_data / elapsed)) 29 | 30 | 31 | 32 | model.close() 33 | 34 | 35 | 36 | if __name__ == "__main__": 37 | main() 38 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /dkeras/config/config.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | 8 | # ----------------------------------------------------------------------------- 9 | # Remote Worker Functions Configuration 10 | # ----------------------------------------------------------------------------- 11 | DEFAULT_N_WORKERS = 4 12 | WORKER_WAIT_TIME = 5e-3 13 | WORKER_INFERENCE_BATCH_SIZE = 250 14 | 15 | # ----------------------------------------------------------------------------- 16 | # Hardware Resource Configuration 17 | # ----------------------------------------------------------------------------- 18 | N_CPUS_PER_SERVER = None 19 | N_CPUS_PER_WORKER = None 20 | N_GPUS_PER_WORKER = None 21 | 22 | # ----------------------------------------------------------------------------- 23 | # Autoscaler Variables 24 | # ----------------------------------------------------------------------------- 25 | CPU_OVERLOAD_LIMIT = 0.8 -------------------------------------------------------------------------------- /dkeras/system/hw_profiler.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | from dkeras.config import config 8 | import psutil 9 | 10 | 11 | class HWProfiler(object): 12 | 13 | def __init__(self): 14 | pass 15 | 16 | @staticmethod 17 | def n_workers(n_servers: int) -> int: 18 | """ 19 | 20 | :param n_servers: 21 | :return: 22 | """ 23 | n_cpus = psutil.cpu_count() 24 | used = 1 + n_servers * config.N_CPUS_PER_SERVER 25 | if used > (n_cpus - config.N_CPUS_PER_WORKER): 26 | raise UserWarning( 27 | "CPU configurations too high for {} CPUs".format(n_cpus)) 28 | return int((n_cpus - used) / config.N_CPUS_PER_WORKER) 29 | 30 | @staticmethod 31 | def is_overloaded(): 32 | """ 33 | 34 | :return: 35 | """ 36 | return psutil.cpu_percent() > config.CPU_OVERLOAD_LIMIT 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Stephen Offer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /testing/basic_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import time 9 | 10 | import numpy as np 11 | from tensorflow.keras.applications import ResNet50 12 | 13 | from dkeras import dKeras 14 | import ray 15 | 16 | 17 | def main(): 18 | ray.init(object_store_memory=4000000000) 19 | n_data = 80 20 | test_data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 21 | model = dKeras(ResNet50, weights='imagenet', init_ray=False, wait_for_workers=True, n_workers=4) 22 | 23 | start_time = time.time() 24 | preds = model.predict(test_data) 25 | elapsed = time.time() - start_time 26 | 27 | model.close() 28 | 29 | time.sleep(2) 30 | # 31 | # model = ResNet50(weights='imagenet') 32 | # preds2 = model.predict(test_data) 33 | # 34 | # # for i in range(n_data): 35 | # # for j,n in enumerate(preds[i]): 36 | # # print(n, preds2[i][j]) 37 | # # print('-'*80) 38 | 39 | print("Time elapsed: {}\nFPS: {}".format(elapsed, n_data / elapsed)) 40 | 41 | 42 | if __name__ == "__main__": 43 | main() 44 | -------------------------------------------------------------------------------- /testing/non_ray_multiprocessing_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import time 9 | 10 | import numpy as np 11 | from tensorflow.keras.applications import ResNet50 12 | 13 | 14 | def main(): 15 | n_data = 1000 16 | test_data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 17 | model = ResNet50() 18 | 19 | start_time = time.time() 20 | preds = model.predict(test_data, use_multiprocessing=True, multiprocessing_workers=4) 21 | elapsed = time.time() - start_time 22 | print("{}\nMultiprocessing: Elapsed {}\tFPS: {}".format('='*80, elapsed, n_data/elapsed)) 23 | 24 | start_time = time.time() 25 | preds = model.predict(test_data) 26 | elapsed = time.time() - start_time 27 | print("{}\nSerial: Elapsed {}\tFPS: {}".format('=' * 80, elapsed, n_data / elapsed)) 28 | 29 | 30 | if __name__ == "__main__": 31 | main() 32 | 33 | """ 34 | workers = 4 35 | ================================================================================ 36 | Multiprocessing: Elapsed 108.5789122581482 FPS: 9.209891490002066 37 | ================================================================================ 38 | Serial: Elapsed 103.73267221450806 FPS: 9.640164266973738 39 | 40 | 41 | """ 42 | -------------------------------------------------------------------------------- /testing/multi_model_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import numpy as np 9 | from tensorflow.keras.applications import ResNet50, MobileNet 10 | 11 | from dkeras import dKeras 12 | import ray 13 | 14 | 15 | def main(): 16 | """ 17 | Test out using multiple models at the same time, this case is running 18 | ResNet50 and MobileNet 19 | """ 20 | ray.init() 21 | n_data = 20 22 | 23 | model1 = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=3) 24 | model2 = dKeras(MobileNet, weights='imagenet', wait_for_workers=True, n_workers=3) 25 | 26 | test_data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 27 | 28 | model1.predict(test_data) 29 | model2.predict(test_data) 30 | 31 | model1.close() 32 | model2.close() 33 | 34 | 35 | if __name__ == "__main__": 36 | main() 37 | 38 | ray.init() 39 | n_data = 20 40 | 41 | model1 = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=3) 42 | model2 = dKeras(MobileNet, weights='imagenet', wait_for_workers=True, n_workers=3) 43 | 44 | test_data = np.random.uniform(-1, 1, (n_data, 224, 224, 3)) 45 | 46 | model1.predict(test_data) 47 | model2.predict(test_data) 48 | 49 | model1.close() 50 | model2.close() 51 | -------------------------------------------------------------------------------- /dkeras/worker.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | import numpy as np 8 | import time 9 | import ray 10 | 11 | import dkeras.config.config as config 12 | 13 | 14 | @ray.remote(num_cpus=cpus_per_worker, num_gpus=gpus_per_worker) 15 | def worker_task(weights, ds, make_model): 16 | """ 17 | Worker function loop 18 | 19 | :param weights: 20 | :param ds: 21 | :param make_model: 22 | :return: 23 | """ 24 | worker_model = make_model() 25 | worker_model.set_weights(weights) 26 | while True: 27 | packet_id, data = ray.get(ds.pull.remote()) 28 | print("-"*80) 29 | print("Packet id: ", packet_id) 30 | if packet_id == 'STOP': 31 | break 32 | if len(data) > 0: 33 | if packet_id == 'infer_float': 34 | data = np.asarray(data) 35 | results = worker_model.predict(data) 36 | ds.push.remote(results, packet_id) 37 | elif packet_id == 'infer_int8': 38 | print('-'*80) 39 | print("Recieved data!") 40 | data = np.asarray(data) 41 | data = np.float16(data/255) 42 | results = worker_model.predict(data) 43 | ds.push.remote(results, packet_id) 44 | else: 45 | time.sleep(config.WORKER_WAIT_TIME) 46 | -------------------------------------------------------------------------------- /testing/utilization_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | 8 | import multiprocessing as mp 9 | import time 10 | 11 | import matplotlib.pyplot as plt 12 | import numpy as np 13 | import psutil 14 | from tensorflow.keras.applications import ResNet50 15 | 16 | 17 | def run_predict(): 18 | test_data = np.random.uniform(-1, 1, (1000, 224, 224, 3)) 19 | model = ResNet50() 20 | time.sleep(1) 21 | model.predict(test_data) 22 | 23 | 24 | def monitor(target): 25 | worker_process = mp.Process(target=target) 26 | worker_process.start() 27 | #p = psutil.Process(worker_process.pid) 28 | time.sleep(1) 29 | # log cpu usage of `worker_process` every 10 ms 30 | cpu_percents = [] 31 | while worker_process.is_alive(): 32 | cpu_percents.append(psutil.cpu_percent(percpu=False)) 33 | time.sleep(1e-3) 34 | 35 | worker_process.join() 36 | return cpu_percents 37 | 38 | 39 | def main(): 40 | cpu_percents = monitor(target=run_predict) 41 | 42 | # Data for plotting 43 | t = np.asarray(range(len(cpu_percents))) 44 | cpu_percents = np.asarray(cpu_percents) 45 | 46 | for i in cpu_percents: 47 | print(i) 48 | 49 | # fig, ax = plt.subplots() 50 | # ax.plot(t, cpu_percents) 51 | # 52 | # ax.set(xlabel='time (ms)', ylabel='CPU utilization', 53 | # title='CPU utilization for ResNet50 Inference') 54 | # ax.grid() 55 | # 56 | # fig.savefig("test.png") 57 | 58 | 59 | if __name__ == "__main__": 60 | main() 61 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. dkeras documentation master file, created by 2 | sphinx-quickstart on Mon Aug 19 18:32:03 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | dKeras: Distributed Keras Engine 7 | ################################ 8 | 9 | **Make Keras faster with only one line of code.** 10 | ------------------------------------------------- 11 | 12 | dKeras is a distributed Keras engine that is built on top of 13 | `Ray `_. By wrapping dKeras around your 14 | original Keras model, it allows you to use many distributed deep learning 15 | techniques to automatically improve your system's performance. 16 | 17 | 18 | With an easy-to-use API and a backend framework that can be deployed from 19 | the laptop to the data center, dKeras simpilifies what used to be a complex 20 | and time-consuming process into only a few adjustments. 21 | 22 | Why Use dKeras? 23 | --------------- 24 | 25 | Distributed deep learning can be essential for production systems where you 26 | need fast inference but don't want expensive hardware accelerators or when 27 | researchers need to train large models made up of distributable parts. 28 | 29 | This becomes a challenge for developers because they'll need expertise in not 30 | only deep learning but also distributed systems. A production team might also 31 | need a machine learning optimization engineer to use neural network 32 | optimizers in terms of precision changes, layer fusing, or other techniques. 33 | 34 | Distributed inference is a simple way to get better inference FPS. The graph 35 | below shows how non-optimized, out-of-box models from default frameworks can 36 | be quickly sped up through data parallelism: 37 | 38 | .. image:: ../../assets/inference_comparison.png 39 | :alt: Inference Comparison 40 | 41 | .. toctree:: 42 | :maxdepth: 6 43 | :caption: About dKeras 44 | 45 | why 46 | 47 | install 48 | 49 | design 50 | 51 | getting_started 52 | 53 | .. toctree:: 54 | :maxdepth: 6 55 | :caption: The dKeras API 56 | 57 | dkeras_api 58 | 59 | data_server 60 | 61 | worker 62 | 63 | development_tips 64 | 65 | .. toctree:: 66 | :maxdepth: 6 67 | :caption: Examples 68 | 69 | basic 70 | 71 | multi_model 72 | 73 | .. toctree:: 74 | :maxdepth: 6 75 | :caption: Help 76 | 77 | troubleshooting 78 | 79 | profiling 80 | 81 | contact 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /docs/build/html/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. dkeras documentation master file, created by 2 | sphinx-quickstart on Mon Aug 19 18:32:03 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | dKeras: Distributed Keras Engine 7 | ################################ 8 | 9 | **Make Keras faster with only one line of code.** 10 | ------------------------------------------------- 11 | 12 | dKeras is a distributed Keras engine that is built on top of 13 | `Ray `_. By wrapping dKeras around your 14 | original Keras model, it allows you to use many distributed deep learning 15 | techniques to automatically improve your system's performance. 16 | 17 | 18 | With an easy-to-use API and a backend framework that can be deployed from 19 | the laptop to the data center, dKeras simpilifies what used to be a complex 20 | and time-consuming process into only a few adjustments. 21 | 22 | Why Use dKeras? 23 | --------------- 24 | 25 | Distributed deep learning can be essential for production systems where you 26 | need fast inference but don't want expensive hardware accelerators or when 27 | researchers need to train large models made up of distributable parts. 28 | 29 | This becomes a challenge for developers because they'll need expertise in not 30 | only deep learning but also distributed systems. A production team might also 31 | need a machine learning optimization engineer to use neural network 32 | optimizers in terms of precision changes, layer fusing, or other techniques. 33 | 34 | Distributed inference is a simple way to get better inference FPS. The graph 35 | below shows how non-optimized, out-of-box models from default frameworks can 36 | be quickly sped up through data parallelism: 37 | 38 | .. image:: ../../assets/inference_comparison.png 39 | :alt: Inference Comparison 40 | 41 | .. toctree:: 42 | :maxdepth: 6 43 | :caption: About dKeras 44 | 45 | why 46 | 47 | install 48 | 49 | design 50 | 51 | getting_started 52 | 53 | .. toctree:: 54 | :maxdepth: 6 55 | :caption: The dKeras API 56 | 57 | dkeras_api 58 | 59 | data_server 60 | 61 | worker 62 | 63 | development_tips 64 | 65 | .. toctree:: 66 | :maxdepth: 6 67 | :caption: Examples 68 | 69 | basic 70 | 71 | multi_model 72 | 73 | .. toctree:: 74 | :maxdepth: 6 75 | :caption: Help 76 | 77 | troubleshooting 78 | 79 | profiling 80 | 81 | contact 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # http://www.sphinx-doc.org/en/master/config 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | import dkeras 16 | 17 | sys.path.insert(0, os.path.dirname(os.path.dirname(dkeras.__file__))) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = 'dkeras' 23 | copyright = '2019, Stephen Offer' 24 | author = 'Stephen Offer' 25 | 26 | # The full version, including alpha/beta/rc tags 27 | release = '0.0.1' 28 | 29 | 30 | # -- General configuration --------------------------------------------------- 31 | 32 | # Add any Sphinx extension module names here, as strings. They can be 33 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 34 | # ones. 35 | extensions = ['sphinx.ext.autodoc', 36 | 'sphinx.ext.napoleon', 37 | 'sphinx_click.ext' 38 | ] 39 | 40 | 41 | # Add any paths that contain templates here, relative to this directory. 42 | templates_path = ['_templates'] 43 | 44 | # List of patterns, relative to source directory, that match files and 45 | # directories to ignore when looking for source files. 46 | # This pattern also affects html_static_path and html_extra_path. 47 | exclude_patterns = [] 48 | 49 | 50 | # -- Options for HTML output ------------------------------------------------- 51 | 52 | # The theme to use for HTML and HTML Help pages. See the documentation for 53 | # a list of builtin themes. 54 | # 55 | html_theme = 'sphinx_rtd_theme' 56 | 57 | html_logo = '../../assets/dkeras_logo.png' 58 | 59 | # Add any paths that contain custom static files (such as style sheets) here, 60 | # relative to this directory. They are copied after the builtin static files, 61 | # so a file named "default.css" will overwrite the builtin "default.css". 62 | html_static_path = ['_static'] 63 | 64 | html_theme_options = { 65 | 'canonical_url': '', 66 | # 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard 67 | 'logo_only': False, 68 | 'display_version': True, 69 | 'prev_next_buttons_location': 'bottom', 70 | 'style_external_links': False, 71 | 'style_nav_header_background': 'white', 72 | # Toc options 73 | 'collapse_navigation': True, 74 | 'sticky_navigation': True, 75 | 'navigation_depth': 4, 76 | 'includehidden': True, 77 | 'titles_only': False 78 | } 79 | -------------------------------------------------------------------------------- /docs/build/html/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} 2 | -------------------------------------------------------------------------------- /dkeras/utils/qsub_functions.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import print_function, division 7 | 8 | import os 9 | import subprocess 10 | import time 11 | 12 | import ray 13 | 14 | from dkeras.utils.sys_functions import get_port, get_addr 15 | 16 | 17 | def _cmd(cmd): 18 | return subprocess.check_output(cmd.split(' ')).decode() 19 | 20 | 21 | def _which_qsub(): 22 | return _cmd('which qsub').replace('\n', '') 23 | 24 | 25 | def _which_qstat(): 26 | return _cmd('which qstat').decode().replace('\n', '') 27 | 28 | 29 | def _which_qdel(): 30 | return _cmd('which qdel').decode().replace('\n', '') 31 | 32 | 33 | create_worker_script = """ 34 | ray start --redis-address={}:{} 35 | sleep {} 36 | """ 37 | 38 | 39 | @ray.remote 40 | def _get_n_nodes(): 41 | return len(ray.nodes()) 42 | 43 | 44 | def wait_for_workers(n_workers, timeout=300): 45 | start_time = time.time() 46 | print("Waiting for {} workers".format(n_workers)) 47 | while True: 48 | n_nodes = ray.get(_get_n_nodes.remote()) 49 | if n_nodes >= n_workers: 50 | return True 51 | if (start_time - time.time() >= timeout): 52 | return False 53 | 54 | 55 | def rm_existing_workers(qstat_path='qstat', qdel_path='qdel'): 56 | cmd = "{} | grep worker_script | cut - d ' ' -f1 | xargs {}".format( 57 | qstat_path, qdel_path) 58 | os.system(cmd) 59 | 60 | 61 | def init_pbs_ray(n_workers=3, rm_existing=True, iface_name='eno1', worker_time=3600, verbose=True): 62 | """ 63 | 64 | :param n_workers: 65 | :param rm_existing: 66 | :param iface_name: 67 | :param worker_time: 68 | :return: 69 | """ 70 | if ray.is_initialized(): 71 | if rm_existing: 72 | _cmd('ray stop') 73 | 74 | qsub_path = _which_qsub() 75 | qstat_path = _which_qstat() 76 | qdel_path = _which_qdel() 77 | 78 | # rm_existing_workers(qstat_path=qstat_path, qdel_path=qdel_path) 79 | rm_existing_workers() 80 | 81 | addresses = get_addr('eno1') 82 | addr = addresses[0] 83 | 84 | if verbose: 85 | print("Address: ", addr) 86 | if addr == 'No IP addr': 87 | raise Exception("Address not found for {}".format(iface_name)) 88 | 89 | port = get_port()[1] 90 | if verbose: 91 | print("Port ", port) 92 | print("ray start --head --redis-port={}".format(port)) 93 | _cmd('ray start --head --redis-port={}'.format(port)) 94 | 95 | temp_dir = 'temp_{}'.format('_'.join(str(time.time()).split('.'))) 96 | if not os.path.exists(temp_dir): 97 | os.mkdir(temp_dir) 98 | 99 | worker_file = os.path.join(temp_dir, 'worker_script') 100 | worker_script = create_worker_script.format(addr, port, worker_time) 101 | with open(worker_file, 'w') as f: 102 | f.write(worker_script) 103 | 104 | if verbose: 105 | print("Worker file ", worker_file) 106 | 107 | qsub_pids = [] 108 | for i in range(n_workers): 109 | if verbose: 110 | print("{} {}".format(qsub_path, worker_file)) 111 | print(list(qsub_path)) 112 | print(list(worker_file)) 113 | 114 | qsub_pid = subprocess.check_output([qsub_path, '-lnodes=1:ppn=2', worker_file]) 115 | qsub_pid = qsub_pid.decode()[:-1].split('.')[0] 116 | qsub_pids.append(qsub_pid) 117 | 118 | ray.init(redis_address='{}:{}'.format(addr, port)) 119 | print("Ray initialized") 120 | return wait_for_workers(n_workers + 1), qsub_pids 121 | 122 | 123 | def main(): 124 | init_pbs_ray() 125 | print(ray.nodes()) 126 | 127 | 128 | if __name__ == "__main__": 129 | main() 130 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 1562697886509 47 | 51 | 52 | 53 | 54 | 65 | 79 | 80 | 81 | 82 | 83 | 84 | file://$PROJECT_DIR$/testing/multi_model_test.py 85 | 5 86 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | dKeras logo 3 |

4 | 5 | # dKeras: Distributed Keras Engine 6 | ### ***Make Keras faster with only one line of code.*** 7 | 8 | dKeras is a distributed Keras engine that is built on top of 9 | [Ray](https://github.com/ray-project/ray). By wrapping dKeras around your 10 | original Keras model, it allows you to use many distributed deep learning 11 | techniques to automatically improve your system's performance. 12 | 13 | 14 | With an easy-to-use API and a backend framework that can be deployed from 15 | the laptop to the data center, dKeras simpilifies what used to be a complex 16 | and time-consuming process into only a few adjustments. 17 | 18 | #### Why Use dKeras? 19 | 20 | Distributed deep learning can be essential for production systems where you 21 | need fast inference but don't want expensive hardware accelerators or when 22 | researchers need to train large models made up of distributable parts. 23 | 24 | This becomes a challenge for developers because they'll need expertise in not 25 | only deep learning but also distributed systems. A production team might also 26 | need a machine learning optimization engineer to use neural network 27 | optimizers in terms of precision changes, layer fusing, or other techniques. 28 | 29 | Distributed inference is a simple way to get better inference FPS. The graph 30 | below shows how non-optimized, out-of-box models from default frameworks can 31 | be quickly sped up through data parallelism: 32 | 33 |

34 | dKeras graph 35 |

36 | 37 | 38 | #### Current Capabilities: 39 | - Data Parallelism Inference 40 | 41 | #### Future Capabilities: 42 | - Model Parallelism Inference 43 | - Distributed Training 44 | - Easy Multi-model production-ready building 45 | - Data stream input distributed inference 46 | - PlaidML Support 47 | - Autoscaling 48 | - Automatic optimal hardware configuration 49 | - PBS/Torque support 50 | 51 | ## Installation 52 | The first official release of dKeras will be available soon. For 53 | now, install from source. 54 | ```bash 55 | pip install git+https://github.com/dkeras-project/dkeras 56 | ``` 57 | 58 | ### Requirements 59 | 60 | - Python 3.6 or higher 61 | - ray 62 | - psutil 63 | - Linux (or OSX, dKeras works on laptops too!) 64 | - numpy 65 | 66 | 67 | ### Coming Soon: [PlaidML](https://github.com/plaidml/plaidml) Support 68 | dKeras will soon work alongside [PlaidML](https://github.com/plaidml/plaidml), 69 | a "portable tensor compiler for enabling deep learning on laptops, embedded devices, 70 | or other devices where the available computing hardware is not well 71 | supported or the available software stack contains unpalatable 72 | license restrictions." 73 | 74 | ## Distributed Inference 75 | 76 | ### Example 77 | 78 | #### Original 79 | ```python 80 | model = ResNet50() 81 | model.predict(data) 82 | ``` 83 | #### dKeras Version 84 | ```python 85 | from dkeras import dKeras 86 | 87 | model = dKeras(ResNet50) 88 | model.predict(data) 89 | ``` 90 | 91 | #### Full Example 92 | ```python 93 | from tensorflow.keras.applications import ResNet50 94 | from dkeras import dKeras 95 | import numpy as np 96 | import ray 97 | 98 | ray.init() 99 | 100 | data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 101 | 102 | model = dKeras(ResNet50, init_ray=False, wait_for_workers=True, n_workers=4) 103 | preds = model.predict(data) 104 | ``` 105 | 106 | #### Multiple Model Example 107 | ```python 108 | import numpy as np 109 | from tensorflow.keras.applications import ResNet50, MobileNet 110 | 111 | from dkeras import dKeras 112 | import ray 113 | 114 | ray.init() 115 | 116 | model1 = dKeras(ResNet50, weights='imagenet', wait_for_workers=True, n_workers=3) 117 | model2 = dKeras(MobileNet, weights='imagenet', wait_for_workers=True, n_workers=3) 118 | 119 | test_data = np.random.uniform(-1, 1, (100, 224, 224, 3)) 120 | 121 | model1.predict(test_data) 122 | model2.predict(test_data) 123 | 124 | model1.close() 125 | model2.close() 126 | ``` -------------------------------------------------------------------------------- /docs/build/html/_static/js/theme.js: -------------------------------------------------------------------------------- 1 | /* sphinx_rtd_theme version 0.4.3 | MIT license */ 2 | /* Built 20190212 16:02 */ 3 | require=function r(s,a,l){function c(e,n){if(!a[e]){if(!s[e]){var i="function"==typeof require&&require;if(!n&&i)return i(e,!0);if(u)return u(e,!0);var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}var o=a[e]={exports:{}};s[e][0].call(o.exports,function(n){return c(s[e][1][n]||n)},o,o.exports,r,s,a,l)}return a[e].exports}for(var u="function"==typeof require&&require,n=0;n"),i("table.docutils.footnote").wrap("
"),i("table.docutils.citation").wrap("
"),i(".wy-menu-vertical ul").not(".simple").siblings("a").each(function(){var e=i(this);expand=i(''),expand.on("click",function(n){return t.toggleCurrent(e),n.stopPropagation(),!1}),e.prepend(expand)})},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),i=e.find('[href="'+n+'"]');if(0===i.length){var t=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(i=e.find('[href="#'+t.attr("id")+'"]')).length&&(i=e.find('[href="#"]'))}0this.docHeight||(this.navBar.scrollTop(i),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",function(){this.linkScroll=!1})},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:e.exports.ThemeNav,StickyNav:e.exports.ThemeNav}),function(){for(var r=0,n=["ms","moz","webkit","o"],e=0;e 0: 55 | if mode == 'infer': 56 | if datatype == 'float': 57 | data = np.asarray(data) 58 | results = self.model.predict(data, batch_size=self.batch_size) 59 | self.ds.push.remote(results, packet_id) 60 | elif datatype == 'int8': 61 | data = np.asarray(data) 62 | data = np.float16(data / 255) 63 | results = self.model.predict(data, batch_size=self.batch_size) 64 | self.ds.push.remote(results, packet_id) 65 | else: 66 | raise UserWarning("Invalid datatype flag {}".format(datatype)) 67 | else: 68 | raise UserWarning("Invalid mode flag {}".format(mode)) 69 | else: 70 | time.sleep(self.wait_time) 71 | 72 | 73 | @ray.remote(num_cpus=config.N_CPUS_PER_WORKER, num_gpus=config.N_GPUS_PER_WORKER) 74 | def worker_task(worker_id, weights, ds, make_model): 75 | """ 76 | 77 | :param weights: 78 | :param ds: 79 | :return: 80 | """ 81 | worker_model = make_model() 82 | worker_model.set_weights(weights) 83 | batch_size = config.WORKER_INFERENCE_BATCH_SIZE 84 | wait_time = config.WORKER_WAIT_TIME 85 | ds.is_ready.remote(worker_id) 86 | while True: 87 | flag, data, job_config = ray.get(ds.pull.remote()) 88 | packet_id, mode, datatype = flag.split('_') 89 | if mode == 'STOP': 90 | break 91 | if len(data) > 0: 92 | if mode == 'infer': 93 | if len(job_config) == 7: 94 | __, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing = job_config 95 | if datatype == 'float': 96 | data = np.asarray(data) 97 | elif datatype == 'int8': 98 | data = np.asarray(data) 99 | data = np.float16(data / 255) 100 | else: 101 | raise UserWarning("Invalid datatype flag {}".format(datatype)) 102 | results = worker_model.predict(data, 103 | batch_size=batch_size, 104 | verbose=verbose, 105 | steps=steps, 106 | callbacks=callbacks, 107 | max_queue_size=max_queue_size, 108 | workers=workers, 109 | use_multiprocessing=use_multiprocessing) 110 | ds.push.remote(results, packet_id) 111 | else: 112 | raise UserWarning("Invalid mode flag {}".format(mode)) 113 | else: 114 | time.sleep(wait_time) 115 | -------------------------------------------------------------------------------- /testing/model_test.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import argparse 9 | import time 10 | 11 | import numpy as np 12 | from tensorflow.keras.applications import (DenseNet121, DenseNet169, 13 | DenseNet201, 14 | InceptionResNetV2, InceptionV3, 15 | MobileNet, MobileNetV2, NASNetLarge, 16 | NASNetMobile, ResNet50, VGG16, VGG19, 17 | Xception) 18 | 19 | from dkeras import dKeras 20 | 21 | 22 | def main(): 23 | model_names = { 24 | 'densenet121' : DenseNet121, 25 | 'densenet169' : DenseNet169, 26 | 'densenet201' : DenseNet201, 27 | 'inception_v3' : InceptionV3, 28 | 'inception_resnet_v2': InceptionResNetV2, 29 | 'mobilenet' : MobileNet, 30 | 'mobilenet_v2' : MobileNetV2, 31 | 'nasnet_large' : NASNetLarge, 32 | 'nasnet_mobile' : NASNetMobile, 33 | 'resnet50' : ResNet50, 34 | 'vgg16' : VGG16, 35 | 'vgg19' : VGG19, 36 | 'xception' : Xception 37 | } 38 | # os.environ["KERAS_BACKEND"] = "plaidml.keras.backend" 39 | parser = argparse.ArgumentParser() 40 | parser.add_argument("--n_data", help="Number of fake datapoints", 41 | default=1000, type=int) 42 | parser.add_argument("--n_workers", help="Number of Ray workers", 43 | default=5, type=int) 44 | 45 | parser.add_argument("--test", help="0: Local, 1: dKeras", 46 | default=1, type=int) 47 | 48 | parser.add_argument("--search", help="True or False, Find best n_workers", 49 | default=False, type=bool) 50 | 51 | parser.add_argument("--search-pool", 52 | help="n workers to search from, separated by commas", 53 | default='2,3,5,10,20,25,50,60,100', type=str) 54 | 55 | parser.add_argument("--model", help="Model options: {}".format( 56 | model_names.keys()), 57 | default='resnet50', type=str) 58 | args = parser.parse_args() 59 | 60 | n_workers = args.n_workers 61 | test_type = args.test 62 | n_data = args.n_data 63 | model_name = args.model 64 | use_search = args.search 65 | search_pool = args.search_pool 66 | try: 67 | search_pool = list(map(int, search_pool.split(','))) 68 | except TypeError: 69 | raise UserWarning("Search pool arg must be int separated by commas") 70 | 71 | if not (model_name in model_names.keys()): 72 | raise UserWarning( 73 | "Model name not found: {}, options: {}".format( 74 | model_name, model_names)) 75 | 76 | test_data = np.float16(np.random.uniform(-1, 1, (n_data, 224, 224, 3))) 77 | 78 | if test_type == 0: 79 | model = model_names[model_name]() 80 | 81 | start_time = time.time() 82 | preds = model.predict(test_data) 83 | elapsed = time.time() - start_time 84 | 85 | print("Time elapsed: {}\nFPS: {}".format(elapsed, n_data / elapsed)) 86 | 87 | elif test_type == 1: 88 | if use_search: 89 | results = {} 90 | best_time = np.inf 91 | best_n_workers = -1 92 | 93 | for n in search_pool: 94 | model = dKeras(model_names[model_name], wait_for_workers=True, 95 | n_workers=n) 96 | print("Workers are ready") 97 | 98 | start_time = time.time() 99 | preds = model.predict(test_data) 100 | elapsed = time.time() - start_time 101 | 102 | time.sleep(3) 103 | 104 | if elapsed < best_time: 105 | best_time = elapsed 106 | best_n_workers = n 107 | 108 | results[str(n)] = elapsed 109 | model.close() 110 | 111 | print('{}\nN\tElapsed Time'.format('=' * 80)) 112 | 113 | for k in results.keys(): 114 | print("{}\t{}".format(k, results[k])) 115 | 116 | print("{}\nTests completed:\n\tBest N workers: {}\t FPS: {}".format( 117 | '=' * 80, best_n_workers, n_data / best_time)) 118 | else: 119 | model = dKeras(model_names[model_name], wait_for_workers=True, 120 | n_workers=n_workers) 121 | 122 | start_time = time.time() 123 | preds = model.predict(test_data) 124 | elapsed = time.time() - start_time 125 | 126 | model.close() 127 | time.sleep(3) 128 | 129 | print("Time elapsed: {}\nFPS: {}".format(elapsed, n_data / elapsed)) 130 | 131 | 132 | if __name__ == "__main__": 133 | main() 134 | -------------------------------------------------------------------------------- /docs/build/html/data_parallelism.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | <no title> — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 95 | 96 |
97 | 98 | 99 | 105 | 106 | 107 |
108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
128 | 129 |
    130 | 131 |
  • Docs »
  • 132 | 133 |
  • <no title>
  • 134 | 135 | 136 |
  • 137 | 138 | 139 | View page source 140 | 141 | 142 |
  • 143 | 144 |
145 | 146 | 147 |
148 |
149 |
150 |
151 | 152 | 153 | 154 |
155 | 156 |
157 |
158 | 159 | 165 | 166 | 167 |
168 | 169 |
170 |

171 | © Copyright 2019, Stephen Offer 172 | 173 |

174 |
175 | Built with Sphinx using a theme provided by Read the Docs. 176 | 177 |
178 | 179 |
180 |
181 | 182 |
183 | 184 |
185 | 186 | 187 | 188 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /docs/build/html/getting_started.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | <no title> — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 96 | 97 |
98 | 99 | 100 | 106 | 107 | 108 |
109 | 110 |
111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 |
129 | 130 |
    131 | 132 |
  • Docs »
  • 133 | 134 |
  • <no title>
  • 135 | 136 | 137 |
  • 138 | 139 | 140 | View page source 141 | 142 | 143 |
  • 144 | 145 |
146 | 147 | 148 |
149 |
150 |
151 |
152 | 153 | 154 | 155 |
156 | 157 |
158 |
159 | 160 | 168 | 169 | 170 |
171 | 172 |
173 |

174 | © Copyright 2019, Stephen Offer 175 | 176 |

177 |
178 | Built with Sphinx using a theme provided by Read the Docs. 179 | 180 |
181 | 182 |
183 |
184 | 185 |
186 | 187 |
188 | 189 | 190 | 191 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /docs/build/html/py-modindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Python Module Index — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
47 | 48 | 97 | 98 |
99 | 100 | 101 | 107 | 108 | 109 |
110 | 111 |
112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 131 |
    132 | 133 |
  • Docs »
  • 134 | 135 |
  • Python Module Index
  • 136 | 137 | 138 |
  • 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 | 151 |

Python Module Index

152 | 153 |
154 | d 155 |
156 | 157 | 158 | 159 | 161 | 162 | 164 | 167 | 168 | 169 | 172 |
 
160 | d
165 | dkeras 166 |
    170 | dkeras.dKeras 171 |
173 | 174 | 175 |
176 | 177 |
178 |
179 | 180 | 181 |
182 | 183 |
184 |

185 | © Copyright 2019, Stephen Offer 186 | 187 |

188 |
189 | Built with Sphinx using a theme provided by Read the Docs. 190 | 191 |
192 | 193 |
194 |
195 | 196 |
197 | 198 |
199 | 200 | 201 | 202 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /docs/build/html/model_config.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | <no title> — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 45 | 111 | 112 |
113 | 114 | 115 | 121 | 122 | 123 |
124 | 125 |
126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 |
144 | 145 |
    146 | 147 |
  • Docs »
  • 148 | 149 |
  • <no title>
  • 150 | 151 | 152 |
  • 153 | 154 | 155 | View page source 156 | 157 | 158 |
  • 159 | 160 |
161 | 162 | 163 |
164 |
165 |
166 |
167 | 168 | 169 | 170 |
171 | 172 |
173 |
174 | 175 | 176 |
177 | 178 |
179 |

180 | © Copyright 2019, Stephen Offer 181 | 182 |

183 |
184 | Built with Sphinx using a theme provided by Read the Docs. 185 | 186 |
187 | 188 |
189 |
190 | 191 |
192 | 193 |
194 | 195 | 196 | 197 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /docs/build/html/design.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Design — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 45 | 113 | 114 |
115 | 116 | 117 | 123 | 124 | 125 |
126 | 127 |
128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 |
146 | 147 |
    148 | 149 |
  • Docs »
  • 150 | 151 |
  • Design
  • 152 | 153 | 154 |
  • 155 | 156 | 157 | View page source 158 | 159 | 160 |
  • 161 | 162 |
163 | 164 | 165 |
166 |
167 |
168 |
169 | 170 |
171 |

Design

172 | Inference Comparison 173 |
174 | 175 | 176 |
177 | 178 |
179 |
180 | 181 | 182 |
183 | 184 |
185 |

186 | © Copyright 2019, Stephen Offer 187 | 188 |

189 |
190 | Built with Sphinx using a theme provided by Read the Docs. 191 | 192 |
193 | 194 |
195 |
196 | 197 |
198 | 199 |
200 | 201 | 202 | 203 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /docs/build/html/data_server.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Data Server — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 101 | 102 |
103 | 104 | 105 | 111 | 112 | 113 |
114 | 115 |
116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 |
134 | 135 |
    136 | 137 |
  • Docs »
  • 138 | 139 |
  • Data Server
  • 140 | 141 | 142 |
  • 143 | 144 | 145 | View page source 146 | 147 | 148 |
  • 149 | 150 |
151 | 152 | 153 |
154 |
155 |
156 |
157 | 158 |
159 |

Data Server

160 |
161 |
162 | dkeras.servers.data_server.DataServer
163 |
164 | 165 |
166 | 167 | 168 |
169 | 170 |
171 |
172 | 173 | 181 | 182 | 183 |
184 | 185 |
186 |

187 | © Copyright 2019, Stephen Offer 188 | 189 |

190 |
191 | Built with Sphinx using a theme provided by Read the Docs. 192 | 193 |
194 | 195 |
196 |
197 | 198 |
199 | 200 |
201 | 202 | 203 | 204 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /docs/build/html/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Search — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 115 | 116 |
117 | 118 | 119 | 125 | 126 | 127 |
128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 |
    150 | 151 |
  • Docs »
  • 152 | 153 |
  • Search
  • 154 | 155 | 156 |
  • 157 | 158 | 159 | 160 |
  • 161 | 162 |
163 | 164 | 165 |
166 |
167 |
168 |
169 | 170 | 178 | 179 | 180 |
181 | 182 |
183 | 184 |
185 | 186 |
187 |
188 | 189 | 190 |
191 | 192 |
193 |

194 | © Copyright 2019, Stephen Offer 195 | 196 |

197 |
198 | Built with Sphinx using a theme provided by Read the Docs. 199 | 200 |
201 | 202 |
203 |
204 | 205 |
206 | 207 |
208 | 209 | 210 | 211 | 216 | 217 | 218 | 219 | 220 | 221 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /dkeras/benchmarks/model_benchmark.py: -------------------------------------------------------------------------------- 1 | #!/bin/env/python 2 | # -*- encoding: utf-8 -*- 3 | """ 4 | 5 | """ 6 | from __future__ import division, print_function 7 | 8 | import argparse 9 | import time 10 | 11 | import numpy as np 12 | import ray 13 | from tensorflow.keras.applications import (DenseNet121, DenseNet169, 14 | DenseNet201, 15 | InceptionResNetV2, InceptionV3, 16 | MobileNet, MobileNetV2, NASNetLarge, 17 | NASNetMobile, ResNet50, VGG16, VGG19, 18 | Xception) 19 | 20 | from dkeras import dKeras 21 | 22 | 23 | def main(): 24 | model_names = { 25 | 'densenet121': DenseNet121, 26 | 'densenet169': DenseNet169, 27 | 'densenet201': DenseNet201, 28 | 'inception_v3': InceptionV3, 29 | 'inception_resnet_v2': InceptionResNetV2, 30 | 'mobilenet': MobileNet, 31 | 'mobilenet_v2': MobileNetV2, 32 | 'nasnet_large': NASNetLarge, 33 | 'nasnet_mobile': NASNetMobile, 34 | 'resnet50': ResNet50, 35 | 'vgg16': VGG16, 36 | 'vgg19': VGG19, 37 | 'xception': Xception 38 | } 39 | # os.environ["KERAS_BACKEND"] = "plaidml.keras.backend" 40 | parser = argparse.ArgumentParser() 41 | parser.add_argument("--n-data", help="Number of fake datapoints", 42 | default=1000, type=int) 43 | parser.add_argument("--n-workers", help="Number of Ray workers", 44 | default=5, type=int) 45 | 46 | parser.add_argument("--test", help="0: Local, 1: dKeras", 47 | default=1, type=int) 48 | 49 | parser.add_argument("--search", help="True or False, Find best n_workers", 50 | default=False, type=bool) 51 | 52 | parser.add_argument("--object_store_memory", help="True or False, Find best n_workers", 53 | default=20000000000, type=int) 54 | 55 | parser.add_argument("--search-pool", 56 | help="n workers to search from, separated by commas", 57 | default='2,3,5,10,20,25,50,60,100', type=str) 58 | 59 | parser.add_argument("--model", help="Model options: {}".format( 60 | model_names.keys()), 61 | default='resnet50', type=str) 62 | args = parser.parse_args() 63 | 64 | n_workers = args.n_workers 65 | test_type = args.test 66 | n_data = args.n_data 67 | model_name = args.model 68 | use_search = args.search 69 | search_pool = args.search_pool 70 | 71 | if ray.is_initialized(): 72 | ray.shutdown() 73 | # ray.init(object_store_memory=args.object_store_memory) 74 | ray.init() 75 | 76 | default_shape = (224, 224, 3) 77 | 78 | try: 79 | search_pool = list(map(int, search_pool.split(','))) 80 | except TypeError: 81 | raise UserWarning("Search pool arg must be int separated by commas") 82 | 83 | if not ((model_name == 'all') or (model_name in model_names.keys())): 84 | raise UserWarning( 85 | "Model name not found: {}, options: {}".format( 86 | model_name, model_names.keys())) 87 | 88 | if model_name != 'all': 89 | models = [model_names[model_name]] 90 | model_names = [model_name] 91 | else: 92 | models = [model_names[m] for m in model_names.keys()] 93 | model_names = [m for m in model_names.keys()] 94 | 95 | if test_type == 0: 96 | 97 | for model, name in zip(models, model_names): 98 | print('{}\n{}'.format('=' * 80, name)) 99 | model = model() 100 | # model = model_names[model_name]() 101 | 102 | _, h, w, c = model.input_shape 103 | if (h is None) or (w is None): 104 | h, w = default_shape[0], default_shape[1] 105 | test_data = np.float16(np.random.uniform(-1, 1, (n_data, h, w, c))) 106 | 107 | start_time = time.time() 108 | preds = model.predict(test_data) 109 | elapsed = time.time() - start_time 110 | 111 | print("Time elapsed: {}\nFPS: {}".format(elapsed, n_data / elapsed)) 112 | 113 | elif test_type == 1: 114 | 115 | for m, name in zip(models, model_names): 116 | print('{}\n{}'.format('=' * 80, name.upper())) 117 | if use_search: 118 | results = {} 119 | best_time = np.inf 120 | best_n_workers = -1 121 | 122 | for n in search_pool: 123 | model = dKeras(m, wait_for_workers=True, 124 | init_ray=False, 125 | rm_existing_ray=False, 126 | n_workers=n) 127 | _, h, w, c = model.input_shape 128 | if (h is None) or (w is None): 129 | h, w = default_shape[0], default_shape[1] 130 | test_data = np.float16( 131 | np.random.uniform(-1, 1, (n_data, h, w, c))) 132 | print("Workers are ready") 133 | 134 | start_time = time.time() 135 | preds = model.predict(test_data) 136 | elapsed = time.time() - start_time 137 | 138 | if elapsed < best_time: 139 | best_time = elapsed 140 | best_n_workers = n 141 | 142 | results[str(n)] = elapsed 143 | model.close() 144 | 145 | # print('{}\n\t{}\n\tElapsed Time'.format('=' * 80)) 146 | 147 | for k in results.keys(): 148 | print("{}\t{}".format(k, results[k])) 149 | 150 | print("{}\n{}\nTests completed:\n\tBest N workers: {}\t FPS: {}".format( 151 | '=' * 80, name, best_n_workers, n_data / best_time)) 152 | else: 153 | model = dKeras(m, 154 | init_ray=False, 155 | wait_for_workers=True, 156 | rm_existing_ray=False, 157 | n_workers=n_workers) 158 | _, h, w, c = model.input_shape 159 | if (h is None) or (w is None): 160 | h, w = default_shape[0], default_shape[1] 161 | test_data = np.float16( 162 | np.random.uniform(-1, 1, (n_data, h, w, c))) 163 | 164 | start_time = time.time() 165 | preds = model.predict(test_data) 166 | elapsed = time.time() - start_time 167 | 168 | model.close() 169 | time.sleep(3) 170 | 171 | print("Time elapsed: {}\nFPS: {}".format(elapsed, n_data / elapsed)) 172 | 173 | 174 | if __name__ == "__main__": 175 | main() 176 | -------------------------------------------------------------------------------- /docs/build/html/why.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Why Use dKeras? — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 101 | 102 |
103 | 104 | 105 | 111 | 112 | 113 |
114 | 115 |
116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 |
134 | 135 |
    136 | 137 |
  • Docs »
  • 138 | 139 |
  • Why Use dKeras?
  • 140 | 141 | 142 |
  • 143 | 144 | 145 | View page source 146 | 147 | 148 |
  • 149 | 150 |
151 | 152 | 153 |
154 |
155 |
156 |
157 | 158 |
159 |

Why Use dKeras?

160 |

Distributed deep learning can be essential for production systems where you 161 | need fast inference but don’t want expensive hardware accelerators or when 162 | researchers need to train large models made up of distributable parts.

163 |

This becomes a challenge for developers because they’ll need expertise in not 164 | only deep learning but also distributed systems. A production team might also 165 | need a machine learning optimization engineer to use neural network 166 | optimizers in terms of precision changes, layer fusing, or other techniques.

167 |

Distributed inference is a simple way to get better inference FPS. The graph 168 | below shows how non-optimized, out-of-box models from default frameworks can 169 | be quickly sped up through data parallelism:

170 |
171 | 172 | 173 |
174 | 175 |
176 |
177 | 178 | 186 | 187 | 188 |
189 | 190 |
191 |

192 | © Copyright 2019, Stephen Offer 193 | 194 |

195 |
196 | Built with Sphinx using a theme provided by Read the Docs. 197 | 198 |
199 | 200 |
201 |
202 | 203 |
204 | 205 |
206 | 207 | 208 | 209 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | -------------------------------------------------------------------------------- /docs/build/html/worker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Worker — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 108 | 109 |
110 | 111 | 112 | 118 | 119 | 120 |
121 | 122 |
123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 |
141 | 142 |
    143 | 144 |
  • Docs »
  • 145 | 146 |
  • Worker
  • 147 | 148 | 149 |
  • 150 | 151 | 152 | View page source 153 | 154 | 155 |
  • 156 | 157 |
158 | 159 | 160 |
161 |
162 |
163 |
164 | 165 |
166 |

Worker

167 |
168 |
169 | dkeras.workers.worker.worker_task
170 |
171 | 172 |
173 | 174 | 175 |
176 | 177 |
178 |
179 | 180 | 188 | 189 | 190 |
191 | 192 |
193 |

194 | © Copyright 2019, Stephen Offer 195 | 196 |

197 |
198 | Built with Sphinx using a theme provided by Read the Docs. 199 | 200 |
201 | 202 |
203 |
204 | 205 |
206 | 207 |
208 | 209 | 210 | 211 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | -------------------------------------------------------------------------------- /docs/build/html/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Contact — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 112 | 113 |
114 | 115 | 116 | 122 | 123 | 124 |
125 | 126 |
127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 |
145 | 146 |
    147 | 148 |
  • Docs »
  • 149 | 150 |
  • Contact
  • 151 | 152 | 153 |
  • 154 | 155 | 156 | View page source 157 | 158 | 159 |
  • 160 | 161 |
162 | 163 | 164 |
165 |
166 |
167 |
168 | 169 |
170 |

Contact

171 |

The fastest way to get help with any issues with dKeras is through the official GitHub 172 | repository:

173 |

dKeras GitHub Repository

174 |

The official email for the dKeras project is dkerasproject@gmail.com.

175 |
176 | 177 | 178 |
179 | 180 |
181 |
182 | 183 | 189 | 190 | 191 |
192 | 193 |
194 |

195 | © Copyright 2019, Stephen Offer 196 | 197 |

198 |
199 | Built with Sphinx using a theme provided by Read the Docs. 200 | 201 |
202 | 203 |
204 |
205 | 206 |
207 | 208 |
209 | 210 | 211 | 212 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | -------------------------------------------------------------------------------- /docs/build/html/development_tips.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Development Tips — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 115 | 116 |
117 | 118 | 119 | 125 | 126 | 127 |
128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 |
    150 | 151 |
  • Docs »
  • 152 | 153 |
  • Development Tips
  • 154 | 155 | 156 |
  • 157 | 158 | 159 | View page source 160 | 161 | 162 |
  • 163 | 164 |
165 | 166 | 167 |
168 |
169 |
170 |
171 | 172 |
173 |

Development Tips

174 |
175 | 176 | 177 |
178 | 179 |
180 |
181 | 182 | 190 | 191 | 192 |
193 | 194 |
195 |

196 | © Copyright 2019, Stephen Offer 197 | 198 |

199 |
200 | Built with Sphinx using a theme provided by Read the Docs. 201 | 202 |
203 | 204 |
205 |
206 | 207 |
208 | 209 |
210 | 211 | 212 | 213 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /docs/build/html/troubleshooting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Troubleshooting — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 115 | 116 |
117 | 118 | 119 | 125 | 126 | 127 |
128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 |
    150 | 151 |
  • Docs »
  • 152 | 153 |
  • Troubleshooting
  • 154 | 155 | 156 |
  • 157 | 158 | 159 | View page source 160 | 161 | 162 |
  • 163 | 164 |
165 | 166 | 167 |
168 |
169 |
170 |
171 | 172 |
173 |

Troubleshooting

174 |
175 | 176 | 177 |
178 | 179 |
180 |
181 | 182 | 190 | 191 | 192 |
193 | 194 |
195 |

196 | © Copyright 2019, Stephen Offer 197 | 198 |

199 |
200 | Built with Sphinx using a theme provided by Read the Docs. 201 | 202 |
203 | 204 |
205 |
206 | 207 |
208 | 209 |
210 | 211 | 212 | 213 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /docs/build/html/install.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Installation — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 104 | 105 |
106 | 107 | 108 | 114 | 115 | 116 |
117 | 118 |
119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
137 | 138 |
    139 | 140 |
  • Docs »
  • 141 | 142 |
  • Installation
  • 143 | 144 | 145 |
  • 146 | 147 | 148 | View page source 149 | 150 | 151 |
  • 152 | 153 |
154 | 155 | 156 |
157 |
158 |
159 |
160 | 161 |
162 |

Installation

163 |

dKeras can be installed either through PyPI or from source:

164 |
165 |

Install from PyPI

166 |

dKeras is currently not available on PyPI, install from source instead

167 |
>>> pip install dkeras
168 | 
169 |
170 |
171 |
172 |

Install from Source

173 |
>>> git clone https://github.com/dkeras-project/dkeras.git
174 | >>> cd dkeras
175 | >>> pip install -e .
176 | 
177 |
178 |
179 |
180 | 181 | 182 |
183 | 184 |
185 |
186 | 187 | 195 | 196 | 197 |
198 | 199 |
200 |

201 | © Copyright 2019, Stephen Offer 202 | 203 |

204 |
205 | Built with Sphinx using a theme provided by Read the Docs. 206 | 207 |
208 | 209 |
210 |
211 | 212 |
213 | 214 |
215 | 216 | 217 | 218 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /docs/build/html/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Basic Inference Example — dkeras 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 106 | 107 |
108 | 109 | 110 | 116 | 117 | 118 |
119 | 120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 |
139 | 140 |
    141 | 142 |
  • Docs »
  • 143 | 144 |
  • Basic Inference Example
  • 145 | 146 | 147 |
  • 148 | 149 | 150 | View page source 151 | 152 | 153 |
  • 154 | 155 |
156 | 157 | 158 |
159 |
160 |
161 |
162 | 163 |
164 |

Basic Inference Example

165 |

dKeras maintains the same API as Keras, the only differences are the addition 166 | of functions to maintain distributed systems and arguements.

167 |
from tensorflow.keras.applications import ResNet50
168 | from dkeras import dKeras
169 | import numpy as np
170 | 
171 | data = np.random.uniform(-1, 1, (100, 224, 224, 3))
172 | 
173 | model = dKeras(ResNet50, wait_for_workers=True, n_workers=4)
174 | preds = model.predict(data)
175 | 
176 |
177 |
178 | 179 | 180 |
181 | 182 |
183 |
184 | 185 | 193 | 194 | 195 |
196 | 197 |
198 |

199 | © Copyright 2019, Stephen Offer 200 | 201 |

202 |
203 | Built with Sphinx using a theme provided by Read the Docs. 204 | 205 |
206 | 207 |
208 |
209 | 210 |
211 | 212 |
213 | 214 | 215 | 216 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /docs/build/html/genindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Index — dkeras 0.0.1 documentation 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 115 | 116 |
117 | 118 | 119 | 125 | 126 | 127 |
128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 |
    150 | 151 |
  • Docs »
  • 152 | 153 |
  • Index
  • 154 | 155 | 156 |
  • 157 | 158 | 159 | 160 |
  • 161 | 162 |
163 | 164 | 165 |
166 |
167 |
168 |
169 | 170 | 171 |

Index

172 | 173 |
174 | C 175 | | D 176 | | I 177 | | P 178 | | W 179 | 180 |
181 |

C

182 | 183 | 187 |
188 | 189 |

D

190 | 191 | 195 | 199 |
200 | 201 |

I

202 | 203 | 207 |
208 | 209 |

P

210 | 211 | 215 |
216 | 217 |

W

218 | 219 | 223 |
224 | 225 | 226 | 227 |
228 | 229 |
230 |
231 | 232 | 233 |
234 | 235 |
236 |

237 | © Copyright 2019, Stephen Offer 238 | 239 |

240 |
241 | Built with Sphinx using a theme provided by Read the Docs. 242 | 243 |
244 | 245 |
246 |
247 | 248 |
249 | 250 |
251 | 252 | 253 | 254 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | --------------------------------------------------------------------------------