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

SDPA flag update - static code analysis #1601

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/contrastive-image-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ PT_HPU_LAZY_MODE=0 python run_clip.py \
--gaudi_config_name Habana/clip \
--throughput_warmup_steps 3 \
--dataloader_num_workers 16 \
--sdp_on_bf16 \
--bf16 \
--trust_remote_code \
--torch_compile_backend=hpu_backend \
Expand Down Expand Up @@ -149,6 +150,7 @@ python ../gaudi_spawn.py --world_size 8 --use_mpi run_clip.py \
--dataloader_num_workers 16 \
--mediapipe_dataloader \
--bf16 \
--sdp_on_bf16 \
--distribution_strategy fast_ddp \
--trust_remote_code \
--torch_compile_backend=hpu_backend \
Expand Down Expand Up @@ -265,6 +267,7 @@ python run_clip.py \
--use_hpu_graphs_for_inference \
--gaudi_config_name Habana/clip \
--bf16 \
--sdp_on_bf16 \
--mediapipe_dataloader \
--trust_remote_code
```
Expand Down
1 change: 1 addition & 0 deletions examples/question-answering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ python run_seq2seq_qa.py \
--pad_to_max_length \
--save_strategy epoch \
--throughput_warmup_steps 3 \
--sdp_on_bf16 \
--bf16
```

Expand Down
6 changes: 6 additions & 0 deletions examples/speech-recognition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ python run_speech_recognition_ctc.py \
--use_lazy_mode \
--gaudi_config_name="Habana/wav2vec2" \
--throughput_warmup_steps="3" \
--sdp_on_bf16 \
--bf16 \
--use_hpu_graphs_for_training \
--use_hpu_graphs_for_inference
Expand Down Expand Up @@ -127,6 +128,7 @@ python ../gaudi_spawn.py \
--gaudi_config_name Habana/wav2vec2 \
--throughput_warmup_steps 3 \
--bf16 \
--sdp_on_bf16 \
--use_hpu_graphs_for_training \
--use_hpu_graphs_for_inference
```
Expand Down Expand Up @@ -207,6 +209,7 @@ python run_speech_recognition_ctc.py \
--use_habana \
--use_lazy_mode \
--gaudi_config_name="Habana/wav2vec2" \
--sdp_on_bf16 \
--bf16 \
--use_hpu_graphs_for_inference
```
Expand Down Expand Up @@ -246,6 +249,7 @@ python run_speech_recognition_seq2seq.py \
--max_duration_in_seconds="30" \
--text_column_name="sentence" \
--freeze_feature_encoder="False" \
--sdp_on_bf16 \
--bf16 \
--overwrite_output_dir \
--do_train \
Expand Down Expand Up @@ -286,6 +290,7 @@ python ../gaudi_spawn.py \
--max_duration_in_seconds="30" \
--text_column_name="sentence" \
--freeze_feature_encoder="False" \
--sdp_on_bf16 \
--bf16 \
--overwrite_output_dir \
--do_train \
Expand Down Expand Up @@ -319,6 +324,7 @@ python run_speech_recognition_seq2seq.py \
--max_duration_in_seconds="30" \
--text_column_name="sentence" \
--freeze_feature_encoder="False" \
--sdp_on_bf16 \
--bf16 \
--overwrite_output_dir \
--do_eval \
Expand Down
36 changes: 36 additions & 0 deletions examples/stable-diffusion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -65,6 +66,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -83,6 +85,7 @@ python ../gaudi_spawn.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--distributed
```
Expand All @@ -107,6 +110,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion-2 \
--sdp_on_bf16 \
--bf16
```

Expand Down Expand Up @@ -135,6 +139,7 @@ python text_to_image_generation.py \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion-2 \
--ldm3d \
--sdp_on_bf16 \
--bf16
```

Expand Down Expand Up @@ -180,6 +185,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -200,6 +206,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -221,6 +228,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -241,6 +249,7 @@ python ../gaudi_spawn.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--distributed
```
Expand All @@ -257,6 +266,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--optimize
```
Expand All @@ -273,6 +283,7 @@ QUANT_CONFIG=./quantization/quant_config.json python text_to_image_generation.py
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--optimize
```
Expand All @@ -298,6 +309,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--num_inference_steps 1 \
--guidance_scale 1.000001 \
Expand Down Expand Up @@ -339,6 +351,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -363,6 +376,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -389,6 +403,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -409,6 +424,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--quant_mode measure
```
Expand All @@ -428,6 +444,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--quant_mode quantize
```
Expand All @@ -451,6 +468,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -468,6 +486,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -486,6 +505,7 @@ python ../gaudi_spawn.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16 \
--distributed
```
Expand All @@ -505,6 +525,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -524,6 +545,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion-2 \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -547,6 +569,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -566,6 +589,7 @@ python text_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -590,6 +614,7 @@ python image_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -615,6 +640,7 @@ python image_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -639,6 +665,7 @@ python image_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -660,6 +687,7 @@ python image_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -678,6 +706,7 @@ python image_to_image_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -693,6 +722,7 @@ python depth_to_image_generation.py \
--image_save_dir /tmp/stable_diffusion_images \
--use_habana \
--use_hpu_graphs \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -709,6 +739,7 @@ python unconditional_image_generation.py \
--use_habana \
--use_gaudi_ddim_scheduler \
--use_hpu_graphs \
--sdp_on_bf16 \
--bf16 \
--save_outputs \
--output_dir "/tmp/"
Expand Down Expand Up @@ -753,6 +784,7 @@ python text_to_image_generation.py \
--use_habana --use_hpu_graphs \
--image_save_dir /tmp/stable_diffusion_images_compel \
--seed 33 \
--sdp_on_bf16 \
--bf16 \
--num_inference_steps 20 \
--use_compel
Expand All @@ -773,6 +805,7 @@ python text_to_image_generation.py \
--image_save_dir /tmp/stable_diffusion_images_freeu \
--seed 33 \
--use_freeu \
--sdp_on_bf16 \
--bf16
```
# Stable Video Diffusion Examples
Expand All @@ -799,6 +832,7 @@ python image_to_video_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand All @@ -823,6 +857,7 @@ python image_to_video_generation.py \
--use_habana \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--sdp_on_bf16 \
--bf16
```

Expand Down Expand Up @@ -858,6 +893,7 @@ python image_to_video_generation.py \
--use_hpu_graphs \
--gaudi_config Habana/stable-diffusion \
--bf16 \
--sdp_on_bf16 \
--num_frames 14 \
--motion_bucket_id=14 \
--width=512 \
Expand Down
7 changes: 7 additions & 0 deletions examples/stable-diffusion/depth_to_image_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ def main():
),
)
parser.add_argument("--bf16", action="store_true", help="Whether to perform generation in bf16 precision.")
parser.add_argument(
"--sdp_on_bf16",
action="store_true",
default=False,
help="Allow pyTorch to use reduced precision in the SDPA math backend"
)
parser.add_argument(
"--throughput_warmup_steps",
type=int,
Expand Down Expand Up @@ -223,6 +229,7 @@ def main():
"use_habana": args.use_habana,
"use_hpu_graphs": args.use_hpu_graphs,
"gaudi_config": args.gaudi_config_name,
"sdp_on_bf16": args.sdp_on_bf16,
}

if args.bf16:
Expand Down
Loading