From ac46edd4e6b1cb93544a722eba51113cf479e65b Mon Sep 17 00:00:00 2001 From: liuqi Date: Fri, 13 Jul 2018 10:12:42 +0800 Subject: [PATCH] Import filelock package when use it. --- docs/installation/env_requirement.rst | 8 ++++---- docs/user_guide/advanced_usage.rst | 13 ++++++++++++- tools/converter.py | 1 - tools/sh_commands.py | 3 ++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/docs/installation/env_requirement.rst b/docs/installation/env_requirement.rst index c4827124..6946a524 100644 --- a/docs/installation/env_requirement.rst +++ b/docs/installation/env_requirement.rst @@ -30,6 +30,9 @@ Required dependencies * - sh - pip install -I sh==1.12.14 - 1.12.14 + * - Numpy + - pip install -I numpy==1.14.0 + - Required by model validation Optional dependencies --------------------- @@ -52,15 +55,12 @@ Optional dependencies * - Docker - `docker installation guide `__ - Required by docker mode for Caffe model - * - Numpy - - pip install -I numpy==1.14.0 - - Required by model validation * - Scipy - pip install -I scipy==1.0.0 - Required by model validation * - FileLock - pip install -I filelock==3.0.0 - - Required by Android run + - Required by run on Android .. note:: diff --git a/docs/user_guide/advanced_usage.rst b/docs/user_guide/advanced_usage.rst index 1f536bff..141cedc4 100644 --- a/docs/user_guide/advanced_usage.rst +++ b/docs/user_guide/advanced_usage.rst @@ -160,6 +160,17 @@ There are two common advanced use cases:    ├── mobilenet-v1.a    └── mobilenet_v1.data + # model_graph_format: code + # model_data_format: code + + builds + ├── include + │   └── mace + │   └── public + │   ├── mace_engine_factory.h + │   └── mobilenet_v1.h + └── model +    └── mobilenet-v1.a * **3. Deployment** * Link `libmace.a` and `${library_name}.a` to your target. @@ -182,7 +193,7 @@ There are two common advanced use cases: // Create Engine from compiled code create_engine_status = CreateMaceEngineFromCode(model_name.c_str(), - nullptr, + model_data_file, // empty string if model_data_format is code input_names, output_names, device_type, diff --git a/tools/converter.py b/tools/converter.py index c13d7e83..e234f4a6 100644 --- a/tools/converter.py +++ b/tools/converter.py @@ -13,7 +13,6 @@ # limitations under the License. import argparse -import filelock import glob import hashlib import os diff --git a/tools/sh_commands.py b/tools/sh_commands.py index a3617224..1331a1e0 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -13,7 +13,6 @@ # limitations under the License. import falcon_cli -import filelock import glob import logging import numpy as np @@ -69,10 +68,12 @@ def device_lock_path(serialno): def device_lock(serialno, timeout=3600): + import filelock return filelock.FileLock(device_lock_path(serialno), timeout=timeout) def is_device_locked(serialno): + import filelock try: with device_lock(serialno, timeout=0.000001): return False -- GitLab