[diffusion] chore: support custom output folder name in GT generation workflow (#23422)
This commit is contained in:
@@ -13,6 +13,11 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
type: string
|
type: string
|
||||||
|
output_name:
|
||||||
|
description: 'Custom output folder name (also used for artifact names and publish target dir). Leave empty to use defaults.'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
type: string
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: diffusion-ci-gt-gen-${{ github.ref }}
|
group: diffusion-ci-gt-gen-${{ github.ref }}
|
||||||
@@ -25,6 +30,7 @@ permissions:
|
|||||||
env:
|
env:
|
||||||
SGLANG_IS_IN_CI: true
|
SGLANG_IS_IN_CI: true
|
||||||
SGLANG_CUDA_COREDUMP: "1"
|
SGLANG_CUDA_COREDUMP: "1"
|
||||||
|
OUTPUT_NAME: ${{ inputs.output_name || 'diffusion-ci-outputs' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
multimodal-diffusion-gen-1gpu:
|
multimodal-diffusion-gen-1gpu:
|
||||||
@@ -52,20 +58,23 @@ jobs:
|
|||||||
--suite 1-gpu \
|
--suite 1-gpu \
|
||||||
--partition-id ${{ matrix.part }} \
|
--partition-id ${{ matrix.part }} \
|
||||||
--total-partitions 2 \
|
--total-partitions 2 \
|
||||||
--out-dir ./diffusion-ci-outputs \
|
--out-dir ./${{ env.OUTPUT_NAME }} \
|
||||||
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
|
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: diffusion-gen-1gpu-part${{ matrix.part }}
|
name: ${{ env.OUTPUT_NAME }}-1gpu-part${{ matrix.part }}
|
||||||
path: python/diffusion-ci-outputs
|
path: python/${{ env.OUTPUT_NAME }}
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Publish GT images to sglang-bot/sglang-ci-data
|
- name: Publish GT images to sglang-bot/sglang-ci-data
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
||||||
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir python/diffusion-ci-outputs
|
run: |
|
||||||
|
python scripts/ci/utils/diffusion/publish_diffusion_gt.py \
|
||||||
|
--source-dir python/${{ env.OUTPUT_NAME }} \
|
||||||
|
${{ inputs.output_name != '' && format('--target-dir diffusion-ci/{0}', inputs.output_name) || '' }}
|
||||||
|
|
||||||
multimodal-diffusion-gen-2gpu:
|
multimodal-diffusion-gen-2gpu:
|
||||||
if: github.repository == 'sgl-project/sglang'
|
if: github.repository == 'sgl-project/sglang'
|
||||||
@@ -92,20 +101,23 @@ jobs:
|
|||||||
--suite 2-gpu \
|
--suite 2-gpu \
|
||||||
--partition-id ${{ matrix.part }} \
|
--partition-id ${{ matrix.part }} \
|
||||||
--total-partitions 2 \
|
--total-partitions 2 \
|
||||||
--out-dir ./diffusion-ci-outputs \
|
--out-dir ./${{ env.OUTPUT_NAME }} \
|
||||||
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
|
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: diffusion-gen-2gpu-part${{ matrix.part }}
|
name: ${{ env.OUTPUT_NAME }}-2gpu-part${{ matrix.part }}
|
||||||
path: python/diffusion-ci-outputs
|
path: python/${{ env.OUTPUT_NAME }}
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Publish GT images to sglang-bot/sglang-ci-data
|
- name: Publish GT images to sglang-bot/sglang-ci-data
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
||||||
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir python/diffusion-ci-outputs
|
run: |
|
||||||
|
python scripts/ci/utils/diffusion/publish_diffusion_gt.py \
|
||||||
|
--source-dir python/${{ env.OUTPUT_NAME }} \
|
||||||
|
${{ inputs.output_name != '' && format('--target-dir diffusion-ci/{0}', inputs.output_name) || '' }}
|
||||||
|
|
||||||
multimodal-diffusion-gen-b200:
|
multimodal-diffusion-gen-b200:
|
||||||
if: github.repository == 'sgl-project/sglang'
|
if: github.repository == 'sgl-project/sglang'
|
||||||
@@ -127,17 +139,20 @@ jobs:
|
|||||||
cd python
|
cd python
|
||||||
python -m sglang.multimodal_gen.test.scripts.gen_diffusion_ci_outputs \
|
python -m sglang.multimodal_gen.test.scripts.gen_diffusion_ci_outputs \
|
||||||
--suite 1-gpu-b200 \
|
--suite 1-gpu-b200 \
|
||||||
--out-dir ./diffusion-ci-outputs \
|
--out-dir ./${{ env.OUTPUT_NAME }} \
|
||||||
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
|
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: diffusion-gen-b200
|
name: ${{ env.OUTPUT_NAME }}-b200
|
||||||
path: python/diffusion-ci-outputs
|
path: python/${{ env.OUTPUT_NAME }}
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Publish GT images to sglang-bot/sglang-ci-data
|
- name: Publish GT images to sglang-bot/sglang-ci-data
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
||||||
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir python/diffusion-ci-outputs
|
run: |
|
||||||
|
python scripts/ci/utils/diffusion/publish_diffusion_gt.py \
|
||||||
|
--source-dir python/${{ env.OUTPUT_NAME }} \
|
||||||
|
${{ inputs.output_name != '' && format('--target-dir diffusion-ci/{0}', inputs.output_name) || '' }}
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ else:
|
|||||||
REPO_OWNER = "sglang-bot"
|
REPO_OWNER = "sglang-bot"
|
||||||
REPO_NAME = "sglang-ci-data"
|
REPO_NAME = "sglang-ci-data"
|
||||||
BRANCH = "main"
|
BRANCH = "main"
|
||||||
TARGET_DIR = "diffusion-ci/consistency_gt"
|
DEFAULT_TARGET_DIR = "diffusion-ci/consistency_gt"
|
||||||
|
|
||||||
IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".webp"}
|
IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".webp"}
|
||||||
|
|
||||||
|
|
||||||
def collect_images(source_dir):
|
def collect_images(source_dir, target_dir):
|
||||||
"""Collect image files from source_dir and return list of (repo_path, content) tuples."""
|
"""Collect image files from source_dir and return list of (repo_path, content) tuples."""
|
||||||
files = []
|
files = []
|
||||||
for entry in sorted(os.listdir(source_dir)):
|
for entry in sorted(os.listdir(source_dir)):
|
||||||
@@ -56,24 +56,25 @@ def collect_images(source_dir):
|
|||||||
continue
|
continue
|
||||||
with open(full_path, "rb") as f:
|
with open(full_path, "rb") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
repo_path = f"{TARGET_DIR}/{entry}"
|
repo_path = f"{target_dir}/{entry}"
|
||||||
files.append((repo_path, content))
|
files.append((repo_path, content))
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
def publish(source_dir):
|
def publish(source_dir, target_dir=None):
|
||||||
|
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")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
files_to_upload = collect_images(source_dir)
|
files_to_upload = collect_images(source_dir, target_dir)
|
||||||
if not files_to_upload:
|
if not files_to_upload:
|
||||||
print(f"No image files found in {source_dir}")
|
print(f"No image files found in {source_dir}")
|
||||||
return
|
return
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f"Found {len(files_to_upload)} image(s) to upload to {REPO_OWNER}/{REPO_NAME}/{TARGET_DIR}"
|
f"Found {len(files_to_upload)} image(s) to upload to {REPO_OWNER}/{REPO_NAME}/{target_dir}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify token
|
# Verify token
|
||||||
@@ -158,8 +159,14 @@ def main():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--source-dir", required=True, help="Directory containing GT images"
|
"--source-dir", required=True, help="Directory containing GT images"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--target-dir",
|
||||||
|
required=False,
|
||||||
|
default=None,
|
||||||
|
help=f"Target directory in the remote repo (default: {DEFAULT_TARGET_DIR})",
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
publish(args.source_dir)
|
publish(args.source_dir, args.target_dir)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user