Skip to content

Commit

Permalink
Merge branch 'develop' into unadry-reshape
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 authored Apr 18, 2024
2 parents 584f637 + 8e4b561 commit 5d181c9
Show file tree
Hide file tree
Showing 97 changed files with 4,346 additions and 380 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,17 @@ foreach(py_file ${backend_files})
configure_file(${py_file} ${DEST_DIR}/lib/onnx_migraphx/. COPYONLY)
endforeach(py_file)

if(BUILD_ADDRESS_SANITIZER)
set(DEPENDS_HIP_RUNTIME "hip-runtime-amd-asan" )
else()
set(DEPENDS_HIP_RUNTIME "hip-runtime-amd" )
endif()

rocm_create_package(
NAME MIGraphX
DESCRIPTION "AMD's graph optimizer"
MAINTAINER "AMDMIGraphX Maintainer <[email protected]>"
LDCONFIG
PTH
DEPENDS miopen-hip rocblas hip-rocclr hip-base half ${PACKAGE_DEPENDS}
DEPENDS miopen-hip rocblas ${DEPENDS_HIP_RUNTIME} hip-base half ${PACKAGE_DEPENDS}
)
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y gnupg2 --no-install-recommends curl &&
curl -sL http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add -

# Add rocm repository
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/6.0.2/ focal main > /etc/apt/sources.list.d/rocm.list'
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/6.0.2/ jammy main > /etc/apt/sources.list.d/rocm.list'

# From docs.amd.com for installing rocm. Needed to install properly
RUN sh -c "echo 'Package: *\nPin: release o=repo.radeon.com\nPin-priority: 600' > /etc/apt/preferences.d/rocm-pin-600"
Expand Down
4 changes: 4 additions & 0 deletions docs/dev/env_vars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ Disables the ``schedule`` pass.
Set to "1", "enable", "enabled", "yes", or "true" to use.
Disables the ``fuse_reduce`` pass.

.. envvar:: MIGRAPHX_ENABLE_SPLIT_REDUCE
Set to "1", "enable", "enabled", "yes", or "true" to use.
Enable split_reduce.

.. envvar:: MIGRAPHX_ENABLE_NHWC

Set to "1", "enable", "enabled", "yes", or "true" to use.
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rocm-docs-core==0.37.0
rocm-docs-core==0.38.1
sphinx-collapse
4 changes: 2 additions & 2 deletions docs/sphinx/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gitdb==4.0.10
# via gitpython
gitpython==3.1.41
# via rocm-docs-core
idna==3.4
idna==3.7
# via requests
imagesize==1.4.1
# via sphinx
Expand Down Expand Up @@ -98,7 +98,7 @@ requests==2.31.0
# via
# pygithub
# sphinx
rocm-docs-core==0.37.0
rocm-docs-core==0.38.1
# via -r requirements.in
smmap==5.0.0
# via gitdb
Expand Down
1 change: 1 addition & 0 deletions examples/diffusion/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Diffusion Inference Examples

- [Python Stable Diffusion 2.1](./python_stable_diffusion_21)
- [Python Stable Diffusion XL](./python_stable_diffusion_xl)
6 changes: 3 additions & 3 deletions examples/diffusion/python_stable_diffusion_21/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stable Diffusion 2.1

This version was tested with [rocm 5.7](https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/rocm-5.7.0) revision.
This version was tested with [rocm 6.0](https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/rocm-6.0.0) revision.

## Jupyter notebook

Expand Down Expand Up @@ -33,7 +33,7 @@ export PYTHONPATH=/opt/rocm/lib:$PYTHONPATH
Get models with optimum

```bash
optimum-cli export onnx --model stabilityai/stable-diffusion-2-1 models/sd21-onnx
optimum-cli export onnx --model stabilityai/stable-diffusion-2-1 models/sd21-onnx --task stable-diffusion
```
*Note: `models/sd21-onnx` will be used in the scripts.*

Expand Down Expand Up @@ -61,7 +61,7 @@ pip install -r gradio_requirements.txt
Usage

```bash
python gradio_app.py
python gradio_app.py -p "a photograph of an astronaut riding a horse" --seed 13
```

This will load the models (which can take several minutes), and when the setup is ready, starts a server on `http://127.0.0.1:7860`.
24 changes: 15 additions & 9 deletions examples/diffusion/python_stable_diffusion_21/gradio_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#####################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,13 +22,17 @@
# THE SOFTWARE.
#####################################################################################

from txt2img import StableDiffusionMGX
from txt2img import StableDiffusionMGX, get_args
import gradio as gr


def main():
args = get_args()
# Note: This will load the models, which can take several minutes
sd = StableDiffusionMGX()
sd = StableDiffusionMGX(args.onnx_model_path, args.compiled_model_path,
args.fp16, args.force_compile,
args.exhaustive_tune)
sd.warmup(5)

def gr_wrapper(prompt, negative_prompt, steps, seed, scale):
result = sd.run(str(prompt), str(negative_prompt), int(steps),
Expand All @@ -38,12 +42,14 @@ def gr_wrapper(prompt, negative_prompt, steps, seed, scale):
demo = gr.Interface(
gr_wrapper,
[
gr.Textbox(value="a photograph of an astronaut riding a horse",
label="Prompt"),
gr.Textbox(value="", label="Negative prompt (Optional)"),
gr.Slider(1, 100, step=1, value=20, label="Number of steps"),
gr.Textbox(value=13, label="Random seed"),
gr.Slider(1, 20, step=0.1, value=7.0, label="Guidance scale"),
gr.Textbox(value=args.prompt, label="Prompt"),
gr.Textbox(value=args.negative_prompt,
label="Negative prompt (Optional)"),
gr.Slider(
1, 100, step=1, value=args.steps, label="Number of steps"),
gr.Textbox(value=args.seed, label="Random seed"),
gr.Slider(
1, 20, step=0.1, value=args.scale, label="Guidance scale"),
],
"image",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#####################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,5 +21,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
-f requirements.txt
-r requirements.txt
gradio
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#####################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,6 +21,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
-f https://repo.radeon.com/rocm/manylinux/rocm-rel-6.0/
torch==2.1.1
accelerate
diffusers
optimum[onnxruntime]
Expand Down
Loading

0 comments on commit 5d181c9

Please sign in to comment.