Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] Simple Maxdiffusion SDXL inference integration #299

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mailvijayasingh
Copy link
Collaborator

Description

Simple Integration of Maxdiffusion Inference in auto benchmarking framework

Tests

Tested the flow in dev environment

Please describe the tests that you ran on Cloud VM to verify changes.

Instruction and/or command lines to reproduce your tests: ...

List links for your tests (use go/shortn-gen for any internal link): ...

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • [ X] I have performed a self-review of my code.
  • [ X] I have necessary comments in my code, particularly in hard-to-understand areas.
  • [X ] I have run one-shot tests and provided workload links above if applicable.
  • [X ] I have made or will make corresponding changes to the doc if needed.

# Configure flags
""" python -m src.maxdiffusion.generate_sdxl src/maxdiffusion/configs/base_xl.yml run_name="my_run" """,
# Give server time to start
f"sleep {model_configs['sleep_time']}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? I had to have this for my jetengine server

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can delete it.

dags/inference/maxdiffusion_inference.py Outdated Show resolved Hide resolved
dags/inference/maxdiffusion_inference.py Outdated Show resolved Hide resolved
"SDXL-Base-1": {
"sleep_time": 120,
"tpu_version_cores": [(TpuVersion.V5E, 8), (TpuVersion.V5P, 8)],
"maxdiffusion_logs": "gs://inference-benchmarks/models/SDXL-Base-1/2024-05-14-14-01/",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove since this is unused.

model_configs = {}
model_configs["model_name"] = model
model_configs["sleep_time"] = sweep_model_configs["sleep_time"]
model_configs["maxdiffusion_logs"] = sweep_model_configs["maxdiffusion_logs"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unused

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all parameters, but some are used in next revision

dags/inference/maxdiffusion_inference.py Outdated Show resolved Hide resolved
@mailvijayasingh mailvijayasingh changed the title Simple Maxdiffusion SDXL inference integration [Do Not Merge] Simple Maxdiffusion SDXL inference integration May 31, 2024
Copy link
Collaborator

@yeandy yeandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! When the tests complete successfully in your composer environment, please post a screenshot of the green DAGs in the PR's summary.

@@ -47,10 +56,13 @@ def get_maxdiffusion_inference_nightly_config(
dataset_name=metric_config.DatasetOption.BENCHMARK_DATASET,
)

per_device_bat_size = model_configs["per_device_batch_size"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
per_device_bat_size = model_configs["per_device_batch_size"]
per_device_batch_size = model_configs["per_device_batch_size"]

"pip3 install ."
"pip3 install .",
# dependency for controlnet
"apt-get install ffmpeg libsm6 libxext6 -y" "cd ..",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"apt-get install ffmpeg libsm6 libxext6 -y" "cd ..",
"apt-get install ffmpeg libsm6 libxext6 -y",
"cd ..",

"cd ..",
f"gsutil cp metrics.json {metric_config.SshEnvVars.GCS_OUTPUT.value}",
)
if model_name == "SDXL-Lightning":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: change to elif here and below.

"cd maxdiffusion",
# Configure flags
"cd .."
f""" python -m src.maxdiffusion.generate_sdxl src/maxdiffusion/configs/base_xl.yml run_name="my_run" per_device_batch_size={per_device_bat_size} attention="{attention}" """,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename "my_run" to something more specific to "sdxl". Here, and below.


_modify_save_metrics("metrics.json", model_configs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if _modify_save_metrics will actually affect the metrics.json file. We're running the _modify_save_metrics function when we define the DAG, but to actually need the function to run in the TPU VM at run time.

We can either have bash commands to do something like _modify_save_metrics, which may be more difficult. OR, we could have a python script in the maxdiffusion repo (or other repo) to do this logic. OR, we could do this logic directly in the generate_sdxl.py file (with a flag to add the dimensions key.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't make these changes right? Can we rebase master please?

@vipannalla
Copy link
Collaborator

Looks good overall, can you paste the composer link?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants