add vram optimization cmdline args

This commit is contained in:
xushengyuan
2025-05-09 22:47:41 +08:00
parent 56ae032172
commit f23b7b34e3
3 changed files with 13 additions and 6 deletions
+9 -1
View File
@@ -40,15 +40,23 @@ def sample_data(json_data):
@click.option(
"--torch_compile", type=bool, default=False, help="Whether to use torch compile"
)
@click.option(
"--cpu_offload", type=bool, default=False, help="Whether to use CPU offloading (only load current stage's model to GPU)"
)
@click.option(
"--overlapped_decode", type=bool, default=False, help="Whether to use overlapped decoding (run dcae and vocoder using sliding windows)"
)
@click.option("--device_id", type=int, default=0, help="Device ID to use")
@click.option("--output_path", type=str, default=None, help="Path to save the output")
def main(checkpoint_path, bf16, torch_compile, device_id, output_path):
def main(checkpoint_path, bf16, torch_compile, cpu_offload, overlapped_decode, device_id, output_path):
os.environ["CUDA_VISIBLE_DEVICES"] = str(device_id)
model_demo = ACEStepPipeline(
checkpoint_dir=checkpoint_path,
dtype="bfloat16" if bf16 else "float32",
torch_compile=torch_compile,
cpu_offload=cpu_offload,
overlapped_decode=overlapped_decode
)
print(model_demo)