test: 6.42.3 集成测试合并 #1

Merged
liangliangou merged 1 commits from test into dev 2025-12-02 10:21:04 +08:00
5 changed files with 21 additions and 21 deletions

View File

@ -7,11 +7,11 @@ import os
import pytest
from pathlib import Path
from netrans import Netrans
from quantize_types import QuantizerType
from netrans.quantize_types import QuantizerType
from shutil import copytree, rmtree
import tempfile
ROOT = Path(__file__).parent.parent
ROOT = Path(__file__).parent.parent.parent
# 通用转换函数
def _convert(model_dir: Path):
@ -21,14 +21,14 @@ def _convert(model_dir: Path):
model_dir (Path): _description_
"""
model = Netrans()
qtypes = list(QuantizerType.get_options())
qtypes = list(QuantizerType.get_options())[:4]
# qtypes = [list(QuantizerType.get_options())[14]]
# qtypes= ['Ai16Wi4', 'Ai16Wpcqi8', 'Ai16Wpcqi4', 'Adfpi16Wpcqi8', 'Adfpi16Wpcqi4']#, 'Au10Wpcqi8', 'Au16Wi8', 'Au16Wpcqi8', 'Afp16Wpcqi8', 'Afp16Wpcqi4']
for qtype in qtypes:
model.load(model_path=str(model_dir))
model.quantize(quantized=qtype)
model.add_prepost_to_graph(quantized=qtype)
model.export_nbg(quantized=qtype)
model.add_pre_post(quantized=qtype)
model.export(quantized=qtype)
# 创建临时目录并执行测试
def _test_conversion(model_dir: Path, test_func):

View File

@ -7,11 +7,11 @@ import os
import pytest
from pathlib import Path
from netrans import Netrans
from quantize_types import QuantizerType
from netrans.quantize_types import QuantizerType
from shutil import copytree, rmtree
import tempfile
ROOT = Path(__file__).parent.parent
ROOT = Path(__file__).parent.parent.parent
# 通用转换函数
def _convert(model_dir: Path):
@ -25,8 +25,8 @@ def _convert(model_dir: Path):
for qtype in qtypes:
model.load(model_path=str(model_dir), mean=[0,0,0], scale=[0.0039216,0.0039216,0.0039216])
model.quantize(quantized=qtype)
model.add_prepost_to_graph(quantized=qtype)
model.export_nbg(quantized=qtype)
model.add_pre_post(quantized=qtype)
model.export(quantized=qtype)
# 创建临时目录并执行测试
def _test_conversion(model_dir: Path, test_func):

View File

@ -7,11 +7,11 @@ import os
import pytest
from pathlib import Path
from netrans import Netrans
from quantize_types import QuantizerType
from netrans.quantize_types import QuantizerType
from shutil import copytree, rmtree
import tempfile
ROOT = Path(__file__).parent.parent
ROOT = Path(__file__).parent.parent.parent
# 通用转换函数
def _convert(model_dir: Path):
@ -25,8 +25,8 @@ def _convert(model_dir: Path):
for qtype in qtypes:
model.load(model_path=str(model_dir), mean=0, scale=[0.0039216]*3)
model.quantize(quantized=qtype)
model.add_prepost_to_graph(quantized=qtype)
model.export_nbg(quantized=qtype)
model.add_pre_post(quantized=qtype)
model.export(quantized=qtype)
# 创建临时目录并执行测试
def _test_conversion(model_dir: Path, test_func):

View File

@ -7,11 +7,11 @@ import os
import pytest
from pathlib import Path
from netrans import Netrans
from quantize_types import QuantizerType
from netrans.quantize_types import QuantizerType
from shutil import copytree, rmtree
import tempfile
ROOT = Path(__file__).parent.parent
ROOT = Path(__file__).parent.parent.parent
# 通用转换函数
def _convert(model_dir: Path):
@ -25,8 +25,8 @@ def _convert(model_dir: Path):
for qtype in qtypes:
model.load(model_path=str(model_dir), mean=[0,0,0], scale=[0.0039216,0.0039216,0.0039216])
model.quantize(quantized=qtype)
model.add_prepost_to_graph(quantized=qtype)
model.export_nbg(quantized=qtype)
model.add_pre_post(quantized=qtype)
model.export(quantized=qtype)
# 创建临时目录并执行测试
def _test_conversion(model_dir: Path, test_func):

View File

@ -7,11 +7,11 @@ import os
import pytest
from pathlib import Path
from netrans import Netrans
from quantize_types import QuantizerType
from netrans.quantize_types import QuantizerType
from shutil import copytree, rmtree
import tempfile
ROOT = Path(__file__).parent.parent
ROOT = Path(__file__).parent.parent.parent
# 通用转换函数
def _convert(model_dir: Path):
@ -25,8 +25,8 @@ def _convert(model_dir: Path):
for qtype in qtypes:
model.load(model_path=str(model_dir), mean=[0], scale=[0.0039216])
model.quantize(quantized=qtype)
model.add_prepost_to_graph(quantized=qtype)
model.export_nbg(quantized=qtype)
model.add_pre_post(quantized=qtype)
model.export(quantized=qtype)
# 创建临时目录并执行测试
def _test_conversion(model_dir: Path, test_func):