Skip to content

Commit 907c538

Browse files
Add pr hyperlink and relative link scan job (#2326)
* add pr hyperlink and relative link scan job Signed-off-by: chensuyue <suyue.chen@intel.com> --------- Signed-off-by: chensuyue <suyue.chen@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 49c6a89 commit 907c538

File tree

57 files changed

+272
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+272
-740
lines changed

.azure-pipelines/scripts/models/update_yaml_config.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,6 @@ def update_yaml_config_tuning(
134134
prev_strategy = tuning_config.get("strategy", {})
135135
strategy_name = prev_strategy.get("name", None)
136136
prev_strategy.update({"name": strategy})
137-
if strategy == "sigopt":
138-
prev_strategy.update(
139-
{
140-
"sigopt_api_token": strategy_token,
141-
"sigopt_project_id": "lpot",
142-
"sigopt_experiment_name": "lpot-tune",
143-
}
144-
)
145137
if strategy == "hawq":
146138
prev_strategy.update({"loss": "CrossEntropyLoss"})
147139
print(f"Changed {strategy_name} to {strategy}")

.github/checkgroup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ subprojects:
3636
paths:
3737
- "neural_compressor/common/**"
3838
- "neural_compressor/torch/**"
39-
- "examples/3.x_api/pytorch/nlp/huggingface_models/language-modeling/quantization/llm/**"
39+
- "examples/pytorch/nlp/huggingface_models/language-modeling/quantization/llm/**"
4040
- "setup.py"
4141
- "requirements_pt.txt"
4242
- ".azure-pipelines/scripts/models/**"

.github/workflows/pr-link-scan.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Check hyperlinks and relative path validity
5+
6+
permissions:
7+
contents: read
8+
9+
on:
10+
pull_request:
11+
branches: [master]
12+
types: [opened, reopened, ready_for_review, synchronize]
13+
14+
jobs:
15+
check-the-validity-of-hyperlinks-in-README:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Clean Up Working Directory
19+
run: sudo rm -rf ${{github.workspace}}/*
20+
21+
- name: Checkout Repo
22+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Check the Validity of Hyperlinks
27+
env:
28+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
29+
run: |
30+
cd ${{github.workspace}}
31+
delay=1
32+
fail="FALSE"
33+
merged_commit=$(git log -1 --format='%H')
34+
changed_files="$(git diff --name-status --diff-filter=ARM $BASE_SHA ${merged_commit} | awk '/\.md$/ {print $NF}')"
35+
if [ -n "$changed_files" ]; then
36+
for changed_file in $changed_files; do
37+
# echo $changed_file
38+
url_lines=$(grep -H -Eo '\]\(http[s]?://[^)]+\)' "$changed_file") || true
39+
if [ -n "$url_lines" ]; then
40+
for url_line in $url_lines; do
41+
# echo $url_line
42+
url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//')
43+
path=$(echo "$url_line"|cut -d':' -f1 | cut -d'/' -f2-)
44+
if [[ "$url" == "https://dgpu-docs.intel.com/installation-guides/ubuntu/ubuntu-focal-dc.html" || "$url" == "https://ai.cloud.intel.com/" ]]; then
45+
echo "Link "$url" from ${{github.workspace}}/$path needs to be verified by real person."
46+
else
47+
sleep $delay
48+
response=$(curl -L -s -o /dev/null -w "%{http_code}" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" "$url")|| true
49+
if [ "$response" -ne 200 ]; then
50+
echo "**********Validation $url failed ($response), try again**********"
51+
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url") || true
52+
if [ "$response_retry" -eq 200 ]; then
53+
echo "*****Retry successfully*****"
54+
else
55+
echo "******Retry $url failed ($response_retry), add simulated browser requests******"
56+
response_browser=$(curl -s -o /dev/null -w "%{http_code}" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" "$url")|| true
57+
if [ "$response_browser" -eq 200 ]; then
58+
echo "*****Retry successfully*****"
59+
else
60+
echo -e "::error:: Invalid link ($response_retry) from ${{github.workspace}}/$(echo "$url_line"|cut -d':' -f1): $url"
61+
fail="TRUE"
62+
fi
63+
fi
64+
fi
65+
fi
66+
done
67+
fi
68+
done
69+
else
70+
echo "No changed .md file."
71+
fi
72+
73+
if [[ "$fail" == "TRUE" ]]; then
74+
exit 1
75+
else
76+
echo "All hyperlinks are valid."
77+
fi
78+
shell: bash
79+
80+
check-the-validity-of-relative-path:
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Clean up Working Directory
84+
run: sudo rm -rf ${{github.workspace}}/*
85+
86+
- name: Checkout Repo
87+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2
88+
with:
89+
fetch-depth: 0
90+
91+
- name: Checking Relative Path Validity
92+
env:
93+
REPO_NAME: ${{ github.event.pull_request.head.repo.full_name }}
94+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
95+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
96+
run: |
97+
cd ${{github.workspace}}
98+
delay=1
99+
fail="FALSE"
100+
branch="https://github.com/$REPO_NAME/blob/$HEAD_REF"
101+
102+
merged_commit=$(git log -1 --format='%H')
103+
changed_files="$(git diff --name-status --diff-filter=ARM $BASE_SHA ${merged_commit} | awk '/\.md$/ {print $NF}')"
104+
png_lines=$(grep -Eo '\]\([^)]+\)' --include='*.md' -r .|grep -Ev 'http' | grep -Ev 'shape=' | grep -Ev 'mailto:inc.maintainers@intel.com')
105+
if [ -n "$png_lines" ]; then
106+
for png_line in $png_lines; do
107+
# echo "No.1----->png_line is $png_line"
108+
refer_path=$(echo "$png_line"|cut -d':' -f1 | cut -d'/' -f2-)
109+
png_path=$(echo "$png_line"|cut -d '(' -f2 | cut -d ')' -f1)
110+
# echo "No.2----->refer_path is $refer_path, png_path is $png_path"
111+
112+
if [[ "${png_path:0:1}" == "/" ]]; then
113+
# absolute path
114+
check_path=$(echo "${png_path:1}" | cut -d '#' -f1)
115+
# echo "No.3----->check_path is $check_path"
116+
else
117+
# relative path
118+
check_path=${refer_path}
119+
relative_path=$(echo "$png_path" | cut -d '#' -f1)
120+
if [ -n "$relative_path" ]; then check_path=$(dirname "$refer_path")/$relative_path; fi
121+
# echo "No.4----->check_path is $check_path"
122+
fi
123+
124+
if [ -e "$check_path" ]; then
125+
real_path=$(realpath $check_path)
126+
# echo "No.5----->real_path is $real_path"
127+
if [[ "$png_path" == *#* ]]; then
128+
if [ -n "$changed_files" ] && echo "$changed_files" | grep -q "^${refer_path}$"; then
129+
url_dev=$branch$(echo "$real_path" | sed 's|.*/neural-compressor||')#$(echo "$png_path" | cut -d '#' -f2)
130+
# echo "No.6----->url_dev is $url_dev"
131+
sleep $delay
132+
response=$(curl -I -L -s -o /dev/null -w "%{http_code}" "$url_dev")
133+
if [ "$response" -ne 200 ]; then
134+
echo "**********Validation failed ($response), try again**********"
135+
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url_dev")
136+
if [ "$response_retry" -eq 200 ]; then
137+
echo "*****Retry successfully*****"
138+
else
139+
echo -e "::error:: Invalid path ($response_retry) from ${{github.workspace}}/$refer_path: $png_path"
140+
fail="TRUE"
141+
fi
142+
else
143+
echo "Validation succeed $png_line"
144+
fi
145+
fi
146+
fi
147+
else
148+
echo -e "::error:: ${{github.workspace}}/$refer_path:$png_path does not exist."
149+
fail="TRUE"
150+
fi
151+
done
152+
fi
153+
154+
if [[ "$fail" == "TRUE" ]]; then
155+
exit 1
156+
else
157+
echo "All relative path are valid."
158+
fi
159+
shell: bash

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ repos:
134134
exclude: |
135135
(?x)^(
136136
examples/.*(txt|patch)|
137-
examples/onnxrt/nlp/huggingface_model/text_generation/llama/quantization/ptq_static/prompt.json|
137+
examples/deprecated/onnxrt/nlp/huggingface_model/text_generation/llama/quantization/ptq_static/prompt.json|
138138
neural_compressor/torch/algorithms/fp8_quant/internal/diffusion_evaluation/SR_evaluation/imagenet1000_clsidx_to_labels.txt|
139139
neural_compressor/evaluation/hf_eval/datasets/cnn_validation.json|
140140
neural_compressor/torch/algorithms/fp8_quant/.+|

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Intel® Neural Compressor aims to provide popular model compression techniques s
1919
as well as Intel extensions such as [Intel Extension for TensorFlow](https://github.com/intel/intel-extension-for-tensorflow) and [Intel Extension for PyTorch](https://github.com/intel/intel-extension-for-pytorch).
2020
In particular, the tool provides the key features, typical examples, and open collaborations as below:
2121

22-
* Support a wide range of Intel hardware such as [Intel Gaudi Al Accelerators](https://www.intel.com/content/www/us/en/products/details/processors/ai-accelerators/gaudi-overview.html), [Intel Core Ultra Processors](https://www.intel.com/content/www/us/en/products/details/processors/core-ultra.html), [Intel Xeon Scalable Processors](https://www.intel.com/content/www/us/en/products/details/processors/xeon/scalable.html), [Intel Xeon CPU Max Series](https://www.intel.com/content/www/us/en/products/details/processors/xeon/max-series.html), [Intel Data Center GPU Flex Series](https://www.intel.com/content/www/us/en/products/details/discrete-gpus/data-center-gpu/flex-series.html), and [Intel Data Center GPU Max Series](https://www.intel.com/content/www/us/en/products/details/discrete-gpus/data-center-gpu/max-series.html) with extensive testing;
22+
* Support a wide range of Intel hardware such as [Intel Gaudi Al Accelerators](https://www.intel.com/content/www/us/en/products/details/processors/ai-accelerators/gaudi.html), [Intel Core Ultra Processors](https://www.intel.com/content/www/us/en/products/details/processors/core-ultra.html), [Intel Xeon Scalable Processors](https://www.intel.com/content/www/us/en/products/details/processors/xeon/scalable.html), [Intel Xeon CPU Max Series](https://www.intel.com/content/www/us/en/products/details/processors/xeon/max-series.html), [Intel Data Center GPU Flex Series](https://www.intel.com/content/www/us/en/products/overview.html), and [Intel Data Center GPU Max Series](https://www.intel.com/content/www/us/en/products/overview.html) with extensive testing;
2323
support AMD CPU, ARM CPU, and NVidia GPU through ONNX Runtime with limited testing; support NVidia GPU for some WOQ algorithms like AutoRound and HQQ.
2424

2525
* Validate popular LLMs such as [LLama2](/examples/deprecated/pytorch/nlp/huggingface_models/language-modeling/quantization/llm), [Falcon](/examples/deprecated/pytorch/nlp/huggingface_models/language-modeling/quantization/llm), [GPT-J](/examples/deprecated/pytorch/nlp/huggingface_models/language-modeling/quantization/llm), [Bloom](/examples/deprecated/pytorch/nlp/huggingface_models/language-modeling/quantization/llm), [OPT](/examples/deprecated/pytorch/nlp/huggingface_models/language-modeling/quantization/llm), and more than 10,000 broad models such as [Stable Diffusion](/examples/deprecated/pytorch/nlp/huggingface_models/text-to-image/quantization), [BERT-Large](/examples/deprecated/pytorch/nlp/huggingface_models/text-classification/quantization/ptq_static/fx), and [ResNet50](/examples/deprecated/pytorch/image_recognition/torchvision_models/quantization/ptq/cpu/fx) from popular model hubs such as [Hugging Face](https://huggingface.co/), [Torch Vision](https://pytorch.org/vision/stable/index.html), and [ONNX Model Zoo](https://github.com/onnx/models#models), with automatic [accuracy-driven](/docs/source/design.md#workflow) quantization strategies
2626

27-
* Collaborate with cloud marketplaces such as [Google Cloud Platform](https://console.cloud.google.com/marketplace/product/bitnami-launchpad/inc-tensorflow-intel?project=verdant-sensor-286207), [Amazon Web Services](https://aws.amazon.com/marketplace/pp/prodview-yjyh2xmggbmga#pdp-support), and [Azure](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/bitnami.inc-tensorflow-intel), software platforms such as [Alibaba Cloud](https://www.intel.com/content/www/us/en/developer/articles/technical/quantize-ai-by-oneapi-analytics-on-alibaba-cloud.html), [Tencent TACO](https://new.qq.com/rain/a/20221202A00B9S00) and [Microsoft Olive](https://github.com/microsoft/Olive), and open AI ecosystem such as [Hugging Face](https://huggingface.co/blog/intel), [PyTorch](https://pytorch.org/tutorials/recipes/intel_neural_compressor_for_pytorch.html), [ONNX](https://github.com/onnx/models#models), [ONNX Runtime](https://github.com/microsoft/onnxruntime), and [Lightning AI](https://github.com/Lightning-AI/lightning/blob/master/docs/source-pytorch/advanced/post_training_quantization.rst)
27+
* Collaborate with cloud marketplaces such as [Google Cloud Platform](https://console.cloud.google.com/marketplace/product/bitnami-launchpad/inc-tensorflow-intel?project=verdant-sensor-286207), [Amazon Web Services](https://aws.amazon.com/marketplace/pp/prodview-yjyh2xmggbmga#pdp-support), and [Azure](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/bitnami.inc-tensorflow-intel), software platforms such as [Tencent TACO](https://new.qq.com/rain/a/20221202A00B9S00) and [Microsoft Olive](https://github.com/microsoft/Olive), and open AI ecosystem such as [Hugging Face](https://huggingface.co/blog/intel), [PyTorch](https://pytorch.org/tutorials/recipes/intel_neural_compressor_for_pytorch.html), [ONNX](https://github.com/onnx/models#models), [ONNX Runtime](https://github.com/microsoft/onnxruntime), and [Lightning AI](https://github.com/Lightning-AI/lightning/blob/master/docs/source-pytorch/advanced/post_training_quantization.rst)
2828

2929
## What's New
3030
* [2025/10] [MXFP8 / MXFP4 quantization](./docs/source/3x/PT_MXQuant.md) experimental support
@@ -115,8 +115,8 @@ model = load(
115115
<td colspan="2" align="center"><a href="./docs/source/3x/design.md#architecture">Architecture</a></td>
116116
<td colspan="2" align="center"><a href="./docs/source/3x/design.md#workflows">Workflow</a></td>
117117
<td colspan="2" align="center"><a href="https://intel.github.io/neural-compressor/latest/docs/source/api-doc/apis.html">APIs</a></td>
118-
<td colspan="1" align="center"><a href="./docs/source/3x/llm_recipes.md">LLMs Recipes</a></td>
119-
<td colspan="1" align="center"><a href="./examples/3.x_api/README.md">Examples</a></td>
118+
<td colspan="1" align="center"><a href="./docs/source/llm_recipes.md">LLMs Recipes</a></td>
119+
<td colspan="1" align="center"><a href="./examples/README.md">Examples</a></td>
120120
</tr>
121121
</tbody>
122122
<thead>
@@ -190,7 +190,6 @@ model = load(
190190
191191
## Additional Content
192192

193-
* [Release Information](./docs/source/releases_info.md)
194193
* [Contribution Guidelines](./docs/source/CONTRIBUTING.md)
195194
* [Legal Information](./docs/source/legal_information.md)
196195
* [Security Policy](SECURITY.md)

docs/source/3x/PT_MixedPrecision.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The 4th Gen Intel® Xeon® Scalable processor supports FP16 instruction set arch
1818
Further details can be found in the [Intel AVX512 FP16 Guide](https://www.intel.com/content/www/us/en/content-details/669773/intel-avx-512-fp16-instruction-set-for-intel-xeon-processor-based-products-technology-guide.html) published by Intel.
1919

2020
The latest Intel Xeon processors deliver flexibility of Intel Advanced Matrix Extensions (Intel AMX) ,an accelerator that improves the performance of deep learning(DL) training and inference, making it ideal for workloads like NLP, recommender systems, and image recognition. Developers can code AI functionality to take advantage of the Intel AMX instruction set, and they can code non-AI functionality to use the processor instruction set architecture (ISA). Intel has integrated the Intel® oneAPI Deep Neural Network Library (oneDNN), its oneAPI DL engine, into Pytorch.
21-
Further details can be found in the [Intel AMX Document](https://www.intel.com/content/www/us/en/content-details/785250/accelerate-artificial-intelligence-ai-workloads-with-intel-advanced-matrix-extensions-intel-amx.html) published by Intel.
21+
Further details can be found in the [Intel AMX Document](https://www.intel.com/content/www/us/en/content-details/785250/accelerate-artificial-intelligence-workloads-with-intel-advanced-matrix-extensions.html) published by Intel.
2222

2323
<p align="center" width="100%">
2424
<img src="./imgs/data_format.png" alt="Architecture" height=230>
@@ -107,5 +107,5 @@ best_model = autotune(model=build_torch_model(), tune_config=custom_tune_config,
107107

108108
## Examples
109109

110-
Users can also refer to [examples](https://github.com/intel/neural-compressor/blob/master/examples/3.x_api/pytorch/cv/mixed_precision
110+
Users can also refer to [examples](https://github.com/intel/neural-compressor/blob/master/examples/pytorch/cv/mixed_precision
111111
) on how to quantize a model with Mixed Precision.

docs/source/3x/PT_SmoothQuant.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ run_fn(prepared_model)
4646
q_model = convert(prepared_model)
4747
```
4848

49-
To get more information, please refer to [examples](https://github.com/intel/neural-compressor/blob/master/examples/3.x_api/pytorch/nlp/huggingface_models/language-modeling/quantization/smooth_quant).
49+
To get more information, please refer to [examples](https://github.com/intel/neural-compressor/blob/master/examples/pytorch/nlp/huggingface_models/language-modeling/quantization/smooth_quant).
5050

5151

5252
## Validated Models
@@ -99,8 +99,6 @@ A list of models that achieved a <1% accuracy drop is shown below.
9999
| databricks/dolly-v2-3b* | 0.6297 | 0.6247 | alpha=0.5, Ipex 2.1 |
100100
| tiiuae/falcon-7b-instruct | 0.6437 | 0.6392 | alpha=0.7, Pytorch |
101101

102-
Please refer to the step-by-step [instruction](../../examples/pytorch/nlp/huggingface_models/language-modeling/quantization/llm/ipex/README.md) for details.
103-
104102
Please note that for models with asterisk(*), we have set all add ops to FP32 during quantization step to achieve desirable results.
105103

106104

docs/source/3x/PT_StaticQuant.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ q_model = convert(prepared_model)
6868

6969
#### Model Examples
7070

71-
Users could refer to [examples](https://github.com/intel/neural-compressor/blob/master/examples/3.x_api/pytorch/nlp/huggingface_models/language-modeling/quantization/static_quant/ipex) on how to quantize a new model.
71+
Users could refer to [examples](https://github.com/intel/neural-compressor/blob/master/examples/pytorch/nlp/huggingface_models/language-modeling/quantization/static_quant/ipex) on how to quantize a new model.
7272

7373

7474
### Static Quantization with PT2E Backend
@@ -105,4 +105,4 @@ opt_model = torch.compile(q_model)
105105
106106
#### Model Examples with PT2E
107107

108-
Users could refer to [cv examples](https://github.com/intel/neural-compressor/blob/master/examples/3.x_api/pytorch/cv/static_quant) and [llm examples](https://github.com/intel/neural-compressor/blob/master/examples/3.x_api/pytorch/nlp/huggingface_models/language-modeling/quantization/static_quant/pt2e) on how to quantize a new model.
108+
Users could refer to [cv examples](https://github.com/intel/neural-compressor/blob/master/examples/pytorch/cv/static_quant) and [llm examples](https://github.com/intel/neural-compressor/blob/master/examples/pytorch/nlp/huggingface_models/language-modeling/quantization/static_quant/pt2e) on how to quantize a new model.

0 commit comments

Comments
 (0)