Compare commits

..
Author SHA1 Message Date
khluuandClaude Opus 4.6 3e280145cb Show all S3 wheels vs filtered wheels for verification
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-17 03:18:49 -07:00
khluuandClaude Opus 4.6 f5647e7e42 Allow RC wheels (e.g. v0.21.0rc1) in PyPI publish step
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-17 03:17:42 -07:00
khluuandClaude Opus 4.6 f825e007f5 Comment out twine upload; dry-run to verify wheel list first
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-17 03:12:12 -07:00
khluuandClaude Opus 4.6 c5f1dc4f44 Add PyPI publish step to release pipeline
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-17 03:07:29 -07:00
khluuandClaude Opus 4.7 65ae600835 Drop nightly Docker image flow; image builds are release-only
Wheels still build on every commit (existing nightly wheel flow), but
Docker images are now version-tagged releases only. Remove:
  - the NIGHTLY conditional on the build/publish block steps
  - the nightly DockerHub publish step
  - push-nightly-builds.sh and cleanup-nightly-builds.sh

The image flow now: manual unblock -> build per-arch images -> manual
unblock with release-version -> publish-release-images.sh tags
vllm/vllm-omni:vX.Y.Z + latest on DockerHub.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 18:03:55 -07:00
khluuandClaude Opus 4.7 9ce9e7dd48 Drop ECR multi-arch manifest step; only publish manifest to DockerHub
The DockerHub manifest is the only one consumers actually pull. The ECR
multi-arch manifest was unused, so remove the step and have the
nightly/release publish steps depend on the per-arch build steps
directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:43:27 -07:00
khluuandClaude Opus 4.7 4f12f0c733 Refactor: unify release pipeline with NIGHTLY=1 option (mirror vllm)
- Rename existing CI .buildkite/release-pipeline.yaml -> rebase-pipeline.yaml
  (it builds the CI image and uploads premerge child pipelines, not a release)
- Promote .buildkite/nightly-release-pipeline.yaml -> release-pipeline.yaml,
  refactored to mirror vllm/vllm's release-pipeline.yaml structure:
    - release-version input field
    - block step gating release Docker image builds (NIGHTLY != "1")
    - per-arch x86_64 / aarch64 docker builds pushing to ECR staging
    - multi-arch manifest in ECR
    - nightly DockerHub publish (NIGHTLY == "1") via push-nightly-builds.sh
    - block-gated release DockerHub publish (NIGHTLY != "1") via
      publish-release-images.sh, tagging vX.Y.Z + latest
- Add scripts adapted from vllm:
    push-nightly-builds.sh, cleanup-nightly-builds.sh,
    publish-release-images.sh — all targeting Docker Hub repo vllm/vllm-omni

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:19:55 -07:00
khluuandClaude Opus 4.7 afbb8af51a Tag and push DockerHub images directly from build steps
Tag each per-arch image with both the ECR commit-pinned tag and the
DockerHub tags (vllm/vllm-omni:$COMMIT-$arch and :nightly-$arch) and
push them to DockerHub from the build step itself. The publish step
now just creates and pushes the multi-arch manifests inline, so the
push-nightly-builds.sh helper is no longer needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:08:27 -07:00
khluuandClaude Opus 4.7 49afe9d31e [CI/Build] Add x86_64 and aarch64 docker image builds to release pipeline
Add release Docker image build steps to the nightly release pipeline
that build per-arch images from docker/Dockerfile.cuda, push them to
ECR, create a multi-arch manifest, and publish it to Docker Hub under
the nightly tag at vllm/vllm-omni.

