From da9a3f4519d303b3101bcda318212ea8ae70f8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E7=BF=94?= Date: Wed, 27 Sep 2017 17:14:59 +0800 Subject: [PATCH] Add mxnet pack operation --- .../pack_docker_image/mxnet_pack_op.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 uaitrain/operation/pack_docker_image/mxnet_pack_op.py diff --git a/uaitrain/operation/pack_docker_image/mxnet_pack_op.py b/uaitrain/operation/pack_docker_image/mxnet_pack_op.py new file mode 100644 index 0000000..6670b71 --- /dev/null +++ b/uaitrain/operation/pack_docker_image/mxnet_pack_op.py @@ -0,0 +1,39 @@ +# Copyright 2017 The UAI-SDK Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +from uaitrain.operation.pack_docker_image.base_pack_op import BaseUAITrainDockerImagePackOp + +class MXNetUAITrainDockerImagePackOp(BaseUAITrainDockerImagePackOp): + """docstring for ClassName""" + def __init__(self, parser): + super(MXNetUAITrainDockerImagePackOp, self).__init__(parser) + self.ai_arch = "caffe" + + def _parse_args(self, args): + super(MXNetUAITrainDockerImagePackOp, self)._parse_args(args) + + def _add_args(self): + super(MXNetUAITrainDockerImagePackOp, self)._add_args() + + def _gen_gpu_docker_cmd(self, pycmd): + gpu_docker_cmd = "sudo nvidia-docker run -it " + \ + "-v " + self.test_data_path + ":" + "/data/data " + \ + "-v " + self.test_output_path + ":" + "/data/output " + \ + self.user_gpu_image + " " + "/bin/bash -c " + \ + "\"cd /data && /usr/bin/python " + pycmd + " " + "--num_gpus=1 --work_dir=/data --data_dir=/data/data --output_dir=/data/output --log_dir=/data/output\"" + return gpu_docker_cmd + + + \ No newline at end of file