# Error converting SDXL model to ONNX with optimum-cli

**URL:** <https://discuss.huggingface.co/t/error-converting-sdxl-model-to-onnx-with-optimum-cli/80945>\
**Category:** Beginners\
**Created:** [April 9, 2024, 6:56pm UTC](https://discuss.huggingface.co/t/error-converting-sdxl-model-to-onnx-with-optimum-cli/80945 "2024-04-09T18:56:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![netgeek](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@netgeek](https://discuss.huggingface.co/u/netgeek)\
**Post date:** [April 9, 2024, 6:56pm UTC](https://discuss.huggingface.co/t/error-converting-sdxl-model-to-onnx-with-optimum-cli/80945/1 "2024-04-09T18:56:54Z")

</div>

Hello,

> **[ONNX Runtime](https://huggingface.co/docs/diffusers/en/optimization/onnx)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

I followed the instructions from the link above to install optimum-cli and to convert the SDXL model to ONNX. But I got this error. Does anyone know what could be wrong? Thank you.

```auto
$ optimum-cli export onnx --model stabilityai/stable-diffusion-xl-base-1.0 --task stable-diffusion-xl sd_xl_onnx/
Framework not specified. Using pt to export the model.
Keyword arguments {'subfolder': '', 'trust_remote_code': False} are not expected by StableDiffusionXLImg2ImgPipeline and will be ignored.
Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 9.37it/s]
Traceback (most recent call last):
  File "/opt/anaconda3/envs/onnx/bin/optimum-cli", line 8, in <module>
    sys.exit(main())
  File "/opt/anaconda3/envs/onnx/lib/python3.7/site-packages/optimum/commands/optimum_cli.py", line 163, in main
    service.run()
  File "/opt/anaconda3/envs/onnx/lib/python3.7/site-packages/optimum/commands/export/onnx.py", line 285, in run
    **input_shapes,
  File "/opt/anaconda3/envs/onnx/lib/python3.7/site-packages/optimum/exporters/onnx/ __main__.py", line 371, in main_export
    **kwargs_shapes,
  File "/opt/anaconda3/envs/onnx/lib/python3.7/site-packages/optimum/exporters/onnx/convert.py", line 1029, in onnx_export_from_model
    dtype = get_parameter_dtype(model) if framework == "pt" else model.dtype
  File "/opt/anaconda3/envs/onnx/lib/python3.7/site-packages/diffusers/configuration_utils.py", line 137, in __getattr__
    raise AttributeError(f"'{type(self). __name__ }' object has no attribute '{name}'")
AttributeError: 'StableDiffusionXLImg2ImgPipeline' object has no attribute 'dtype'

```

This is the output from “optimum-cli env”:

```auto
- `optimum` version: 1.18.0
- `transformers` version: 4.30.2
- Platform: Darwin-23.4.0-x86_64-i386-64bit
- Python version: 3.7.6
- Huggingface_hub version: 0.16.4
- PyTorch version (GPU?): 1.13.1 (cuda availabe: False)
- Tensorflow version (GPU?): not installed (cuda availabe: NA)

```
