test: 6.42.3 集成测试合并 #1
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue