diff --git a/.github/scripts/ci_workflow.py b/.github/scripts/ci_workflow.py index 5b689f979..16bc9b93e 100644 --- a/.github/scripts/ci_workflow.py +++ b/.github/scripts/ci_workflow.py @@ -89,7 +89,10 @@ def parse_test_config_for_path( scoped_test_name = None if index == len(candidate_groups) - 1: scoped_test_name = leaf_name - scoped = parse_test_config(yaml_file, candidate_group, scoped_test_name) + try: + scoped = parse_test_config(yaml_file, candidate_group, scoped_test_name) + except KeyError: + continue result.update(scoped) return result @@ -125,17 +128,33 @@ def is_model_compat_test(rel_path: str, file_path: Path) -> bool: return any(marker in contents for marker in markers) +def matches_test_regex(test_regex: str, rel_path: str) -> bool: + if re.match(test_regex, rel_path): + return True + return re.match(test_regex, PurePosixPath(rel_path).name) is not None + + +def should_skip_test(yaml_file: str | Path, rel_path: str) -> bool: + try: + config = parse_test_config_for_path(yaml_file, "tests", rel_path) + except KeyError: + return False + return bool(config.get("skip", False)) + + def list_tests(ignored_test_files: str | list[str], test_names: str, test_regex: str, tests_root: str | Path) -> tuple[list[str], list[str], list[str]]: tests_root = Path(tests_root) input_tests = [strip_py_suffix(name) for name in split_csv(test_names)] ignored_raw = ignored_test_files if isinstance(ignored_test_files, list) else split_csv(ignored_test_files) ignored_set = {strip_py_suffix(name) for name in ignored_raw} + yaml_file = Path(__file__).with_name("test.yaml") all_tests = { rel: path for path in tests_root.rglob("test_*.py") for rel in [str(path.relative_to(tests_root).with_suffix(""))] if rel not in ignored_set and path.stem not in ignored_set + if not should_skip_test(yaml_file, rel) } model_tests = { @@ -145,7 +164,7 @@ def list_tests(ignored_test_files: str | list[str], test_names: str, test_regex: and "mlx" not in rel and "ipex" not in rel and "xpu" not in rel - and re.match(test_regex, rel) + and matches_test_regex(test_regex, rel) and is_model_compat_test(rel, path) } @@ -157,7 +176,7 @@ def list_tests(ignored_test_files: str | list[str], test_names: str, test_regex: and "mlx" not in rel and "ipex" not in rel and "xpu" not in rel - and re.match(test_regex, rel) + and matches_test_regex(test_regex, rel) } mlx_tests = { @@ -165,7 +184,7 @@ def list_tests(ignored_test_files: str | list[str], test_names: str, test_regex: for rel in all_tests if ("mlx" in rel or "apple" in rel) and ((rel in input_tests) if input_tests else True) - and re.match(test_regex, rel) + and matches_test_regex(test_regex, rel) } return ( diff --git a/.github/scripts/test.yaml b/.github/scripts/test.yaml index 9aeb269bb..0df329164 100644 --- a/.github/scripts/test.yaml +++ b/.github/scripts/test.yaml @@ -2,6 +2,7 @@ common: py: 3.14t # common config gpu: 1 sm: 0 + skip: false tests: test_multi_gpu_inference: # per-test config @@ -18,4 +19,5 @@ tests/models: tests/kernels: test_asymmetric_real_models: - sm: '9.0' \ No newline at end of file + sm: '9.0' + skip: true # no SM90 card \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c5717909c..065d5003b 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -301,37 +301,6 @@ jobs: echo "--- uninstalling required deps..." python .github/scripts/ci_deps.py uninstall ${{ matrix.test_script }} - # - name: Install Evalution - # run: | - # uv pip install git+https://x-access-token:${{ secrets.REPO_TOKEN }}@github.com/ModelCloud/Evalution.git - # - name: Install requirements - # run: | - # bash -c "$(curl -L http://${RUNNER}/scripts/env/init_compiler_no_env.sh)" @ ${{ needs.check-vm.outputs.cuda_version }} ${{ env.TORCH_VERSION }} $python_version${{ env.PYTHON_VERSION }} - - # - name: Download source from local - # continue-on-error: true - # run: | - # curl -s -O http://$RUNNER/whl/${{ env.repo }}/${{ github.run_id }}/gptqmodel_source.tar.gz - # ls -ahl . - # sha256=$(sha256sum $file_name) - # echo "sha256=$sha256" - # echo "SOURCE_DOWNLOADED=1" >> $GITHUB_ENV - - # - name: Download source from github - # if: env.SOURCE_DOWNLOADED == '' && !cancelled() - # uses: actions/download-artifact@v8 - # with: - # name: source - # path: dist - # run-id: ${{ github.run_id }} - - # - name: Uncompress source - # continue-on-error: true - # run: | - # find . -mindepth 1 ! -name "gptqmodel_source.tar.gz" -exec rm -rf {} + - # ls -ahl . - # tar -zxf gptqmodel_source.tar.gz - - name: Install package from source run: | uv pip uninstall gptqmodel || true @@ -394,12 +363,14 @@ jobs: run: | if grep -q '^# GPU=-1$' "${{ matrix.test_script }}"; then echo "SKIP_GPU_ALLOCATION=true" >> "$GITHUB_ENV" + elif [[ "${{ matrix.test_script }}" == *xpu* ]]; then + echo "SKIP_GPU_ALLOCATION=true" >> "$GITHUB_ENV" else echo "SKIP_GPU_ALLOCATION=false" >> "$GITHUB_ENV" fi - name: Find suitable GPU - if: ${{ !contains(matrix.test_script, 'ipex') && !contains(matrix.test_script, 'xpu') && !cancelled() && env.SKIP_GPU_ALLOCATION != 'true' }} + if: ${{ !cancelled() && env.SKIP_GPU_ALLOCATION != 'true' }} run: | python .github/scripts/ci_gpu.py allocate \ --base-url "${GPU_ALLOCATOR_URL}" \ @@ -413,9 +384,6 @@ jobs: - name: Run tests run: | extra_args=() - if [[ "${{ matrix.test_script }}" == *ipex* ]]; then - extra_args+=(--clear-cuda) - fi if [[ "${{ matrix.test_script }}" == *xpu* ]]; then extra_args+=(--clear-cuda --xpu-mode) fi @@ -436,7 +404,7 @@ jobs: --test-script "${{ matrix.test_script }}" - name: Release GPU - if: always() && !contains(matrix.test_script, 'ipex') && !contains(matrix.test_script, 'xpu') && env.SKIP_GPU_ALLOCATION != 'true' + if: always() && env.SKIP_GPU_ALLOCATION != 'true' run: | python .github/scripts/ci_gpu.py release \ --base-url "${GPU_ALLOCATOR_URL}" \ @@ -628,6 +596,8 @@ jobs: run: | if grep -q '^# GPU=-1$' "${{ matrix.test_script }}"; then echo "SKIP_GPU_ALLOCATION=true" >> "$GITHUB_ENV" + elif [[ "${{ matrix.test_script }}" == *xpu* ]]; then + echo "SKIP_GPU_ALLOCATION=true" >> "$GITHUB_ENV" else echo "SKIP_GPU_ALLOCATION=false" >> "$GITHUB_ENV" fi