unet Chunking not supported in coremltools>7.1 and <7.1 does not support dynamic reshape
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 850
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 10
Description
## 🐞Describing the bug
using the torch2coreml script with the --chunk-unet option would result in the following error:
AttributeError: 'CacheDoublyLinkedList' object has no attribute 'index'. This error occurred because the index attribute has been removed from the CacheDoublyLinkedList class in the latest versions of coremltools.:https://github.com/apple/ml-stable-diffusion/pull/327
## Stack Trace
- If applicable, please paste the complete stack trace.
## To Reproduce
use coreml==7.2 and try to run https://github.com/apple/ml-stable-diffusion?tab=readme-ov-file#-converting-models-to-core-ml
`python -m python_coreml_stable_diffusion.torch2coreml --convert-unet --convert-text-encoder --convert-vae-decoder --convert-safety-checker --model-version -o `
```
# Paste Python code snippet here, complete with any required import statements.
```
- If the model conversion succeeds, but there is a numerical mismatch in predictions, please include the code used for comparisons.
## System environment (please complete the following information):
- coremltools version:
- OS (e.g. MacOS version or Linux type):
- Any other relevant version information (e.g. PyTorch or TensorFlow version):
```
(Pdb) main_block.operations
(Pdb) p coremltools.converters.mil.mil.utils.CacheDoublyLinkedList
*** NameError: name 'coremltools' is not defined
(Pdb) c
Traceback (most recent call last):
File "/workspace/pixart.py", line 266, in
main()
File "/workspace/pixart.py", line 191, in main
op_idx, first_chunk_weights_size, total_weights_size = _get_op_idx_split_location(
File "/opt/conda/envs/mobile_t2i/lib/python3.9/site-packages/python_coreml_stable_diffusion/chunk_mlprogram.py", line 94, in _get_op_idx_split_location
for op in main_block.operations:
AttributeError: 'CacheDoublyLinkedList' object has no attribute 'index'
```

## Additional context
- Add anything else about the problem here that you want to share.
- error also came when trying to conver Pixart sigma model to Coreml:https://github.com/PixArt-alpha/PixArt-sigma
Contributor guide
Assessment
This issue has not been assessed yet.