COREMLTOOLs/NNPACK Python Issue
Labels: triaged, module: nnpack

### 🐛 Describe the bug

Hi All,

I am trying to conduct the export.py operations via coreML and I'm sure that this is not the way the process should be initialised.

The export process should allow me to use these following on the MBP M1 Silicon MAX 32 cores by follow @glenn-jocher's instructions. 
```
1.  python3 export.py --weights yolov5s.pt --include coreml  # CoreML export
2. python3 detect.py --weights yolov5s.mlmodel  # CoreML inference (MacOS-only)
3. python3 val.py --weights yolov5s.mlmodel  # CoreML validation (MacOS-only)
```


WHAT I DID:
install all of the dependences as per @glenn-jocher requirements.py and pip3 install coremltools

```
# YOLOv5 requirements
# Usage: pip install -r requirements.tx

# Base ----------------------------------------
matplotlib>=3.2.2
numpy>=1.18.5
opencv-python>=4.1.1
Pillow>=7.1.2
PyYAML>=5.3.1
requests>=2.23.0
scipy>=1.4.1
torch>=1.7.0
torchvision>=0.8.1
tqdm>=4.64.0
protobuf<=3.20.1  # https://github.com/ultralytics/yolov5/issues/8012

# Logging -------------------------------------
tensorboard>=2.4.1
# wandb
# clearml

# Plotting ------------------------------------
pandas>=1.1.4
seaborn>=0.11.0

# Export --------------------------------------
# coremltools>=5.2  # CoreML export
# onnx>=1.9.0  # ONNX export
# onnx-simplifier>=0.4.1  # ONNX simplifier
# nvidia-pyindex  # TensorRT export
# nvidia-tensorrt  # TensorRT export
# scikit-learn==0.19.2  # CoreML quantization
# tensorflow>=2.4.1  # TFLite export (or tensorflow-cpu, tensorflow-aarch64)
# tensorflowjs>=3.9.0  # TF.js export
# openvino-dev  # OpenVINO export

# Extras --------------------------------------
ipython  # interactive notebook
psutil  # system utilization
thop>=0.1.1  # FLOPs computation
# albumentations>=1.0.3
# pycocotools>=2.0  # COCO mAP
# roboflow
```

THEN:
install additional upgraded packages per the error notification for such.
```
symbadian$ pip3 list
Package                      Version
---------------------------- --------------------
absl-py                      1.2.0
anyio                        3.6.1
appnope                      0.1.3
arel                         0.2.0
asttokens                    2.0.8
astunparse                   1.6.3
async-asgi-testclient        1.4.11
backcall                     0.2.0
bidict                       0.22.0
CacheControl                 0.12.11
cachetools                   5.2.0
cachy                        0.3.0
certifi                      2022.6.15
charset-normalizer           2.1.1
cleo                         0.8.1
click                        8.1.3
clikit                       0.6.2
coremltools                  6.0b2
crashtest                    0.3.1
cycler                       0.11.0
decorator                    5.1.1
distlib                      0.3.5
executing                    0.9.1
fastapi                      0.80.0
filelock                     3.8.0
flatbuffers                  1.12
fonttools                    4.36.0
gast                         0.4.0
google-auth                  2.11.0
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.47.0
h11                          0.13.0
h5py                         3.7.0
html5lib                     1.1
httptools                    0.4.0
idna                         3.3
imageio                      2.21.1
imgaug                       0.4.0
ipython                      8.4.0
jedi                         0.18.1
Jinja2                       3.1.2
jsonpatch                    1.32
jsonpointer                  2.3
keras                        2.9.0
Keras-Preprocessing          1.1.2
keyring                      23.8.2
kiwisolver                   1.4.4
libclang                     14.0.6
lockfile                     0.12.2
Markdown                     3.4.1
MarkupSafe                   2.1.1
matplotlib                   3.5.3
matplotlib-inline            0.1.6
mpmath                       1.2.1
msgpack                      1.0.4
multidict                    6.0.2
natsort                      8.1.0
networkx                     2.8.6
numpy                        1.23.2
oauthlib                     3.2.0
opencv-python                4.6.0.66
opt-einsum                   3.3.0
packaging                    20.9
pafy                         0.5.5
pandas                       1.3.5
parso                        0.8.3
pastel                       0.2.1
pexpect                      4.8.0
pickleshare                  0.7.5
Pillow                       9.2.0
pip                          22.2.2
pkginfo                      1.8.3
platformdirs                 2.5.2
poetry                       1.1.15
poetry-core                  1.0.8
prompt-toolkit               3.0.30
protobuf                     3.20.1
psutil                       5.9.1
PTable                       0.9.2
ptyprocess                   0.7.0
pure-eval                    0.2.2
pyasn1                       0.4.8
pyasn1-modules               0.2.8
pydantic                     1.9.2
pydicom                      2.3.0
Pygments                     2.13.0
pylev                        1.4.0
pynrrd                       0.4.3
pyparsing                    3.0.9
python-dateutil              2.8.2
python-dotenv                0.20.0
python-json-logger           2.0.4
python-magic                 0.4.27
pytz                         2022.2.1
PyWavelets                   1.3.0
PyYAML                       6.0
requests                     2.28.1
requests-oauthlib            1.3.1
requests-toolbelt            0.9.1
rsa                          4.9
scikit-image                 0.19.3
scikit-video                 1.1.11
scipy                        1.9.0
seaborn                      0.11.2
setuptools                   63.2.0
Shapely                      1.8.4
shellingham                  1.5.0
SimpleITK                    2.1.1.2
six                          1.16.0
sniffio                      1.2.0
stack-data                   0.4.0
starlette                    0.19.1
stringcase                   1.2.0
supervisely                  6.58.4
sympy                        1.10.1
tensorboard                  2.9.1
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.9.1
tensorflow-estimator         2.9.0
tensorflow-io-gcs-filesystem 0.26.0
termcolor                    1.1.0
thop                         0.1.1.post2207130030
tifffile                     2022.8.12
tomlkit                      0.11.4
torch                        1.12.1
torchaudio                   0.12.1
torchvision                  0.13.1
tqdm                         4.64.0
traitlets                    5.3.0
trimesh                      3.14.0
typing_extensions            4.3.0
urllib3                      1.26.11
uvicorn                      0.18.3
uvloop                       0.16.0
varname                      0.9.0
virtualenv                   20.16.3
watchfiles                   0.16.1
watchgod                     0.6
wcwidth                      0.2.5
webencodings                 0.5.1
websockets                   10.3
Werkzeug                     2.2.2
wheel                        0.37.1
wrapt                        1.14.1
youtube-dl                   2021.12.17
```

LASTLY INITIALISE Command:
```
symbadian$ python3 export.py --weights yolov5s.pt --include coreml --imgs 640
```

I keep getting the error "python quit unexpectedly" followed by the output below

### Versions

symbadian$ python3 export.py --weights yolov5s.pt --include coreml --imgs 640 
export: data=data/coco128.yaml, weights=['yolov5s.pt'], imgsz=[640], batch_size=1, device=cpu, half=False, inplace=False, train=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=12, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['coreml']
YOLOv5 🚀 v6.2-51-ge6f54c5 Python-3.10.6 torch-1.12.1 CPU

Fusing layers... 
[W NNPACK.cpp:51] Could not initialize NNPACK! Reason: Unsupported hardware.
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients

PyTorch: starting from yolov5s.pt with output shape (1, 25200, 85) (14.1 MB)
Illegal instruction: 4