Mirrors the pattern used by vllm-project/vllm's release pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:14:14 -07:00
Nick Cao e6466cf0e6 [Refactor] Replace and ban a few torch.cuda functions in favor of torch.accelerator replacements. (#3365)
Signed-off-by: Nick Cao <ncao@redhat.com>
2026-05-07 23:23:59 +08:00
Gao Han 54277a8dd0 [chore] Update command to download dataset from huggingface-cli to hf (#3403)
Signed-off-by: Gao Han <hgaoaf@connect.ust.hk>
2026-05-07 16:16:36 +08:00
45 changed files with 349 additions and 143 deletions

No files matched your search

-20
View File
@@ -1,20 +0,0 @@
steps:
- label: "Build and upload wheel"
key: "build-wheel"
agents:
queue: cpu_queue_release
commands:
- "curl -LsSf https://astral.sh/uv/install.sh | sh"
- 'export PATH="$HOME/.local/bin:$PATH"'
- "uv venv --python=3.12 && source .venv/bin/activate"
- "uv pip install --upgrade build"
- "python3 -m build"
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
- label: "Generate and upload wheel indices"
depends_on: "build-wheel"
allow_dependency_failure: true
agents:
queue: small_cpu_queue_release
commands:
- "bash .buildkite/scripts/generate-and-upload-nightly-index.sh"
+38
View File
@@ -0,0 +1,38 @@
steps:
- label: ":docker: Build image"
key: image-build
commands:
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
- "docker build --progress=plain --file docker/Dockerfile.ci -t vllm-omni-ci ."
- "docker tag vllm-omni-ci public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
- "docker push public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
agents:
queue: "cpu_queue_premerge"
# L2 Test
- label: "Upload Ready Pipeline"
depends_on: image-build
key: upload-ready-pipeline
commands:
- buildkite-agent pipeline upload .buildkite/test-ready.yml
agents:
queue: "cpu_queue_premerge"
# L3 Test
- label: "Upload Merge Pipeline"
depends_on: image-build
key: upload-merge-pipeline
commands:
- buildkite-agent pipeline upload .buildkite/test-merge.yml
agents:
queue: "cpu_queue_premerge"
# L4 Test
- label: "Upload Nightly Pipeline"
depends_on: image-build
key: upload-nightly-pipeline
if: build.env("NIGHTLY") == "1"
commands:
- buildkite-agent pipeline upload .buildkite/test-nightly.yml
agents:
queue: "cpu_queue_premerge"
+103 -31
View File
@@ -1,38 +1,110 @@
steps:
- label: ":docker: Build image"
key: image-build
commands:
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
- "docker build --progress=plain --file docker/Dockerfile.ci -t vllm-omni-ci ."
- "docker tag vllm-omni-ci public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
- "docker push public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
agents:
queue: "cpu_queue_premerge"
- input: "Provide Release version here"
id: input-release-version
fields:
- text: "What is the release version?"
key: release-version
# L2 Test
- label: "Upload Ready Pipeline"
depends_on: image-build
key: upload-ready-pipeline
commands:
- buildkite-agent pipeline upload .buildkite/test-ready.yml
- label: "Build and upload wheel"
depends_on: ~
key: "build-wheel"
agents:
queue: "cpu_queue_premerge"
queue: cpu_queue_release
commands:
- "curl -LsSf https://astral.sh/uv/install.sh | sh"
- 'export PATH="$HOME/.local/bin:$PATH"'
- "uv venv --python=3.12 && source .venv/bin/activate"
- "uv pip install --upgrade build"
- "python3 -m build"
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
# L3 Test
- label: "Upload Merge Pipeline"
depends_on: image-build
key: upload-merge-pipeline
commands:
- buildkite-agent pipeline upload .buildkite/test-merge.yml
- label: "Generate and upload wheel indices"
depends_on: "build-wheel"
allow_dependency_failure: true
agents:
queue: "cpu_queue_premerge"
queue: small_cpu_queue_release
commands:
- "bash .buildkite/scripts/generate-and-upload-nightly-index.sh"
# L4 Test
- label: "Upload Nightly Pipeline"
depends_on: image-build
key: upload-nightly-pipeline
if: build.env("NIGHTLY") == "1"
commands:
- buildkite-agent pipeline upload .buildkite/test-nightly.yml
- block: "Upload release wheels to PyPI"
depends_on: "build-wheel"
key: block-upload-release-wheels
- label: "Upload release wheels to PyPI"
depends_on:
- block-upload-release-wheels
- input-release-version
key: upload-release-wheels
agents:
queue: "cpu_queue_premerge"
queue: small_cpu_queue_release
commands:
- "bash .buildkite/scripts/publish-release-wheels-pypi.sh"
- block: "Unblock to build release Docker images"
depends_on: ~
key: block-build-release-images
- group: "Build release Docker images"
key: "build-release-images"
depends_on: block-build-release-images
allow_dependency_failure: true
steps:
- label: "Build release image - x86_64"
key: build-release-image-x86
depends_on: ~
agents:
queue: cpu_queue_release
commands:
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
- |
DOCKER_BUILDKIT=1 docker build \
--build-arg max_jobs=16 \
--tag public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT-$(uname -m) \
--progress plain \
-f docker/Dockerfile.cuda .
- "docker push public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT-$(uname -m)"
# re-tag to default image tag and push, just in case arm64 build fails
- "docker tag public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT-$(uname -m) public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT"
- "docker push public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT"
env:
DOCKER_BUILDKIT: "1"
- label: "Build release image - aarch64"
key: build-release-image-arm64
depends_on: ~
agents:
queue: arm64_cpu_queue_release
commands:
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
- |
DOCKER_BUILDKIT=1 docker build \
--build-arg max_jobs=16 \
--tag public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT-$(uname -m) \
--progress plain \
-f docker/Dockerfile.cuda .
- "docker push public.ecr.aws/q9t5s3a7/vllm-omni-release-repo:$BUILDKITE_COMMIT-$(uname -m)"
env:
DOCKER_BUILDKIT: "1"
- block: "Publish release images to DockerHub"
key: block-publish-release-images
depends_on:
- build-release-image-x86
- build-release-image-arm64
- input-release-version
- label: "Publish release images to DockerHub"
depends_on:
- block-publish-release-images
key: publish-release-images-dockerhub
agents:
queue: small_cpu_queue_release
commands:
- "bash .buildkite/scripts/publish-release-images.sh"
plugins:
- docker-login#v3.0.0:
username: vllmbot
password-env: DOCKERHUB_TOKEN
env:
DOCKER_BUILDKIT: "1"
DOCKERHUB_USERNAME: "vllmbot"
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
#
# Publish release Docker images from ECR to DockerHub.
# Pulls per-arch images, tags with `latest` and versioned tags, pushes them,
# then creates and pushes a multi-arch manifest.
set -euo pipefail
RELEASE_VERSION=$(buildkite-agent meta-data get release-version --default "" | sed 's/^v//')
if [ -z "${RELEASE_VERSION}" ]; then
echo "ERROR: release-version metadata not set"
exit 1
fi
COMMIT="$BUILDKITE_COMMIT"
DOCKERHUB_REPO="vllm/vllm-omni"
ECR_REPO="public.ecr.aws/q9t5s3a7/vllm-omni-release-repo"
echo "========================================"
echo "Publishing release images v${RELEASE_VERSION}"
echo " Commit: ${COMMIT}"
echo "========================================"
# Login to ECR to pull staging images
aws ecr-public get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7
docker pull "${ECR_REPO}:${COMMIT}-x86_64"
docker pull "${ECR_REPO}:${COMMIT}-aarch64"
docker tag "${ECR_REPO}:${COMMIT}-x86_64" "${DOCKERHUB_REPO}:latest-x86_64"
docker tag "${ECR_REPO}:${COMMIT}-x86_64" "${DOCKERHUB_REPO}:v${RELEASE_VERSION}-x86_64"
docker push "${DOCKERHUB_REPO}:latest-x86_64"
docker push "${DOCKERHUB_REPO}:v${RELEASE_VERSION}-x86_64"
docker tag "${ECR_REPO}:${COMMIT}-aarch64" "${DOCKERHUB_REPO}:latest-aarch64"
docker tag "${ECR_REPO}:${COMMIT}-aarch64" "${DOCKERHUB_REPO}:v${RELEASE_VERSION}-aarch64"
docker push "${DOCKERHUB_REPO}:latest-aarch64"
docker push "${DOCKERHUB_REPO}:v${RELEASE_VERSION}-aarch64"
docker manifest rm "${DOCKERHUB_REPO}:latest" || true
docker manifest rm "${DOCKERHUB_REPO}:v${RELEASE_VERSION}" || true
docker manifest create "${DOCKERHUB_REPO}:latest" "${DOCKERHUB_REPO}:latest-x86_64" "${DOCKERHUB_REPO}:latest-aarch64"
docker manifest create "${DOCKERHUB_REPO}:v${RELEASE_VERSION}" "${DOCKERHUB_REPO}:v${RELEASE_VERSION}-x86_64" "${DOCKERHUB_REPO}:v${RELEASE_VERSION}-aarch64"
docker manifest push "${DOCKERHUB_REPO}:latest"
docker manifest push "${DOCKERHUB_REPO}:v${RELEASE_VERSION}"
echo ""
echo "Successfully published release images for v${RELEASE_VERSION}"
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
set -e
BUCKET="vllm-wheels"
SUBPATH="omni/$BUILDKITE_COMMIT"
S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
RELEASE_VERSION=$(buildkite-agent meta-data get release-version | sed 's/^v//')
if [[ -z "$RELEASE_VERSION" ]]; then
echo "[FATAL] release-version metadata not set."
exit 1
fi
echo "Release version: $RELEASE_VERSION"
# if [[ -z "$PYPI_TOKEN" ]]; then
# echo "[FATAL] PYPI_TOKEN is not set."
# exit 1
# else
# export TWINE_USERNAME="__token__"
# export TWINE_PASSWORD="$PYPI_TOKEN"
# fi
set -x
ALL_DIR=/tmp/vllm-omni-release-all
DIST_DIR=/tmp/vllm-omni-release-dist
mkdir -p "$ALL_DIR" "$DIST_DIR"
echo "========================================"
echo "All wheels in S3 (no filters):"
echo "========================================"
aws s3 cp --recursive "$S3_COMMIT_PREFIX" "$ALL_DIR"
ls -la "$ALL_DIR"
echo ""
echo "========================================"
echo "Filtered wheels (include: vllm_omni-${RELEASE_VERSION}*.whl, exclude: *dev*):"
echo "========================================"
aws s3 cp --recursive --exclude "*" --include "vllm_omni-${RELEASE_VERSION}*.whl" --exclude "*dev*" "$S3_COMMIT_PREFIX" "$DIST_DIR"
ls -la "$DIST_DIR"
PYPI_WHEEL_FILES=$(find "$DIST_DIR" -name "vllm_omni-${RELEASE_VERSION}*.whl" -not -name "*+*")
if [[ -z "$PYPI_WHEEL_FILES" ]]; then
echo "[FATAL] No wheels found for version ${RELEASE_VERSION}"
exit 1
fi
echo ""
echo "========================================"
echo "Wheels that would be uploaded to PyPI:"
echo "========================================"
echo "$PYPI_WHEEL_FILES"
# python3 -m twine check $PYPI_WHEEL_FILES
# python3 -m twine upload --non-interactive --verbose $PYPI_WHEEL_FILES
# echo "Wheels uploaded to PyPI"
+6 -6
View File
@@ -151,7 +151,7 @@ def _generate_image(omni, args, prompt, seed):
from vllm_omni.platforms import current_omni_platform
generator = torch.Generator(device=current_omni_platform.device_type).manual_seed(seed)
torch.cuda.reset_peak_memory_stats()
torch.accelerator.reset_peak_memory_stats()
start = time.perf_counter()
outputs = omni.generate(
{"prompt": prompt},
@@ -163,7 +163,7 @@ def _generate_image(omni, args, prompt, seed):
),
)
elapsed = time.perf_counter() - start
peak_mem = torch.cuda.max_memory_allocated() / (1024**3)
peak_mem = torch.accelerator.max_memory_allocated() / (1024**3)
first = outputs[0]
req_out = first.request_output[0] if hasattr(first, "request_output") else first
@@ -178,7 +178,7 @@ def _generate_video(omni, args, prompt, seed):
from vllm_omni.platforms import current_omni_platform
generator = torch.Generator(device=current_omni_platform.device_type).manual_seed(seed)
torch.cuda.reset_peak_memory_stats()
torch.accelerator.reset_peak_memory_stats()
start = time.perf_counter()
outputs = omni.generate(
{"prompt": prompt, "negative_prompt": ""},
@@ -192,7 +192,7 @@ def _generate_video(omni, args, prompt, seed):
),
)
elapsed = time.perf_counter() - start
peak_mem = torch.cuda.max_memory_allocated() / (1024**3)
peak_mem = torch.accelerator.max_memory_allocated() / (1024**3)
first = outputs[0]
if hasattr(first, "request_output") and isinstance(first.request_output, list):
@@ -228,8 +228,8 @@ def _unload_omni(omni):
del omni
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.cuda.synchronize()
torch.accelerator.empty_cache()
torch.accelerator.synchronize()
def run_benchmark(args):
@@ -614,8 +614,8 @@ Examples:
if not torch.cuda.is_available():
print("[ERROR] CUDA is not available but GPU mode was requested.")
sys.exit(1)
if args.gpu_id >= torch.cuda.device_count():
print(f"[ERROR] GPU {args.gpu_id} not available. Found {torch.cuda.device_count()} GPUs.")
if args.gpu_id >= torch.accelerator.device_count():
print(f"[ERROR] GPU {args.gpu_id} not available. Found {torch.accelerator.device_count()} GPUs.")
sys.exit(1)
print(f"[INFO] Using GPU {args.gpu_id}: {torch.cuda.get_device_name(args.gpu_id)}")
@@ -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:
+6
View File
@@ -142,6 +142,12 @@ ignore = [
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"librosa".msg = "The librosa module is banned, use vllm.multimodal helpers instead"
"torch.cuda.max_memory_allocated".msg = "Use torch.accelerator.max_memory_allocated"
"torch.cuda.reset_peak_memory_stats".msg = "Use torch.accelerator.reset_peak_memory_stats"
"torch.cuda.device_count".msg = "Use torch.accelerator.device_count"
"torch.cuda.current_device".msg = "Use torch.accelerator.current_device_index"
"torch.cuda.empty_cache".msg = "Use torch.accelerator.empty_cache"
"torch.cuda.synchronize".msg = "Use torch.accelerator.synchronize"
[tool.mypy]
python_version = "3.12, 3.13"
@@ -57,7 +57,7 @@ DEPLOY_CONFIGS_DIR = Path(__file__).resolve().parent.parent.parent.parent / "vll
def _default_oom_device_spec() -> str:
"""Use currently visible CUDA ordinals to avoid invalid device index in sidecar."""
count = torch.cuda.device_count()
count = torch.accelerator.device_count()
if count <= 0:
return "0"
return ",".join(str(i) for i in range(count))
@@ -104,7 +104,7 @@ def _generate_image(omni, config: QualityTestConfig):
generator = torch.Generator(
device=current_omni_platform.device_type,
).manual_seed(config.seed)
torch.cuda.reset_peak_memory_stats()
torch.accelerator.reset_peak_memory_stats()
outputs = omni.generate(
{"prompt": config.prompt},
@@ -116,7 +116,7 @@ def _generate_image(omni, config: QualityTestConfig):
),
)
peak_mem = torch.cuda.max_memory_allocated() / (1024**3)
peak_mem = torch.accelerator.max_memory_allocated() / (1024**3)
first = outputs[0]
if hasattr(first, "images") and first.images:
return first.images[0], peak_mem
@@ -135,7 +135,7 @@ def _generate_video(omni, config: QualityTestConfig):
generator = torch.Generator(
device=current_omni_platform.device_type,
).manual_seed(config.seed)
torch.cuda.reset_peak_memory_stats()
torch.accelerator.reset_peak_memory_stats()
outputs = omni.generate(
{"prompt": config.prompt, "negative_prompt": ""},
@@ -148,7 +148,7 @@ def _generate_video(omni, config: QualityTestConfig):
),
)
peak_mem = torch.cuda.max_memory_allocated() / (1024**3)
peak_mem = torch.accelerator.max_memory_allocated() / (1024**3)
first = outputs[0]
if hasattr(first, "request_output") and isinstance(first.request_output, list):
inner = first.request_output[0]
@@ -190,8 +190,8 @@ def _unload(omni):
del omni
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.cuda.synchronize()
torch.accelerator.empty_cache()
torch.accelerator.synchronize()
# ---------------------------------------------------------------------------
+4 -4
View File
@@ -371,7 +371,7 @@ class TestCustomPipelineWorkerExtension:
def test_re_init_pipeline_basic(self, mocker: MockerFixture, mock_od_config):
"""Test basic re_init_pipeline functionality."""
mocker.patch("torch.cuda.empty_cache")
mocker.patch("torch.accelerator.empty_cache")
mocker.patch("gc.collect")
mocker.patch.object(DiffusionWorker, "__init__", return_value=None)
@@ -405,7 +405,7 @@ class TestCustomPipelineWorkerExtension:
def test_re_init_pipeline_cleanup(self, mocker: MockerFixture, mock_od_config):
"""Test that re_init_pipeline properly cleans up old pipeline."""
mock_gc_collect = mocker.patch("gc.collect")
mock_empty_cache = mocker.patch("torch.cuda.empty_cache")
mock_empty_cache = mocker.patch("torch.accelerator.empty_cache")
mocker.patch.object(DiffusionWorker, "__init__", return_value=None)
wrapper = WorkerWrapperBase(
@@ -434,7 +434,7 @@ class TestCustomPipelineWorkerExtension:
def test_re_init_pipeline_none_pipeline(self, mocker: MockerFixture, mock_od_config):
"""Test re_init_pipeline when pipeline is None."""
mocker.patch("torch.cuda.empty_cache")
mocker.patch("torch.accelerator.empty_cache")
mocker.patch("gc.collect")
mocker.patch.object(DiffusionWorker, "__init__", return_value=None)
@@ -510,7 +510,7 @@ class TestCustomPipelineWorkerExtension:
def test_re_init_pipeline_multiple_calls(self, mocker: MockerFixture, mock_od_config):
"""Test calling re_init_pipeline multiple times."""
mocker.patch("torch.cuda.empty_cache")
mocker.patch("torch.accelerator.empty_cache")
mocker.patch("gc.collect")
mocker.patch.object(DiffusionWorker, "__init__", return_value=None)
+3 -3
View File
@@ -53,7 +53,7 @@ def pytest_addoption(parser):
"--wan22-i2v-image-source",
action="store",
default=None,
help="Image source for Wan2.2 I2V accuracy tests. Can be local path or remote URL.",
help="Image source for Wan2.2 I2V accuracy tests. Can be local path or remote URL",
)
group.addoption(
"--wan22-i2v-online-timeout-seconds",
@@ -83,7 +83,7 @@ def _ensure_dataset_snapshot(dataset_id: str) -> Path:
return candidates[0]
subprocess.run(
["huggingface-cli", "download", "--repo-type", "dataset", dataset_id],
["hf", "download", "--repo-type", "dataset", dataset_id],
check=True,
)
candidates = _dataset_cache_dirs(dataset_id)
@@ -230,7 +230,7 @@ def _build_accuracy_server_config(
run_level: str,
model_prefix: str,
) -> AccuracyServerConfig:
if torch.cuda.device_count() < 1:
if torch.accelerator.device_count() < 1:
pytest.skip("Need at least 1 CUDA GPU for accuracy benchmark smoke tests.")
if not generate_model:
@@ -160,7 +160,7 @@ def _run_diffusers_wan22_i2v(*, model: str, output_path: Path, conditioning_imag
del pipe
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
run_post_test_cleanup(enable_force=True)
@@ -240,7 +240,7 @@ def _run_diffusers_qwen_image(*, model: str, output_path: Path) -> tuple[Image.I
del pipe
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
run_post_test_cleanup(enable_force=True)
@@ -199,7 +199,7 @@ def _run_diffusers_baseline(model: str, output_dir: Path) -> list[Image.Image]:
del pipe
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
run_post_test_cleanup(enable_force=True)
@@ -278,7 +278,7 @@ def _run_with_custom_transformer(model: str, output_dir: Path) -> list[Image.Ima
del pipe, result, our_transformer
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
return frames
+1 -1
View File
@@ -98,7 +98,7 @@ def _run_diffusers_qwen_image(*, model: str, output_path: Path) -> Image.Image:
del pipe
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
run_post_test_cleanup(enable_force=True)
+1 -1
View File
@@ -109,7 +109,7 @@ def _run_diffusers_image_edit(
del pipe
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
run_post_test_cleanup(enable_force=True)
@@ -125,7 +125,7 @@ def _run_diffusers_qwen_image_layered(*, model: str, input_image: Image.Image, o
del pipe
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
run_post_test_cleanup(enable_force=True)
@@ -572,7 +572,7 @@ def test_wan22_i2v_online_serving_generates_video(
wan22_i2v_image_source: str | None,
wan22_i2v_online_timeout_seconds: int,
) -> None:
if not torch.cuda.is_available() or torch.cuda.device_count() < 2:
if not torch.cuda.is_available() or torch.accelerator.device_count() < 2:
pytest.skip("Wan2.2 I2V similarity e2e test requires >= 2 CUDA GPUs.")
_probe_binary("ffprobe")
@@ -597,7 +597,7 @@ def test_wan22_i2v_online_serving_generates_video(
def test_wan22_i2v_serving_matches_diffusers_video_similarity(
wan22_i2v_image_source: str | None,
) -> None:
if not torch.cuda.is_available() or torch.cuda.device_count() < 2:
if not torch.cuda.is_available() or torch.accelerator.device_count() < 2:
pytest.skip("Wan2.2 I2V similarity e2e test requires >= 2 CUDA GPUs.")
_probe_binary("ffmpeg")
@@ -327,7 +327,7 @@ def _generate_image(omni: Omni, use_system_prompt: str | None) -> Image.Image:
return _extract_generated_image(outputs)
@pytest.mark.skipif(torch.cuda.device_count() < 8, reason="Need at least 8 CUDA GPUs for this test.")
@pytest.mark.skipif(torch.accelerator.device_count() < 8, reason="Need at least 8 CUDA GPUs for this test.")
@pytest.mark.parametrize("system_prompt_name,use_system_prompt,expected_embedding", SYSTEM_PROMPT_CASES)
def test_system_prompt_scores(
omni: Omni,
@@ -26,7 +26,7 @@ def get_ack_info(ack, key, default=None):
def get_dynamic_devices(stage_idx, num_stages, tp_size):
total_gpus = torch.cuda.device_count()
total_gpus = torch.accelerator.device_count()
gpus_per_stage = tp_size
start_idx = stage_idx * gpus_per_stage
if start_idx + gpus_per_stage > total_gpus:
@@ -42,7 +42,7 @@ def get_dynamic_devices(stage_idx, num_stages, tp_size):
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=1)
@pytest.mark.asyncio
async def test_diffusion_model_sleep_tp(tp_size):
num_gpus = torch.cuda.device_count()
num_gpus = torch.accelerator.device_count()
if num_gpus < tp_size:
pytest.skip(f"Skipping TP={tp_size}")
@@ -88,7 +88,7 @@ async def test_diffusion_model_sleep_tp(tp_size):
@hardware_test(res={"cuda": "H100", "rocm": "MI325"}, num_cards=2)
@pytest.mark.asyncio
async def test_multistage_sleep_h100(tp_size):
num_gpus = torch.cuda.device_count()
num_gpus = torch.accelerator.device_count()
if num_gpus < tp_size * 2:
pytest.skip("Not enough GPUs")
@@ -67,7 +67,7 @@ def _generate_single_stage_image(
omni_kwargs["quantization"] = quantization
with OmniRunner(model, **omni_kwargs) as runner:
torch.cuda.reset_peak_memory_stats()
torch.accelerator.reset_peak_memory_stats()
generator = torch.Generator(device=current_omni_platform.device_type).manual_seed(seed)
outputs = runner.omni.generate(
@@ -81,7 +81,7 @@ def _generate_single_stage_image(
),
)
peak_mem = torch.cuda.max_memory_allocated() / (1024**3)
peak_mem = torch.accelerator.max_memory_allocated() / (1024**3)
first_output = outputs[0]
assert first_output.final_output_type == "image"
@@ -116,7 +116,7 @@ def _generate_bagel_image(
model_name = omni_kwargs.pop("model")
with OmniRunner(model_name, **omni_kwargs) as runner:
omni = runner.omni
torch.cuda.reset_peak_memory_stats()
torch.accelerator.reset_peak_memory_stats()
params_list = omni.default_sampling_params_list
if len(params_list) > 1:
@@ -134,7 +134,7 @@ def _generate_bagel_image(
)
)
peak_mem = torch.cuda.max_memory_allocated() / (1024**3)
peak_mem = torch.accelerator.max_memory_allocated() / (1024**3)
# Extract image
generated_image = None
@@ -190,7 +190,7 @@ def test_single_stage_zimage_fp8_uses_less_memory():
model="Tongyi-MAI/Z-Image-Turbo",
quantization=None,
)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
_, mem_fp8 = _generate_single_stage_image(
model="Tongyi-MAI/Z-Image-Turbo",
@@ -241,7 +241,7 @@ def test_single_stage_flux_fp8_uses_less_memory():
width=512,
num_inference_steps=4,
)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
_, mem_fp8 = _generate_single_stage_image(
model="black-forest-labs/FLUX.1-dev",
+8 -8
View File
@@ -33,16 +33,16 @@ def get_vram_info(device_id: int) -> dict:
"""Obtain a snapshot of the specified GPU's memory (GiB)."""
try:
if current_omni_platform.is_rocm():
num_gpus = torch.cuda.device_count()
num_gpus = torch.accelerator.device_count()
safe_id = device_id if device_id < num_gpus else 0
torch.cuda.synchronize(safe_id)
torch.accelerator.synchronize(safe_id)
return {
"reserved": torch.cuda.memory_reserved(safe_id) / 1024**3,
"allocated": torch.cuda.memory_allocated(safe_id) / 1024**3,
}
else:
with torch.cuda.device(device_id):
torch.cuda.synchronize()
torch.accelerator.synchronize()
return {
"reserved": torch.cuda.memory_reserved() / 1024**3,
"allocated": torch.cuda.memory_allocated() / 1024**3,
@@ -240,7 +240,7 @@ class TestOmniSleepMode:
await diffusion_engine.wake_up(stage_ids=[0])
get_vram_info(device_id)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
await asyncio.sleep(2)
initial_vram = get_vram_info(device_id)["reserved"]
@@ -253,7 +253,7 @@ class TestOmniSleepMode:
await diffusion_engine.sleep(stage_ids=[0], level=2)
await asyncio.sleep(3.0)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
final_vram = get_vram_info(device_id)["reserved"]
logger.info(f"GPU {device_id} Final VRAM after coordinated sleep: {final_vram:.2f} GiB")
@@ -276,7 +276,7 @@ class TestOmniSleepMode:
device_id = 1
try:
get_vram_info(device_id)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
vram_initial = get_vram_info(device_id)["reserved"]
logger.info(f"Diffusion Initial VRAM: {vram_initial:.2f} GiB")
@@ -290,7 +290,7 @@ class TestOmniSleepMode:
await asyncio.sleep(2)
get_vram_info(device_id)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
vram_sleeping = get_vram_info(device_id)["reserved"]
logger.info(f"External VRAM measurement during Sleep: {vram_sleeping:.2f} GiB")
@@ -305,7 +305,7 @@ class TestOmniSleepMode:
await asyncio.sleep(2)
get_vram_info(device_id)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
vram_restored = get_vram_info(device_id)["reserved"]
logger.info(f"VRAM after Wake-up: {vram_restored:.2f} GiB")
+3 -3
View File
@@ -130,7 +130,7 @@ def wait_for_gpu_memory_to_clear(
)
gc.collect()
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
time.sleep(5)
@@ -244,7 +244,7 @@ def run_pre_test_cleanup(enable_force: bool = False) -> None:
print("Pre-test GPU status:")
num_gpus = torch.cuda.device_count()
num_gpus = torch.accelerator.device_count()
if num_gpus > 0:
try:
wait_for_gpu_memory_to_clear(
@@ -262,7 +262,7 @@ def run_post_test_cleanup(enable_force: bool = False) -> None:
if torch.cuda.is_available():
gc.collect()
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
print("Post-test GPU status:")
_print_gpu_processes()
+2 -2
View File
@@ -11,7 +11,7 @@ def default_env():
previous = {key: os.environ.get(key) for key in keys}
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = previous["VLLM_WORKER_MULTIPROC_METHOD"] or "spawn"
os.environ["VLLM_TARGET_DEVICE"] = previous["VLLM_TARGET_DEVICE"] or (
"cuda" if torch.cuda.is_available() and torch.cuda.device_count() > 0 else "cpu"
"cuda" if torch.cuda.is_available() and torch.accelerator.device_count() > 0 else "cpu"
)
yield
for key, value in previous.items():
@@ -51,7 +51,7 @@ def default_vllm_config():
from vllm.config import DeviceConfig, VllmConfig, set_current_vllm_config
# Use CPU device if no GPU is available (e.g., in CI environments)
has_gpu = torch.cuda.is_available() and torch.cuda.device_count() > 0
has_gpu = torch.cuda.is_available() and torch.accelerator.device_count() > 0
device = "cuda" if has_gpu else "cpu"
device_config = DeviceConfig(device=device)
@@ -46,7 +46,7 @@ def _warmup_pipeline(cfm: CFM, aggregator: Aggregator, stop_head: torch.nn.Linea
gen_lat = cfm.sample(llm_cond, lat_cond, y0, t, sde_args, sde_rnd)
aggregator(gen_lat)
stop_head(llm_cond[:, -1, :]).softmax(dim=-1)
torch.cuda.synchronize(device)
torch.accelerator.synchronize(device)
def _build_pipeline():
@@ -95,7 +95,7 @@ class TestCFMGraphExecutor:
his_lat = torch.randn(bsz, _HIS_PATCH_SIZE, _LATENT_DIM, device=device, dtype=_DTYPE)
gen_lat, inputs_embeds, stop_out = executor.execute(input_tensor, his_lat)
torch.cuda.synchronize()
torch.accelerator.synchronize()
assert gen_lat.shape == (bsz, _PATCH_SIZE, _LATENT_DIM)
assert inputs_embeds.shape == (bsz, 1, _LLM_HIDDEN)
@@ -109,7 +109,7 @@ class TestCFMGraphExecutor:
new_input = torch.randn_like(input_tensor)
new_his = torch.randn_like(his_lat)
gen_lat2, inputs_embeds2, stop_out2 = executor.execute(new_input, new_his)
torch.cuda.synchronize()
torch.accelerator.synchronize()
assert gen_lat2.shape == gen_lat.shape
assert inputs_embeds2.shape == inputs_embeds.shape
assert stop_out2.shape == stop_out.shape
@@ -125,7 +125,7 @@ class TestCFMGraphExecutor:
snapshot_his = his_lat.clone()
executor.execute(input_tensor, his_lat)
torch.cuda.synchronize()
torch.accelerator.synchronize()
assert torch.equal(input_tensor, snapshot_input)
assert torch.equal(his_lat, snapshot_his)
@@ -139,7 +139,7 @@ class TestCFMGraphExecutorPool:
his_lat = torch.randn(1, _HIS_PATCH_SIZE, _LATENT_DIM, device=device, dtype=_DTYPE)
gen_lat, inputs_embeds, stop_out = pool.execute(input_tensor, his_lat)
torch.cuda.synchronize()
torch.accelerator.synchronize()
assert gen_lat.shape == (1, _PATCH_SIZE, _LATENT_DIM)
assert inputs_embeds.shape == (1, 1, _LLM_HIDDEN)
assert stop_out.shape == (1, 2)
+1 -1
View File
@@ -68,7 +68,7 @@ class TestGetProcessGpuMemory:
assert memory >= 0
del tensor
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
def test_raises_on_invalid_device(self, mocker: MockerFixture):
from vllm_omni.worker.gpu_memory_utils import get_process_gpu_memory
+1 -1
View File
@@ -49,7 +49,7 @@ def get_gpu_info() -> list[dict]:
if not torch.cuda.is_available():
return []
for i in range(torch.cuda.device_count()):
for i in range(torch.accelerator.device_count()):
free, total = torch.cuda.mem_get_info(i)
props = torch.cuda.get_device_properties(i)
gpus.append(
@@ -212,7 +212,7 @@ class TeaCacheCoefficientEstimator:
trajectory = self.hook.stop_collection()
if trajectory:
self.collected_data.append(trajectory)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
def estimate(self, poly_order: int = 4) -> list[float]:
"""Estimate polynomial coefficients from collected data.
@@ -267,7 +267,7 @@ class LTX23Pipeline(nn.Module, ProgressBarMixin):
)
# Move text encoder back to CPU immediately
self.text_encoder.to("cpu")
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
hidden_states = text_encoder_outputs.hidden_states
@@ -754,7 +754,7 @@ class LTX23Pipeline(nn.Module, ProgressBarMixin):
)
self.connectors.to("cpu")
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
# ---- Prepare latents ----
latent_num_frames = (num_frames - 1) // self.vae_temporal_compression_ratio + 1
@@ -978,7 +978,7 @@ class LTX23Pipeline(nn.Module, ProgressBarMixin):
self.vocoder.to(device)
audio = self.vocoder(generated_mel_spectrograms)
self.vocoder.to("cpu")
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
return DiffusionOutput(output=(video, audio))
@@ -1684,7 +1684,7 @@ class MagiHumanPipeline(nn.Module, ProgressBarMixin, DiffusionPipelineProfilerMi
super().__init__()
model_path = od_config.model
local_files_only = os.path.exists(model_path)
device = f"cuda:{torch.cuda.current_device()}"
device = f"cuda:{torch.accelerator.current_device_index()}"
self.device_str = device
self.dtype = od_config.dtype or torch.bfloat16
@@ -2255,7 +2255,7 @@ class MagiHumanPipeline(nn.Module, ProgressBarMixin, DiffusionPipelineProfilerMi
1 - self.sr_audio_noise_scale
)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
sr_steps = sr_num_steps or self.sr_num_inference_steps_default
final_latent_video, _ = self._evaluate_with_latent(
context,
@@ -2274,9 +2274,9 @@ class MagiHumanPipeline(nn.Module, ProgressBarMixin, DiffusionPipelineProfilerMi
final_latent_video = br_latent_video
final_latent_audio = br_latent_audio
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
videos_np = self._decode_video(final_latent_video)
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
audio_np = self._decode_audio(final_latent_audio)
return DiffusionOutput(output=(videos_np, audio_np))
@@ -503,7 +503,7 @@ class CustomPipelineWorkerExtension:
if self.model_runner.pipeline is not None:
del self.model_runner.pipeline
gc.collect()
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
# Get custom pipeline class name
custom_pipeline_name = custom_pipeline_args["pipeline_class"]
@@ -878,7 +878,7 @@ class MooncakeTransferEngineConnector(OmniConnectorBase):
# Success
# Ensure data is visible on GPU
# Note: RDMA write visibility on GPU usually requires some form of fence/sync.
# torch.cuda.synchronize() is a heavy hammer but safe.
# torch.accelerator.synchronize() is a heavy hammer but safe.
# Ideally Mooncake engine provides a way to poll for completion that guarantees visibility.
# TODO(wzliu): Replace synchronize with cuda event in the future for better performance.
if self.pool.is_cuda:
@@ -372,7 +372,7 @@ class FishSpeechFastAR(nn.Module):
dtype=torch.long,
)
self(hidden, semantic, do_sample=False)
torch.cuda.synchronize(device)
torch.accelerator.synchronize(device)
@torch.inference_mode()
def _run_model(self, step_input: torch.Tensor, step_pos_ids: torch.Tensor, bsz: int) -> torch.Tensor:
@@ -1603,7 +1603,7 @@ class HunyuanImage3ForConditionalGeneration(nn.Module, SupportsMultiModal, Suppo
layer.mlp = None
del mlp
gc.collect()
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
layer.mlp = HunyuanImage3SparseMoeBlock(
config=self.config,
@@ -276,7 +276,9 @@ class MiMoAudioDataParser(MultiModalDataParser):
self.device = torch.device(tokenizer_device)
else:
# Default to cuda (will use current GPU)
self.device = torch.device(f"cuda:{torch.cuda.current_device()}" if torch.cuda.is_available() else "cpu")
self.device = torch.device(
f"cuda:{torch.accelerator.current_device_index()}" if torch.cuda.is_available() else "cpu"
)
self.audio_tokenizer_path = os.environ.get("MIMO_AUDIO_TOKENIZER_PATH", None)
if not self.audio_tokenizer_path:
@@ -793,7 +793,7 @@ class MiMoAudioLLMForConditionalGeneration(nn.Module, SupportsMultiModal, Suppor
local_embeds: torch.FloatTensor, # [1, 1, hidden_size]
tokens_dtype: torch.dtype = torch.int64,
tokens_device: torch.device = torch.device(
f"cuda:{torch.cuda.current_device()}" if torch.cuda.is_available() else "cpu"
f"cuda:{torch.accelerator.current_device_index()}" if torch.cuda.is_available() else "cpu"
),
local_sampler: MiMoSampler | MiMoLocalSamplerTensor | None = None,
):
@@ -847,7 +847,7 @@ class MiMoAudioLLMForConditionalGeneration(nn.Module, SupportsMultiModal, Suppor
local_embeds: torch.FloatTensor, # [1, 1, hidden_size]
tokens_dtype: torch.dtype = torch.int64,
tokens_device: torch.device = torch.device(
f"cuda:{torch.cuda.current_device()}" if torch.cuda.is_available() else "cpu"
f"cuda:{torch.accelerator.current_device_index()}" if torch.cuda.is_available() else "cpu"
),
local_sampler: MiMoSampler | None = None,
):
@@ -110,7 +110,7 @@ class CUDAGraphDecoderWrapper:
with torch.no_grad():
_ = self.decoder(dummy)
torch.cuda.synchronize(device)
torch.accelerator.synchronize(device)
for size in self.capture_sizes:
try:
@@ -126,7 +126,7 @@ class CUDAGraphDecoderWrapper:
static_input = torch.zeros(1, self.num_quantizers, size, dtype=dtype, device=device)
with torch.no_grad():
_ = self.decoder(static_input)
torch.cuda.synchronize(device)
torch.accelerator.synchronize(device)
graph = CUDAGraph()
with torch.no_grad():
@@ -229,7 +229,7 @@ class _PerfTimer:
def _resolve(self) -> None:
if not self._pairs:
return
torch.cuda.synchronize()
torch.accelerator.synchronize()
for name, s, e in self._pairs:
self._timers[name] = self._timers.get(name, 0.0) + s.elapsed_time(e)
self._counts[name] = self._counts.get(name, 0) + 1
@@ -433,7 +433,7 @@ class VoxCPM2TalkerForConditionalGeneration(nn.Module):
self._tts.base_lm = None
del self._tts.residual_lm
self._tts.residual_lm = None
torch.cuda.empty_cache()
torch.accelerator.empty_cache()
self._inference_timesteps = 10
self._cfg_value = 2.0
@@ -85,7 +85,7 @@ class CUDAGraphAcousticTransformerWrapper:
with torch.no_grad():
self._forward_cudagraph_compatible(dummy, cfg_alpha=dummy_cfg_alpha, noise=dummy_noise)
torch.cuda.synchronize(device)
torch.accelerator.synchronize(device)
# Phase 2: Capture graphs
for size in self.capture_sizes:
@@ -199,7 +199,7 @@ class CUDAGraphAcousticTransformerWrapper:
with torch.no_grad():
_ = self._forward_cudagraph_compatible(static_input, cfg_alpha=static_cfg_alpha, noise=static_noise)
torch.cuda.synchronize(device)
torch.accelerator.synchronize(device)
graph = CUDAGraph()
with torch.no_grad():
+2 -2
View File
@@ -114,7 +114,7 @@ class CudaOmniPlatform(OmniPlatform, CudaPlatformBase):
@classmethod
def get_device_count(cls) -> int:
return torch.cuda.device_count()
return torch.accelerator.device_count()
@classmethod
def get_device_version(cls) -> str | None:
@@ -122,7 +122,7 @@ class CudaOmniPlatform(OmniPlatform, CudaPlatformBase):
@classmethod
def synchronize(cls) -> None:
torch.cuda.synchronize()
torch.accelerator.synchronize()
@classmethod
def get_free_memory(cls, device: torch.device | None = None) -> int:
+2 -2
View File
@@ -119,7 +119,7 @@ class RocmOmniPlatform(OmniPlatform, RocmPlatform):
@classmethod
def get_device_count(cls) -> int:
return torch.cuda.device_count()
return torch.accelerator.device_count()
@classmethod
def get_device_version(cls) -> str | None:
@@ -130,7 +130,7 @@ class RocmOmniPlatform(OmniPlatform, RocmPlatform):
@classmethod
def synchronize(cls) -> None:
torch.cuda.synchronize()
torch.accelerator.synchronize()
@classmethod
def get_free_memory(cls, device: torch.device | None = None) -> int:
+1 -1
View File
@@ -110,7 +110,7 @@ class OmniGPUWorkerBase(GPUWorker):
if kv_cache_memory_bytes := self.cache_config.kv_cache_memory_bytes:
self.model_runner.profile_run()
if current_omni_platform.is_rocm():
torch.cuda.synchronize()
torch.accelerator.synchronize()
return kv_cache_memory_bytes
with memory_profiling(
+1 -1
View File
@@ -227,7 +227,7 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin):
batch_descriptor=batch_desc,
):
self.talker_mtp(ids, emb, hid, ts)
torch.cuda.synchronize()
torch.accelerator.synchronize()
logger.info("Captured talker_mtp graphs for %d sizes", len(capture_sizes))
except RuntimeError as e: