MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / detect_quant_scheme

Function detect_quant_scheme

app/utils/model_utils.py:435–455  ·  view source on GitHub ↗

根据模型名字自动检测量化精度 - 如果模型名字包含 "int8" → "int8" - 如果模型名字包含 "fp8" 且设备支持 → "fp8" - 否则返回 None(表示不使用量化)

(model_name)

Source from the content-addressed store, hash-verified

433
434
435def detect_quant_scheme(model_name):
436 """根据模型名字自动检测量化精度
437 - 如果模型名字包含 "int8""int8"
438 - 如果模型名字包含 "fp8" 且设备支持 → "fp8"
439 - 否则返回 None(表示不使用量化)
440 """
441 if not model_name:
442 return None
443 # 延迟导入避免循环依赖
444 from utils.model_utils import is_fp8_supported_gpu
445
446 name_lower = model_name.lower()
447 if "int8" in name_lower:
448 return "int8"
449 elif "fp8" in name_lower:
450 if is_fp8_supported_gpu():
451 return "fp8"
452 else:
453 # 设备不支持fp8,返回None(使用默认精度)
454 return None
455 return None
456
457
458def is_distill_model_from_name(model_name):

Callers 4

build_wan21Function · 0.85
build_wan22Function · 0.85
build_qwen_imageFunction · 0.85
build_z_imageFunction · 0.85

Calls 1

is_fp8_supported_gpuFunction · 0.90

Tested by

no test coverage detected