[Refactor] Replace and ban a few torch.cuda functions in favor of torch.accelerator replacements. (#3365)
Signed-off-by: Nick Cao <ncao@redhat.com>
This commit is contained in:
1 parent
54277a8dd0
commit
e6466cf0e6
40 files changed
+98
-90
No files matched your search
@@ -172,7 +172,7 @@ def run_pipeline_forward(
|
||||
|
||||
def _synchronize(device: str) -> None:
|
||||
if device.startswith("cuda") and torch.cuda.is_available():
|
||||
torch.cuda.synchronize()
|
||||
torch.accelerator.synchronize()
|
||||
|
||||
|
||||
def _latency_summary(values_ms: list[float]) -> dict[str, float]:
|
||||
|
||||
@@ -184,7 +184,7 @@ async def run_streaming(inputs, sampling_params_list, model_name, args, output_d
|
||||
)
|
||||
|
||||
async_omni.shutdown()
|
||||
torch.cuda.empty_cache()
|
||||
torch.accelerator.empty_cache()
|
||||
gc.collect()
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ def run_non_streaming(inputs, sampling_params_list, model_name, args, output_dir
|
||||
print(f"RTF: {output_audio_dur / vllm_elapsed:.4f}")
|
||||
|
||||
del llm
|
||||
torch.cuda.empty_cache()
|
||||
torch.accelerator.empty_cache()
|
||||
gc.collect()
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ def main(args: Any) -> None:
|
||||
f"--num-prompts ({args.num_prompts}) must be divisible by --concurrency ({args.concurrency})"
|
||||
)
|
||||
|
||||
torch.cuda.empty_cache()
|
||||
torch.accelerator.empty_cache()
|
||||
gc.collect()
|
||||
|
||||
if args.streaming:
|
||||
|
||||
Reference in new issue
Block a user