Skip to content

Commit

Permalink
Switch punet tests to use .mlir and .irpa files from Hugging Face. (#283
Browse files Browse the repository at this point in the history
)

See https://huggingface.co/amd-shark/sdxl-quant-models, which is now a
source of truth for developers interfacing with this model. For now the
files are pinned to a commit hash as changes are expected over the
coming days.

Some details:

* I needed to update the regex in `download_remote_files.py` to support
subdirectories. The `/` search was greedy, capturing e.g.
`fe57fe12eeb6eac83f469793984f6ad4c06a478c/unet/fp16/export` and
`sdxl_unet_fp16_dataset.irpa` instead of
`fe57fe12eeb6eac83f469793984f6ad4c06a478c` and
`unet/fp16/export/sdxl_unet_fp16_dataset.irpa`.
* This benefits from #282,
since the `.mlir` file that the test collector looks for is a remote
file not downloaded with a regular Git [LFS] checkout. That PR changes
the collector to look for `test_cases.json` instead of `.mlir` files.
  • Loading branch information
ScottTodd authored Jul 9, 2024
1 parent 2c0a312 commit 6fd8fd0
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion iree_tests/download_remote_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ def download_huggingface_remote_file(
# repo_id: SlyEcho/open_llama_3b_v2_gguf
# revision: main
# filename: open-llama-3b-v2-q4_0.gguf
result = re.search(r"https://huggingface.co/(.+)/resolve/(.+)/(.+)", remote_file)
result = re.search(
r"https://huggingface.co/(.+)/resolve/([^\/]+)/(.+)", remote_file
)
repo_id = result.groups()[0]
revision = result.groups()[1]
filename = result.groups()[2]
Expand Down
4 changes: 4 additions & 0 deletions iree_tests/sharktank/punet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Model source files are downloaded from
# https://huggingface.co/amd-shark/sdxl-quant-models, not stored in Git LFS.
*.mlirbc
*.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--parameters=model=sdxl_fp16_dataset.irpa
--parameters=model=sdxl_unet_fp16_dataset.irpa
--input=1x4x128x128xf16
--input=1xi32
--input=2x64x2048xf16
Expand Down
3 changes: 0 additions & 3 deletions iree_tests/sharktank/punet/fp16/sdxl_fp16_export_mlir.mlirbc

This file was deleted.

3 changes: 2 additions & 1 deletion iree_tests/sharktank/punet/fp16/test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"name": "real_weights",
"runtime_flagfile": "real_weights_data_flags.txt",
"remote_files": [
"https://sharkpublic.blob.core.windows.net/sharkpublic/scotttodd/iree_tests/2024_07_02/sdxl_fp16_dataset.irpa",
"https://huggingface.co/amd-shark/sdxl-quant-models/resolve/fe57fe12eeb6eac83f469793984f6ad4c06a478c/unet/fp16/export/sdxl_unet_fp16_dataset.irpa",
"https://huggingface.co/amd-shark/sdxl-quant-models/resolve/fe57fe12eeb6eac83f469793984f6ad4c06a478c/unet/fp16/export/sdxl_unet_fp16_export.mlir"
// TODO: files for real inputs and real expected outputs
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--parameters=model=sdxl_int8_dataset.irpa
--parameters=model=sdxl_unet_int8_dataset.irpa
--input=1x4x128x128xf16
--input=1xi32
--input=2x64x2048xf16
Expand Down
3 changes: 0 additions & 3 deletions iree_tests/sharktank/punet/int8/sdxl_int8_export_mlir.mlirbc

This file was deleted.

3 changes: 2 additions & 1 deletion iree_tests/sharktank/punet/int8/test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"name": "real_weights",
"runtime_flagfile": "real_weights_data_flags.txt",
"remote_files": [
"https://sharkpublic.blob.core.windows.net/sharkpublic/scotttodd/iree_tests/2024_07_02/sdxl_int8_dataset.irpa",
"https://huggingface.co/amd-shark/sdxl-quant-models/resolve/fe57fe12eeb6eac83f469793984f6ad4c06a478c/unet/int8/export/sdxl_unet_int8_dataset.irpa",
"https://huggingface.co/amd-shark/sdxl-quant-models/resolve/fe57fe12eeb6eac83f469793984f6ad4c06a478c/unet/int8/export/sdxl_unet_int8_export.mlir"
// TODO: files for real inputs and real expected outputs
]
}
Expand Down

0 comments on commit 6fd8fd0

Please sign in to comment.