提交 ac46edd4 编写于 作者: L liuqi

Import filelock package when use it.

上级 4c7db855
...@@ -30,6 +30,9 @@ Required dependencies ...@@ -30,6 +30,9 @@ Required dependencies
* - sh * - sh
- pip install -I sh==1.12.14 - pip install -I sh==1.12.14
- 1.12.14 - 1.12.14
* - Numpy
- pip install -I numpy==1.14.0
- Required by model validation
Optional dependencies Optional dependencies
--------------------- ---------------------
...@@ -52,15 +55,12 @@ Optional dependencies ...@@ -52,15 +55,12 @@ Optional dependencies
* - Docker * - Docker
- `docker installation guide <https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository>`__ - `docker installation guide <https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository>`__
- Required by docker mode for Caffe model - Required by docker mode for Caffe model
* - Numpy
- pip install -I numpy==1.14.0
- Required by model validation
* - Scipy * - Scipy
- pip install -I scipy==1.0.0 - pip install -I scipy==1.0.0
- Required by model validation - Required by model validation
* - FileLock * - FileLock
- pip install -I filelock==3.0.0 - pip install -I filelock==3.0.0
- Required by Android run - Required by run on Android
.. note:: .. note::
......
...@@ -160,6 +160,17 @@ There are two common advanced use cases: ...@@ -160,6 +160,17 @@ There are two common advanced use cases:
   ├── mobilenet-v1.a    ├── mobilenet-v1.a
   └── mobilenet_v1.data    └── 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** * **3. Deployment**
* Link `libmace.a` and `${library_name}.a` to your target. * Link `libmace.a` and `${library_name}.a` to your target.
...@@ -182,7 +193,7 @@ There are two common advanced use cases: ...@@ -182,7 +193,7 @@ There are two common advanced use cases:
// Create Engine from compiled code // Create Engine from compiled code
create_engine_status = create_engine_status =
CreateMaceEngineFromCode(model_name.c_str(), CreateMaceEngineFromCode(model_name.c_str(),
nullptr, model_data_file, // empty string if model_data_format is code
input_names, input_names,
output_names, output_names,
device_type, device_type,
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import argparse import argparse
import filelock
import glob import glob
import hashlib import hashlib
import os import os
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import falcon_cli import falcon_cli
import filelock
import glob import glob
import logging import logging
import numpy as np import numpy as np
...@@ -69,10 +68,12 @@ def device_lock_path(serialno): ...@@ -69,10 +68,12 @@ def device_lock_path(serialno):
def device_lock(serialno, timeout=3600): def device_lock(serialno, timeout=3600):
import filelock
return filelock.FileLock(device_lock_path(serialno), timeout=timeout) return filelock.FileLock(device_lock_path(serialno), timeout=timeout)
def is_device_locked(serialno): def is_device_locked(serialno):
import filelock
try: try:
with device_lock(serialno, timeout=0.000001): with device_lock(serialno, timeout=0.000001):
return False return False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册