forked from mindspore-Ecosystem/mindspore
!11680 fix GRU dataset
From: @qujianwei Reviewed-by: @c_34,@liangchenghui Signed-off-by: @c_34
This commit is contained in:
commit
01d84b1ce5
|
@ -217,7 +217,7 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
||||||
perl multi-bleu.perl target.txt.forbleu < output.txt.forbleu
|
perl multi-bleu.perl target.txt.forbleu < output.txt.forbleu
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: The `DATASET_PATH` is path to mindrecord. eg. /dataset_path/*.mindrecord
|
Note: The `DATASET_PATH` is path to mindrecord. eg. train: /dataset_path/multi30k_train_mindrecord_0 eval: /dataset_path/multi30k_test_mindrecord
|
||||||
|
|
||||||
# [Model Description](#content)
|
# [Model Description](#content)
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ def run_gru_eval():
|
||||||
|
|
||||||
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target, reserve_class_name_in_scope=False, \
|
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target, reserve_class_name_in_scope=False, \
|
||||||
device_id=args.device_id, save_graphs=False)
|
device_id=args.device_id, save_graphs=False)
|
||||||
prefix = "multi30k_test_mindrecord_32"
|
mindrecord_file = args.dataset_path
|
||||||
mindrecord_file = os.path.join(args.dataset_path, prefix)
|
|
||||||
if not os.path.exists(mindrecord_file):
|
if not os.path.exists(mindrecord_file):
|
||||||
print("dataset file {} not exists, please check!".format(mindrecord_file))
|
print("dataset file {} not exists, please check!".format(mindrecord_file))
|
||||||
raise ValueError(mindrecord_file)
|
raise ValueError(mindrecord_file)
|
||||||
|
|
|
@ -40,9 +40,9 @@ fi
|
||||||
DATASET_PATH=$(get_real_path $2)
|
DATASET_PATH=$(get_real_path $2)
|
||||||
echo $DATASET_PATH
|
echo $DATASET_PATH
|
||||||
|
|
||||||
if [ ! -d $DATASET_PATH ]
|
if [ ! -f $DATASET_PATH ]
|
||||||
then
|
then
|
||||||
echo "error: DATASET_PATH=$DATASET_PATH is not a directory"
|
echo "error: DATASET_PATH=$DATASET_PATH is not a file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ fi
|
||||||
|
|
||||||
DATASET_PATH=$(get_real_path $2)
|
DATASET_PATH=$(get_real_path $2)
|
||||||
echo $DATASET_PATH
|
echo $DATASET_PATH
|
||||||
if [ ! -d $DATASET_PATH ]
|
if [ ! -f $DATASET_PATH ]
|
||||||
then
|
then
|
||||||
echo "error: DATASET_PATH=$DATASET_PATH is not a directory"
|
echo "error: DATASET_PATH=$DATASET_PATH is not a file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm -rf ./eval
|
rm -rf ./eval
|
||||||
|
|
|
@ -33,9 +33,9 @@ get_real_path(){
|
||||||
|
|
||||||
DATASET_PATH=$(get_real_path $1)
|
DATASET_PATH=$(get_real_path $1)
|
||||||
echo $DATASET_PATH
|
echo $DATASET_PATH
|
||||||
if [ ! -d $DATASET_PATH ]
|
if [ ! -f $DATASET_PATH ]
|
||||||
then
|
then
|
||||||
echo "error: DATASET_PATH=$DATASET_PATH is not a directory"
|
echo "error: DATASET_PATH=$DATASET_PATH is not a file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,7 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
rank = 0
|
rank = 0
|
||||||
device_num = 1
|
device_num = 1
|
||||||
prefix = "multi30k_train_mindrecord_32_"
|
mindrecord_file = args.dataset_path
|
||||||
mindrecord_file = os.path.join(args.dataset_path, prefix+"0")
|
|
||||||
if not os.path.exists(mindrecord_file):
|
if not os.path.exists(mindrecord_file):
|
||||||
print("dataset file {} not exists, please check!".format(mindrecord_file))
|
print("dataset file {} not exists, please check!".format(mindrecord_file))
|
||||||
raise ValueError(mindrecord_file)
|
raise ValueError(mindrecord_file)
|
||||||
|
|
Loading…
Reference in New Issue