[diffusion] CI: enhance diffusion GT publishing with per-platform directory resolution (#32282)
This commit is contained in:
@@ -62,6 +62,7 @@ env:
|
|||||||
SGLANG_CUDA_COREDUMP: "1"
|
SGLANG_CUDA_COREDUMP: "1"
|
||||||
OUTPUT_NAME: ${{ inputs.output_name || 'diffusion-ci-outputs' }}
|
OUTPUT_NAME: ${{ inputs.output_name || 'diffusion-ci-outputs' }}
|
||||||
PUBLISH_TARGET_DIR: ${{ inputs.publish_target_dir || (inputs.run_official_cases && 'diffusion-ci/consistency_gt/official_generated' || 'diffusion-ci/consistency_gt/sglang_generated') }}
|
PUBLISH_TARGET_DIR: ${{ inputs.publish_target_dir || (inputs.run_official_cases && 'diffusion-ci/consistency_gt/official_generated' || 'diffusion-ci/consistency_gt/sglang_generated') }}
|
||||||
|
SGLANG_DIFFUSION_GT_PER_PLATFORM: "1"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compute-official-gt-matrix:
|
compute-official-gt-matrix:
|
||||||
|
|||||||
@@ -350,8 +350,7 @@ def validate_gt_files(files_to_upload, changed_files, remote_image_entries, toke
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def check_quality(source_dir, target_dir=None):
|
def check_quality(source_dir, target_dir):
|
||||||
target_dir = target_dir or DEFAULT_TARGET_DIR
|
|
||||||
token = os.getenv("GITHUB_TOKEN")
|
token = os.getenv("GITHUB_TOKEN")
|
||||||
if not token:
|
if not token:
|
||||||
print("Error: GITHUB_TOKEN environment variable not set")
|
print("Error: GITHUB_TOKEN environment variable not set")
|
||||||
@@ -372,8 +371,7 @@ def check_quality(source_dir, target_dir=None):
|
|||||||
validate_gt_files(files_to_upload, changed_files, remote_image_entries, token)
|
validate_gt_files(files_to_upload, changed_files, remote_image_entries, token)
|
||||||
|
|
||||||
|
|
||||||
def publish(source_dir, target_dir=None):
|
def publish(source_dir, target_dir):
|
||||||
target_dir = target_dir or DEFAULT_TARGET_DIR
|
|
||||||
token = os.getenv("GITHUB_TOKEN")
|
token = os.getenv("GITHUB_TOKEN")
|
||||||
if not token:
|
if not token:
|
||||||
print("Error: GITHUB_TOKEN environment variable not set")
|
print("Error: GITHUB_TOKEN environment variable not set")
|
||||||
@@ -478,6 +476,23 @@ def publish(source_dir, target_dir=None):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_target_dir(target_dir: str | None, per_platform: bool) -> str:
|
||||||
|
"""Resolve the effective remote target dir.
|
||||||
|
|
||||||
|
With ``per_platform`` set, append the consistency platform subdir
|
||||||
|
(``h100``/``b200``/``5090``) so the publish path matches how the consistency
|
||||||
|
tests resolve GT: ``<target>/<platform>/<file>`` first, bare ``<target>/<file>``
|
||||||
|
only as fallback. Reuses the SAME resolver the tests use so read and write can
|
||||||
|
never drift. Lazy import keeps this script light when the flag is off.
|
||||||
|
"""
|
||||||
|
target_dir = target_dir or DEFAULT_TARGET_DIR
|
||||||
|
if per_platform:
|
||||||
|
from sglang.multimodal_gen.test.test_utils import get_consistency_platform
|
||||||
|
|
||||||
|
target_dir = f"{target_dir}/{get_consistency_platform()}"
|
||||||
|
return target_dir
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Publish diffusion GT images to GitHub"
|
description="Publish diffusion GT images to GitHub"
|
||||||
@@ -497,10 +512,13 @@ def main():
|
|||||||
help="Validate generated GT images without publishing them",
|
help="Validate generated GT images without publishing them",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
per_platform = os.environ.get("SGLANG_DIFFUSION_GT_PER_PLATFORM") == "1"
|
||||||
|
target_dir = _resolve_target_dir(args.target_dir, per_platform)
|
||||||
if args.check_only:
|
if args.check_only:
|
||||||
check_quality(args.source_dir, args.target_dir)
|
check_quality(args.source_dir, target_dir)
|
||||||
else:
|
else:
|
||||||
publish(args.source_dir, args.target_dir)
|
publish(args.source_dir, target_dir)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user