diff --git a/model_zoo/official/cv/alexnet/eval.py b/model_zoo/official/cv/alexnet/eval.py index 0b2e6096e82..5627e05c2d4 100644 --- a/model_zoo/official/cv/alexnet/eval.py +++ b/model_zoo/official/cv/alexnet/eval.py @@ -41,6 +41,7 @@ if __name__ == "__main__": path where the trained ckpt file') parser.add_argument('--dataset_sink_mode', type=ast.literal_eval, default=True, help='dataset_sink_mode is False or True') + parser.add_argument('--device_id', type=int, default=0, help='device id of GPU or Ascend. (Default: 0)') args = parser.parse_args() context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) diff --git a/model_zoo/official/cv/alexnet/scripts/run_distribution_ascend.sh b/model_zoo/official/cv/alexnet/scripts/run_distribution_ascend.sh index 91da816cc3b..4dea3c4e0bc 100644 --- a/model_zoo/official/cv/alexnet/scripts/run_distribution_ascend.sh +++ b/model_zoo/official/cv/alexnet/scripts/run_distribution_ascend.sh @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ - +# an simple tutorial as follows, more parameters can be setting if [ $# != 3 ] then - echo "Usage: sh run_train.sh [RANK_TABLE_FILE] [cifar10|imagenet] [DATA_PATH]" + echo "Usage: sh run_distribution_ascend.sh [RANK_TABLE_FILE] [cifar10|imagenet] [DATA_PATH]" exit 1 fi diff --git a/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_ascend.sh b/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_ascend.sh index 8b65f733a8e..ef022f65ac4 100644 --- a/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_ascend.sh +++ b/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_ascend.sh @@ -13,8 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ - # an simple tutorial as follows, more parameters can be setting -script_self=$(readlink -f "$0") -self_path=$(dirname "${script_self}") -python -s ${self_path}/../eval.py --device_target="Ascend" > log.txt 2>&1 & +if [ $# != 4 ] +then + echo "Usage: sh run_standalone_eval_ascend.sh [cifar10|imagenet] [DATA_PATH] [CKPT_PATH] [DEVICE_ID]" +exit 1 +fi + +export DATASET_NAME=$1 +export DATA_PATH=$2 +export CKPT_PATH=$3 +export DEVICE_ID=$4 + +python eval.py --dataset_name=$DATASET_NAME --data_path=$DATA_PATH --ckpt_path=$CKPT_PATH \ + --device_id=$DEVICE_ID --device_target="Ascend" > log.txt 2>&1 & diff --git a/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_gpu.sh b/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_gpu.sh index c02d862d3f5..4130138e1d5 100644 --- a/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_gpu.sh +++ b/model_zoo/official/cv/alexnet/scripts/run_standalone_eval_gpu.sh @@ -13,8 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ - # an simple tutorial as follows, more parameters can be setting -script_self=$(readlink -f "$0") -self_path=$(dirname "${script_self}") -python -s ${self_path}/../eval.py --device_target="GPU" > log.txt 2>&1 & +if [ $# != 4 ] +then + echo "Usage: sh run_standalone_eval_gpu.sh [cifar10|imagenet] [DATA_PATH] [CKPT_PATH] [DEVICE_ID]" +exit 1 +fi + +export DATASET_NAME=$1 +export DATA_PATH=$2 +export CKPT_PATH=$3 +export DEVICE_ID=$4 + +python eval.py --dataset_name=$DATASET_NAME --data_path=$DATA_PATH --ckpt_path=$CKPT_PATH \ + --device_id=$DEVICE_ID --device_target="GPU" > log.txt 2>&1 & diff --git a/model_zoo/official/cv/alexnet/scripts/run_standalone_train_ascend.sh b/model_zoo/official/cv/alexnet/scripts/run_standalone_train_ascend.sh index 11922551db8..743b8416e82 100644 --- a/model_zoo/official/cv/alexnet/scripts/run_standalone_train_ascend.sh +++ b/model_zoo/official/cv/alexnet/scripts/run_standalone_train_ascend.sh @@ -13,11 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ +# an simple tutorial as follows, more parameters can be setting +if [ $# != 3 ] +then + echo "Usage: sh run_standalone_train_ascend.sh [cifar10|imagenet] [DATA_PATH] [DEVICE_ID]" +exit 1 +fi -export DEVICE_NUM=1 -export RANK_SIZE=1 +export DATASET_NAME=$1 +export DATA_PATH=$2 +export DEVICE_ID=$3 -# an simple tutorial, more -script_self=$(readlink -f "$0") -self_path=$(dirname "${script_self}") -python -s ${self_path}/../train.py --device_target="Ascend" > log.txt 2>&1 & +python train.py --dataset_name=$DATASET_NAME --data_path=$DATA_PATH \ + --device_id=$DEVICE_ID --device_target="Ascend" > log.txt 2>&1 & diff --git a/model_zoo/official/cv/alexnet/scripts/run_standalone_train_gpu.sh b/model_zoo/official/cv/alexnet/scripts/run_standalone_train_gpu.sh index eabd37edc9c..b616d5eb8cc 100644 --- a/model_zoo/official/cv/alexnet/scripts/run_standalone_train_gpu.sh +++ b/model_zoo/official/cv/alexnet/scripts/run_standalone_train_gpu.sh @@ -13,11 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ - -export DEVICE_NUM=1 -export RANK_SIZE=1 - # an simple tutorial as follows, more parameters can be setting -script_self=$(readlink -f "$0") -self_path=$(dirname "${script_self}") -python -s ${self_path}/../train.py --device_target="GPU" > log.txt 2>&1 & +if [ $# != 3 ] +then + echo "Usage: sh run_standalone_train_gpu.sh [cifar10|imagenet] [DATA_PATH] [DEVICE_ID]" +exit 1 +fi + +export DATASET_NAME=$1 +export DATA_PATH=$2 +export DEVICE_ID=$3 + +python train.py --dataset_name=$DATASET_NAME --data_path=$DATA_PATH \ + --device_id=$DEVICE_ID --device_target="GPU" > log.txt 2>&1 & diff --git a/model_zoo/official/cv/alexnet/train.py b/model_zoo/official/cv/alexnet/train.py index d4d1de55c8d..812710d495c 100644 --- a/model_zoo/official/cv/alexnet/train.py +++ b/model_zoo/official/cv/alexnet/train.py @@ -51,8 +51,7 @@ if __name__ == "__main__": path where the trained ckpt file') parser.add_argument('--dataset_sink_mode', type=ast.literal_eval, default=True, help='dataset_sink_mode is False or True') - - parser.add_argument('--device_id', type=int, default=0, help='device id of GPU or Ascend. (Default: None)') + parser.add_argument('--device_id', type=int, default=0, help='device id of GPU or Ascend. (Default: 0)') args = parser.parse_args() if args.dataset_name == "cifar10":