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

Stable Diffusion Reference Implementation #1519

Merged
merged 7 commits into from
Dec 13, 2023

Conversation

pgmpablo157321
Copy link
Contributor

@pgmpablo157321 pgmpablo157321 commented Nov 14, 2023

Contains the Stable Diffusion Reference Implementation. Currently ready for testing.

Copy link

github-actions bot commented Nov 14, 2023

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@pgmpablo157321 pgmpablo157321 force-pushed the stable_diffusion_reference branch 7 times, most recently from 6712ed4 to c1177e1 Compare November 20, 2023 19:40
@pgmpablo157321 pgmpablo157321 marked this pull request as ready for review November 22, 2023 19:01
@pgmpablo157321 pgmpablo157321 requested a review from a team as a code owner November 22, 2023 19:01
### Run the benchmark
#### Local run
```bash
python3 main.py --dataset "coco-1024" --dataset-path coco2014 --profile stable-diffusion-xl-pytorch [--model-path <TODO: provide model weights>] [--dtype <fp32, fp16 or bf16>] [--device <cuda or cpu>] [--time 600] [--scenario SingleStream]
Copy link
Contributor

Choose a reason for hiding this comment

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

While trying the below command

CMD: /home/arjun/cm/bin/python3 main.py  --scenario Offline --profile stable-diffusion-xl-pytorch  --dataset coco-1024 --dataset-path /home/arjun/CM/repos/local/cache/03fbdcf95b3d4104/install --dtype fp32 --device cpu   --mlperf_conf '/home/arjun/CM/repos/local/cache/d31d3986d6ba4c43/inference/mlperf.conf'

this error is coming

ERROR:main:thread: failed on contentid=['/home/arjun/CM/repos/local/cache/03fbdcf95b3d4104/install/validation/data/COCO_val2014_000000214494.jpg'], The size of tensor a (128) must match the size of tensor b (21) at non-singleton dimension 3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arjunsuresh I was inspecting this error and got a similar one, but I am not sure if they are the same:

IndexError: index 21 is out of bounds for dimension 0 with size 21

This is an issue that occurs because the scheduler can't handle multiple threads. Could you try to run the benchmark with the argument --threads 1?

I am working in supporting this or maybe replacing it with a batch_size in the forward pass

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you @pgmpablo157321 for checking. With --threads 1 it is working fine and on RTX 4090 I'm seeing a mean latency of 5s.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please share how this file was generated?. The TF has been using https://github.com/ahmadki/mlperf_sd_inference/blob/master/captions_5k.tsv for experiments, are they same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They contain the same set of captions and images. I sorted them by id. The code used to generate them:
https://github.com/pgmpablo157321/inference/blob/055817374e369643a5e4d66e17ba765df5103b1d/text_to_image/tools/coco.py#L101-L126

text_to_image/main.py Outdated Show resolved Hide resolved
@pgmpablo157321 pgmpablo157321 force-pushed the stable_diffusion_reference branch 9 times, most recently from 6eb8859 to 3a1c804 Compare December 11, 2023 19:21
@pgmpablo157321 pgmpablo157321 force-pushed the stable_diffusion_reference branch 3 times, most recently from b369eb6 to 07f0538 Compare December 12, 2023 22:13
@mrmhodak mrmhodak merged commit 55bebbf into mlcommons:master Dec 13, 2023
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants