Skip to content

Commit f4cf1c8

Browse files
committed
Fix model unittest CI
1 parent 4a99803 commit f4cf1c8

File tree

11 files changed

+40
-17
lines changed

11 files changed

+40
-17
lines changed

.github/workflows/ce-unittest-gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
pip config set global.cache-dir "/home/.cache/pip"
103103
set -e
104104
cd /workspace/PaddleFormers && git config --global --add safe.directory $PWD
105-
timeout 40m bash scripts/unit_test/ci_unit.sh ${paddle_whl} true
105+
timeout 40m bash scripts/unit_test/ci_unittest.sh ${paddle_whl} true
106106
'
107107
108108
- name: Upload Allure-reports & Logs

.github/workflows/debug-unittest-gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ jobs:
9696
echo "work_path: $work_dir/PaddleFormers"
9797
echo "work_path in docker: /workspace/PaddleFormers"
9898
echo "cmd: "
99-
echo "bash scripts/unit_test/ci_unit.sh ${paddle_whl}"
99+
echo "bash scripts/unit_test/ci_unittest.sh ${paddle_whl}"
100100
echo "or python -m pytest fail_case_name"
101101
echo "docker rm -f $container_name"

.github/workflows/model-unittest-gpu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Model Unittest GPU CI
22

33
on:
44
pull_request:
5-
push:
65
schedule:
76
- cron: "0 18 * * *"
87
workflow_call:
@@ -112,7 +111,8 @@ jobs:
112111
cd /workspace/PaddleFormers && git config --global --add safe.directory $PWD
113112
source $work_dir/../../../proxy
114113
source $work_dir/../../../AISTUDIO_ACCESS_TOKEN
115-
timeout 30m bash scripts/unit_test/ci_model_unit.sh ${paddle_whl}
114+
cp -r $work_dir/../../../models ./models
115+
timeout 30m bash scripts/unit_test/ci_model_unittest.sh ${paddle_whl}
116116
'
117117
118118
- name: Upload Products

.github/workflows/unittest-gpu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Unittest GPU CI
22

33
on:
44
pull_request:
5-
push:
65
schedule:
76
- cron: "0 18 * * *"
87
workflow_call:
@@ -56,6 +55,7 @@ jobs:
5655
run: |
5756
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
5857
echo "container_name=${container_name}" >> "$GITHUB_ENV"
58+
echo "Workspace path: ${{ github.workspace }}"
5959
docker run -d -t --name ${container_name} --net=host -v /dev/shm:/dev/shm --shm-size=32G \
6060
-v $work_dir/../../..:$work_dir/../../.. \
6161
-v $work_dir:/workspace \
@@ -112,7 +112,7 @@ jobs:
112112
cd /workspace/PaddleFormers && git config --global --add safe.directory $PWD
113113
source $work_dir/../../../proxy
114114
source $work_dir/../../../AISTUDIO_ACCESS_TOKEN
115-
timeout 30m bash scripts/unit_test/ci_unit.sh ${paddle_whl}
115+
timeout 30m bash scripts/unit_test/ci_unittest.sh ${paddle_whl}
116116
'
117117
118118
- name: Upload Products

scripts/regression/test_dpo.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
TRAIN_PATH = "./examples"
2727
CONFIG_PATH = "./examples/config"
2828
OUTPUT_DIR = tempfile.TemporaryDirectory().name
29-
MODEL_NAME_OR_PATH = "PaddleFormers/tiny-random-qwen3"
29+
MODEL_NAME_OR_PATH = "./models/tiny-random-qwen3"
3030

3131
os.environ["NVIDIA_TF32_OVERRIDE"] = "0"
3232
os.environ["NCCL_ALGO"] = "Tree"
@@ -119,7 +119,7 @@ def test_dpo_full(self):
119119
train_path,
120120
updated_config_path,
121121
]
122-
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
122+
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150)
123123

124124
# test training result
125125
self.dpotrain_tester.assert_result(training_p.returncode, training_p.stdout)
@@ -153,7 +153,7 @@ def test_dpo_lora(self):
153153
train_path,
154154
updated_config_path,
155155
]
156-
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
156+
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150)
157157

158158
# test training result
159159
self.dpotrain_tester.assert_result(training_p.returncode, training_p.stdout)
@@ -177,7 +177,9 @@ def test_dpo_lora(self):
177177
"--output_path",
178178
lora_merge_output_dir,
179179
]
180-
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
180+
lora_merge_p = subprocess.run(
181+
lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150
182+
)
181183
self.dpotrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)
182184

183185
# test lora_merge_model generate

scripts/regression/test_sft.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
TRAIN_PATH = "./examples"
2727
CONFIG_PATH = "./examples/config"
2828
OUTPUT_DIR = tempfile.TemporaryDirectory().name
29-
MODEL_NAME_OR_PATH = "PaddleFormers/tiny-random-qwen3"
29+
MODEL_NAME_OR_PATH = "./models/tiny-random-qwen3"
3030

3131
os.environ["NVIDIA_TF32_OVERRIDE"] = "0"
3232
os.environ["NCCL_ALGO"] = "Tree"
@@ -123,7 +123,7 @@ def test_sft_full(self):
123123
train_path,
124124
updated_config_path,
125125
]
126-
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
126+
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150)
127127

128128
# test training result
129129
self.sfttrain_tester.assert_result(training_p.returncode, training_p.stdout)
@@ -133,7 +133,7 @@ def test_sft_full(self):
133133
self.sfttrain_tester.assert_loss(training_p.stdout, EXCEPTED_LOSS)
134134

135135
# test model resume
136-
reusme_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
136+
reusme_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150)
137137
self.sfttrain_tester.assert_result(reusme_p.returncode, reusme_p.stdout)
138138

139139
EXCEPTED_LOSS = 9.550503
@@ -172,7 +172,7 @@ def test_sft_lora(self):
172172
train_path,
173173
updated_config_path,
174174
]
175-
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
175+
training_p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150)
176176

177177
# test training result
178178
self.sfttrain_tester.assert_result(training_p.returncode, training_p.stdout)
@@ -200,7 +200,9 @@ def test_sft_lora(self):
200200
"--output_path",
201201
lora_merge_output_dir,
202202
]
203-
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
203+
lora_merge_p = subprocess.run(
204+
lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=150
205+
)
204206
self.sfttrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)
205207

206208
# test lora_merge_model generate

scripts/unit_test/ci_model_unit.sh renamed to scripts/unit_test/ci_model_unittest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ install_requirements() {
3333
python -m pip install -r requirements-dev.txt
3434
python -m pip install -r tests/requirements.txt
3535
python -m pip uninstall paddlepaddle paddlepaddle_gpu -y
36-
python -m pip install --no-cache-dir ${paddle} --no-dependencies
36+
python -m pip install --no-cache-dir ${paddle} --no-dependencies --progress-bar off
3737
python -c "import paddle;print('paddle');print(paddle.__version__);print(paddle.version.show())" >> ${log_path}/commit_info.txt
3838

3939
python setup.py bdist_wheel > /dev/null

scripts/unit_test/ci_unit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ install_requirements() {
3232
python -m pip install -r requirements-dev.txt
3333
python -m pip install -r tests/requirements.txt
3434
python -m pip uninstall paddlepaddle paddlepaddle_gpu -y
35-
python -m pip install --no-cache-dir ${paddle} --no-dependencies
35+
python -m pip install --no-cache-dir ${paddle} --no-dependencies --progress-bar off
3636
python -c "import paddle;print('paddle');print(paddle.__version__);print(paddle.version.show())" >> ${log_path}/commit_info.txt
3737

3838
python setup.py bdist_wheel > /dev/null

tests/transformers/auto/test_configuration.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
from paddleformers.utils.download import DownloadSource
2727
from paddleformers.utils.env import CONFIG_NAME
2828
from tests.testing_utils import set_proxy
29+
from tests.testing_utils import (
30+
require_paddle_at_least_2_gpu,
31+
require_paddle_at_least_8_gpu,
32+
skip_for_none_ce_case,
33+
)
2934

3035
from ...utils.test_module.custom_configuration import CustomConfig
3136

@@ -79,6 +84,7 @@ def test_from_modelscope(self):
7984
# config = AutoConfig.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="text_encoder")
8085
# self.assertEqual(config.hidden_size, 768)
8186

87+
@skip_for_none_ce_case
8288
def test_load_from_legacy_config(self):
8389
number = random.randint(0, 10000)
8490
legacy_config = {"init_class": "BertModel", "hidden_size": number}
@@ -119,6 +125,7 @@ def test_from_pretrained_cache_dir(self):
119125
# check against double appending model_name in cache_dir
120126
self.assertFalse(os.path.exists(os.path.join(tempdir, model_id, model_id)))
121127

128+
@skip_for_none_ce_case
122129
def test_load_from_custom_arch(self):
123130
config_dict = {
124131
"alibi": False,

tests/transformers/test_configuration_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
PretrainedConfig,
2424
attribute_map,
2525
)
26+
from tests.testing_utils import (
27+
require_paddle_at_least_2_gpu,
28+
require_paddle_at_least_8_gpu,
29+
skip_for_none_ce_case,
30+
)
2631
from paddleformers.transformers.model_utils import PretrainedModel
2732
from paddleformers.utils import CONFIG_NAME
2833
from paddleformers.utils.download import DownloadSource
@@ -154,6 +159,7 @@ def test_from_pretrained_cache_dir(self):
154159
# check against double appending model_name in cache_dir
155160
self.assertFalse(os.path.exists(os.path.join(tempdir, model_id, model_id)))
156161

162+
@skip_for_none_ce_case
157163
@set_proxy(DownloadSource.HUGGINGFACE)
158164
def test_load_from_hf(self):
159165
"""test load config from hf"""

0 commit comments

Comments
 (0)