Skip to content

Commit 5da340e

Browse files
authored
Add scripts for unittest (#8433)
1 parent 11aba32 commit 5da340e

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

scripts/unit_test/ci_unit.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
export paddle=$1
18+
export nlp_dir=/workspace/PaddleNLP
19+
cd $nlp_dir
20+
21+
if [ ! -d "unittest_logs" ];then
22+
mkdir unittest_logs
23+
fi
24+
25+
install_requirements() {
26+
python -m pip install -r requirements.txt
27+
python -m pip install -r requirements-dev.txt
28+
python -m pip install -r paddlenlp/experimental/autonlp/requirements.txt
29+
python -m pip uninstall paddlepaddle -y
30+
python -m pip install --no-cache-dir ${paddle}
31+
python -m pip install sacremoses
32+
python -m pip install parameterized
33+
python -m pip install loguru==0.6.0
34+
python -m pip install h5py
35+
python -m pip install paddleslim
36+
37+
python setup.py bdist_wheel
38+
python -m pip install dist/p****.whl
39+
cd csrc/
40+
python setup_cuda.py install
41+
cd ../
42+
43+
pip list
44+
}
45+
46+
set_env() {
47+
export NVIDIA_TF32_OVERRIDE=0
48+
export FLAGS_cudnn_deterministic=1
49+
export HF_ENDPOINT=https://hf-mirror.com
50+
}
51+
52+
install_requirements
53+
set_env
54+
pytest -v -n 8 --durations 20 --cov paddlenlp --cov-report xml:coverage.xml

0 commit comments

Comments
 (0)