Skip to content

AMD SDXL changes resolution and steps #1050

@HemanLin-cl

Description

@HemanLin-cl

Hi all,

I've tried to download nexa-cli_windows_x86_64.exe and install and then execute the

nexa infer NexaAI/sdxl-turbo-amd-npu --prompt "a cartoon cat"

It can run with NPU usage under AMD Ryzen AI 9 HX370. However, I've found it cannot set the arguments to change the output resolution and steps cause I want to test 1024x1024 actually

Therefore, I try to use "pip install nexaai" instead
And then I implement a python file to run the model.

from nexaai import ImageGen, ModelConfig
imagegen = ImageGen.from_(model="NexaAI/sdxl-turbo-amd-npu", plugin_id="cpu_gpu", device_id="gpu")
result = imagegen.txt2img(prompt="a beautiful mountain landscape, sunset, 4k",
output_path="test_sdxl_amd.png",
height=1024,
width=1024,
steps=5,
guidance_scale=7.5)

After running this python file, it shows: (plugin_id="nexaai" also shows the errors)

[DEBUG] [model_hub.py:449:ensure_model_downloaded] Model NexaAI/sdxl-turbo-amd-npu already exists locally
[DEBUG] [model_loader.py:212:_select_model_file] Selected quant: N/A, file: lib/xclbin/stx/SD15_SD3_VAE_2x4x4.xclbin
[DEBUG] [image_gen.py:68:init] is_native_plugin(nexa_dml) = False
[DEBUG] [image_gen.py:96:init] Plugin nexa_dml is not a native plugin, using C interface
[WARN ] [core.py:148:_log_callback] Plugin id 'nexa_dml' is deprecated, use 'nexaai' instead
[WARN ] [core.py:148:log_callback] Failed to list directory contents: directory_iterator::directory_iterator: The directory name is invalid.: "C:\Users.cache\nexa.ai\nexa_sdk\models\NexaAI\sdxl-turbo-amd-npu\lib\xclbin\stx\SD15_SD3_VAE_2x4x4.xclbin"
[ERROR] [core.py:148:log_callback] Required file model_index.json not found in model directory: C:\Users.cache\nexa.ai\nexa_sdk\models\NexaAI\sdxl-turbo-amd-npu\lib\xclbin\stx\SD15_SD3_VAE_2x4x4.xclbin/model_index.json
Traceback (most recent call last):
File "C:\Users\Heman\AIPC\nexa\nexa_infer.py", line 8, in
imagegen = ImageGen.from
(model="NexaAI/sdxl-turbo-amd-npu", plugin_id="cpu_gpu", device_id="gpu") #nexaai
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\isaac\miniconda3\Lib\site-packages\nexaai\internal\model_loader.py", line 27, in from

return cls._from_huggingface_repo(model, quant, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\isaac\miniconda3\Lib\site-packages\nexaai\internal\model_loader.py", line 97, in _from_huggingface_repo
return cls._create_instance(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\isaac\miniconda3\Lib\site-packages\nexaai\image_gen.py", line 261, in _create_instance
return cls(**params)
^^^^^^^^^^^^^
File "C:\Users\isaac\miniconda3\Lib\site-packages\nexaai\image_gen.py", line 135, in init
check_error(error_code)
File "C:\Users\isaac\miniconda3\Lib\site-packages\nexaai\nexa_sdk\error.py", line 131, in check_error
raise exception_class(error_code)
nexaai.nexa_sdk.error.NexaModelLoadError: [-100201] Model loading failed
[DEBUG] [core.py:148:_log_callback] deinitializing ml

Is there any sample code we can run sdxl-turbo-amd-npu by python API?
or is there any method I can test using other resolution and steps under AMD?

I also try to let the directory_iterator::directory_iterator: be "C:\Users.cache\nexa.ai\nexa_sdk\models\NexaAI" and then the model_index.json can be read but it still cannot generate the images.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions