Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into nncase-studio
Browse files Browse the repository at this point in the history
  • Loading branch information
FusionBolt committed Nov 13, 2023
2 parents d6b32e0 + e39a9d2 commit adb25cc
Show file tree
Hide file tree
Showing 315 changed files with 5,894 additions and 3,663 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/compiler-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
- {name: x86_64-windows, os: windows-latest, shell: bash}

env:
VULKANSDK_VER: 1.2.182.0
VULKANSDK_VER: 1.3.268.0

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -211,8 +211,8 @@ jobs:

- name: Set up test environment (Linux)
run: |
wget https://sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/linux/vulkansdk-linux-x86_64-${VULKANSDK_VER}.tar.gz -O vulkansdk.tar.gz
tar xf vulkansdk.tar.gz
wget https://sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/linux/vulkansdk-linux-x86_64-${VULKANSDK_VER}.tar.xz -O vulkansdk.tar.xz
tar xf vulkansdk.tar.xz
sudo cp -P ${VULKANSDK_VER}/x86_64/lib/libvulkan.so* /usr/local/lib/
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-ubuntu-18.04-x86_64.zip -O swiftshader.zip
unzip swiftshader.zip
Expand All @@ -225,8 +225,8 @@ jobs:
- name: Set up test environment (Windows)
shell: pwsh
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/${env:VULKANSDK_VER}/windows/VulkanSDK-${env:VULKANSDK_VER}-Installer.exe -O VulkanSDK-Installer.exe
.\VulkanSDK-Installer.exe /S
# Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/${env:VULKANSDK_VER}/windows/VulkanSDK-${env:VULKANSDK_VER}-Installer.exe -O VulkanSDK-Installer.exe
# .\VulkanSDK-Installer.exe /S
Invoke-WebRequest -Uri https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-windows-2019-x86_64.zip -OutFile swiftshader.zip
Expand-Archive swiftshader.zip
Copy-Item swiftshader\lib\vk_swiftshader_icd.json swiftshader\bin\
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compiler-python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- {name: x86_64-windows, os: windows-latest, arch: x64}

env:
VULKANSDK_VER: 1.2.182.0
VULKANSDK_VER: 1.3.268.0

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ artifacts/
*.pidb
*.svclog
*.scc

*.bin
# Chutzpah Test files
_Chutzpah*

Expand Down Expand Up @@ -306,4 +306,4 @@ cmake-build-*
*gmodel_dump_dir*
*.ipynb_checkpoints*
# Auto generated files
# generated/
# generated/
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ endif()

if(NOT DEFINED NNCASE_VERSION_SUFFIX)
find_package (Git)

execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --dirty --tag
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand Down Expand Up @@ -274,5 +273,5 @@ if(BUILD_TESTING)
endif()

# Modules
#add_subdirectory(modules/k210)

#add_subdirectory(modules/vulkan)
5 changes: 3 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
<PackageVersion Include="OrtKISharp" Version="0.0.2" />
<PackageVersion Include="RazorLight" Version="2.3.0" />
<PackageVersion Include="Singulink.Collections.Weak" Version="1.0.2" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<PackageVersion Include="System.CommandLine.Hosting" Version="0.3.0-alpha.21216.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<PackageVersion Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="Tomlyn.Extensions.Configuration" Version="1.0.5" />
Expand Down
4 changes: 4 additions & 0 deletions docs/MixQuant.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ compiler.use_ptq(ptq_options)

```python
ptq_options.quant_scheme = ""
ptq_options.quant_scheme_strict_mode = False
ptq_options.export_quant_scheme = False
ptq_options.export_weight_range_by_channel = False
```

* **quant_scheme:导入量化参数配置文件的路径**
* **quant_scheme_strict_mode:是否严格按照quant_scheme执行量化**
* **export_quant_scheme:是否导出量化参数配置文件**
* **export_weight_range_by_channel:是否导出** `bychannel`形式的weights量化参数,为了保证量化效果,该参数建议设置为 `True`

Expand All @@ -36,6 +38,7 @@ compile_options.dump_ir = True

```python
ptq_options.quant_scheme = ""
ptq_options.quant_scheme_strict_mode = False
ptq_options.export_quant_scheme = True
ptq_options.export_weight_range_by_channel = True
```
Expand Down Expand Up @@ -108,6 +111,7 @@ ptq_options.export_weight_range_by_channel = True

```python
ptq_options.quant_scheme = "./QuantScheme.json" # path to your 'QuantScheme.json'
ptq_options.quant_scheme_strict_mode = False # Whether to strictly follow quant_scheme for quantification
ptq_options.export_quant_scheme = False
ptq_options.export_weight_range_by_channel = False # whatever
```
Expand Down
1 change: 1 addition & 0 deletions docs/USAGE_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ PTQTensorOptions类, 用于配置nncase PTQ选项,各属性说明如下
| dump_quant_error | bool || 是否生成量化损失,默认为False。在 `dump_ir=True`时生效 |
| dump_quant_error_symmetric_for_signed | bool || 是否生成使用范围对称的量化损失,默认为True。在 `dump_ir=True`时生效 |
| quant_scheme | string || 量化配置文件路径,默认为“ ”。在 `dump_ir=True`时生效 |
| quant_scheme_strict_mode | bool || 是否严格按照quant_scheme执行量化,默认为False。在 `quant_scheme`不为空时生效 |
| export_quant_scheme | bool || 是否导出量化配置文件,默认为False。在 `dump_ir=True`时生效 |
| export_weight_range_by_channel | bool || 导出量化配置文件时,是否按照channel统计权重的范围,默认为False。在 `dump_ir=True`时生效 |

Expand Down
1 change: 1 addition & 0 deletions docs/USAGE_v2_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ PTQTensorOptions is used to configure PTQ options. The details of all attributes
| dump_quant_error | bool | N | Specify whether dump quantification error, False by default. The parameters following worked when `dump_ir=True`. |
| dump_quant_error_symmetric_for_signed | bool | N | Specify whether dump quantification error by symmetric for signed number,True by default. |
| quant_scheme | string | N | specify the path of quantification scheme file,"" by default. |
| quant_scheme_strict_mode | bool | N | Specify whether strictly follow quant_scheme for quantification, False by default. |
| export_quant_scheme | bool | N | Specify whether export quantification scheme, False by default. |
| export_weight_range_by_channel | bool | N | Specify whether export weights range by channel, False by default. |

Expand Down
Binary file added examples/audio/tts_1.wav
Binary file not shown.
Binary file added examples/audio/tts_2.wav
Binary file not shown.
Binary file added examples/audio/tts_3.wav
Binary file not shown.
1 change: 1 addition & 0 deletions examples/user_guide/k230_simulate-EN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
" # mix quantize options\n",
" # more details in docs/MixQuant.md\n",
" ptq_options.quant_scheme = \"\"\n",
" ptq_options.quant_scheme_strict_mode = False\n",
" ptq_options.export_quant_scheme = False\n",
" ptq_options.export_weight_range_by_channel = False\n",
" ############################################\n",
Expand Down
1 change: 1 addition & 0 deletions examples/user_guide/k230_simulate-ZH.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
" # mix quantize options\n",
" # more details in docs/MixQuant.md\n",
" ptq_options.quant_scheme = \"\"\n",
" ptq_options.quant_scheme_strict_mode = False\n",
" ptq_options.export_quant_scheme = False\n",
" ptq_options.export_weight_range_by_channel = False\n",
" ############################################\n",
Expand Down
Loading

0 comments on commit adb25cc

Please sign in to comment.