Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pytorch test #1029

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test_benchmark/PyTorch/ACG_UnitTest/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main():

model.eval()

data = np.load("input.npy")
data = np.load("../dataset/ACG_UnitTest/input.npy")
data = torch.Tensor(data)
result = model(data)

Expand Down
2 changes: 1 addition & 1 deletion test_benchmark/PyTorch/ACG_UnitTest/pd_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


f = open('result.txt', 'w')
f.write("======BasicTemporalModel: \n")
f.write("======ACG_UnitTest: \n")
try:
paddle.enable_static()
exe = paddle.static.Executor(paddle.CPUPlace())
Expand Down
9 changes: 5 additions & 4 deletions test_benchmark/PyTorch/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ find . -name "pd_model_script" | xargs rm -rf
find . -name "run.log" | xargs rm -rf
find . -name "run.err" | xargs rm -rf

num_of_models=$(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset' | wc -l)
num_of_pb_files=`expr $(find . -name "convert.py" | wc -l) + $(find . -name "convert_trace.py" | wc -l)`
models=$(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset' | grep -v 'MockingBird')
num_of_models=$(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset' | grep -v 'MockingBird' | wc -l)
num_of_pb_files=`expr $(find . -name "convert.py" | wc -l) + $(find . -name "convert_trace.py" | grep -v 'MockingBird' | wc -l)`

if [ $num_of_pb_files -ne $num_of_models ]
then
Expand All @@ -16,7 +17,7 @@ then
fi

counter=1
for model in $(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset')
for model in $models
do
echo "[X2Paddle-PyTorch] ${counter}/${num_of_models} $model ..."
cd $model
Expand All @@ -33,7 +34,7 @@ done
wait
rm -rf result.txt
touch result.txt
for model in $(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset')
for model in $models
do
cat ${model}/result.txt >> ./result.txt
done
Expand Down
9 changes: 5 additions & 4 deletions test_benchmark/PyTorch/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ find . -name "pd_model_script" | xargs rm -rf
find . -name "run.log" | xargs rm -rf
find . -name "run.err" | xargs rm -rf

num_of_models=$(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset' | wc -l)
num_of_pb_files=`expr $(find . -name "convert.py" | wc -l) + $(find . -name "convert_trace.py" | wc -l)`
models=$(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset' | grep -v 'MockingBird')
num_of_models=$(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset' | grep -v 'MockingBird' | wc -l)
num_of_pb_files=`expr $(find . -name "convert.py" | wc -l) + $(find . -name "convert_trace.py" | grep -v 'MockingBird' | wc -l)`

if [ $num_of_pb_files -ne $num_of_models ]
then
Expand All @@ -27,7 +28,7 @@ then
fi

counter=1
for model in $(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset')
for model in $models
do
echo "[X2Paddle-PyTorch] ${counter}/${num_of_models} $model ..."
cd $model
Expand All @@ -44,7 +45,7 @@ done
wait
rm -rf result.txt
touch result.txt
for model in $(ls -d */ | grep -v 'tools' | grep -v 'output' | grep -v 'dataset')
for model in $models
do
cat ${model}/result.txt >> ./result.txt
done
Expand Down