mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
add new optimum-quanto on-the-fly and simplify quantization loading
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -61,14 +61,7 @@ class Script(scripts.Script):
|
||||
if shared.sd_model.__class__ != diffusers.AllegroPipeline:
|
||||
sd_models.unload_model_weights()
|
||||
t0 = time.time()
|
||||
quant_args = {}
|
||||
quant_args = model_quant.create_bnb_config(quant_args)
|
||||
if quant_args:
|
||||
model_quant.load_bnb(f'Load model: type=Allegro quant={quant_args}')
|
||||
if not quant_args:
|
||||
quant_args = model_quant.create_ao_config(quant_args)
|
||||
if quant_args:
|
||||
model_quant.load_torchao(f'Load model: type=Allegro quant={quant_args}')
|
||||
quant_args = model_quant.create_config()
|
||||
transformer = diffusers.AllegroTransformer3DModel.from_pretrained(
|
||||
repo_id,
|
||||
subfolder="transformer",
|
||||
|
||||
@@ -91,14 +91,7 @@ class Script(scripts.Script):
|
||||
if shared.sd_model.__class__ != diffusers.HunyuanVideoPipeline or model != loaded_model:
|
||||
sd_models.unload_model_weights()
|
||||
t0 = time.time()
|
||||
quant_args = {}
|
||||
quant_args = model_quant.create_bnb_config(quant_args)
|
||||
if quant_args:
|
||||
model_quant.load_bnb(f'Load model: type=HunyuanVideo quant={quant_args}')
|
||||
if not quant_args:
|
||||
quant_args = model_quant.create_ao_config(quant_args)
|
||||
if quant_args:
|
||||
model_quant.load_torchao(f'Load model: type=HunyuanVideo quant={quant_args}')
|
||||
quant_args = model_quant.create_config()
|
||||
transformer = diffusers.HunyuanVideoTransformer3DModel.from_pretrained(
|
||||
pretrained_model_name_or_path='tencent/HunyuanVideo',
|
||||
subfolder="transformer",
|
||||
|
||||
+2
-11
@@ -16,14 +16,7 @@ repos = {
|
||||
|
||||
|
||||
def load_quants(kwargs, repo_id):
|
||||
quant_args = {}
|
||||
quant_args = model_quant.create_bnb_config(quant_args)
|
||||
if quant_args:
|
||||
model_quant.load_bnb(f'Load model: type=LTXVideo quant={quant_args}')
|
||||
if not quant_args:
|
||||
quant_args = model_quant.create_ao_config(quant_args)
|
||||
if quant_args:
|
||||
model_quant.load_torchao(f'Load model: type=LTXVideo quant={quant_args}')
|
||||
quant_args = model_quant.create_config()
|
||||
if not quant_args:
|
||||
return kwargs
|
||||
model_quant.load_bnb(f'Load model: type=LTX quant={quant_args}')
|
||||
@@ -119,9 +112,7 @@ class Script(scripts.Script):
|
||||
repo_id = model_custom
|
||||
if shared.sd_model.__class__ != cls:
|
||||
sd_models.unload_model_weights()
|
||||
kwargs = {}
|
||||
kwargs = model_quant.create_bnb_config(kwargs)
|
||||
kwargs = model_quant.create_ao_config(kwargs)
|
||||
kwargs = model_quant.create_config()
|
||||
diffusers.LTXVideoTransformer3DModel.forward = teacache_forward
|
||||
if os.path.isfile(repo_id):
|
||||
shared.sd_model = cls.from_single_file(
|
||||
|
||||
@@ -42,9 +42,7 @@ class Script(scripts.Script):
|
||||
cls = diffusers.MochiPipeline
|
||||
if shared.sd_model.__class__ != cls:
|
||||
sd_models.unload_model_weights()
|
||||
kwargs = {}
|
||||
kwargs = model_quant.create_bnb_config(kwargs)
|
||||
kwargs = model_quant.create_ao_config(kwargs)
|
||||
kwargs = model_quant.create_config()
|
||||
shared.sd_model = cls.from_pretrained(
|
||||
repo_id,
|
||||
cache_dir = shared.opts.hfcache_dir,
|
||||
|
||||
Reference in New Issue
Block a user