apple / coremltools

Core ML tools contain supporting tools for Core ML model conversion, editing, and validation.
https://coremltools.readme.io
BSD 3-Clause "New" or "Revised" License
4.33k stars 627 forks source link

Coremltools 3.03b NeuralNetworkShaper Resnet50 crashes Python #406

Closed mcsieber closed 3 years ago

mcsieber commented 5 years ago

Here is the markdown of the Jupyter Notebook to reproduce the problem:

Coremltools 3.03b NeuralNetworkShaper Resnet50 crashes Python

Python 3.6.7 on MacOS 10.14.5

rn50_spec = rn50.get_spec(); type(rn50_spec) Model_pb2.Model

rn50_loaded_spec = cu.load_spec(coreml_str); type(rn50_loaded_spec) Model_pb2.Model

#### Attempt to get NN Shaper crashes Python
```python
rn50_shaper = cm.NeuralNetworkShaper(rn50_spec)

Excerpts from MacOS "Problem Report for Python"


Process:               python3.6 [3112]
Path:                  /Users/USER/*/python
Identifier:            python3.6
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        python3.6 [2520]
Responsible:           python3.6 [3112]
User ID:               501

Date/Time:             2019-07-20 17:08:35.308 -0400
OS Version:            Mac OS X 10.14.5 (18F132)
Report Version:        12
Anonymous UUID:        DE8FAC1E-8FB2-7200-CE0B-B9CDBAC486EE

Time Awake Since Boot: 26000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
python(3112,0x1199e65c0) malloc: *** error for object 0x11374a008: pointer being freed was not allocated

(... long list of thread dumps and binary images ... )

VM Region Summary:
ReadOnly portion of Libraries: Total=475.1M resident=0K(0%) swapped_out_or_unallocated=475.1M(100%)
Writable regions: Total=951.7M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=951.7M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework               128K        1 
Activity Tracing                   256K        1 
CG backing stores                  560K        3 
CoreImage                            8K        2 
CoreUI image data                   52K        1 
CoreUI image file                  404K        5 
Dispatch continuations            8192K        1 
Kernel Alloc Once                    8K        1 
MALLOC                           869.9M      117 
MALLOC guard page                   32K        8 
MALLOC_LARGE (reserved)            256K        2         reserved VM address space (unallocated)
Memory Tag 242                      12K        1 
STACK GUARD                         52K       13 
Stack                             39.7M       13 
VM_ALLOCATE                         96K       14 
VM_ALLOCATE (reserved)            32.0M        1         reserved VM address space (unallocated)
__DATA                            27.3M      335 
__DATA_CONST                        68K        1 
__FONT_DATA                          4K        1 
__LINKEDIT                       235.0M       91 
__TEXT                           240.1M      328 
__UNICODE                          564K        1 
mapped file                      152.8M       17 
shared memory                     3244K       13 
===========                     =======  ======= 
TOTAL                              1.6G      971 
TOTAL, minus reserved VM space     1.5G      971 

Model: MacBookPro9,2, BootROM 226.0.0.0.0, 2 processors, Intel Core i7, 2.9 GHz, 16 GB, SMC 2.2f44
Graphics: kHW_IntelHD4000Item, Intel HD Graphics 4000, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x0000, -
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x0000, -
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xF5), Broadcom BCM43xx 1.0 (7.21.190.33 AirPortDriverBrcm4360-1325.2)
Bluetooth: Version 6.0.12f1, 3 services, 18 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Serial ATA Device: Mercury Electra 6G SSD, 1 TB
Serial ATA Device: OPTIARC DVD RW AD-5970H
USB Device: USB 2.0 Bus
USB Device: Hub
USB Device: FaceTime HD Camera (Built-in)
USB Device: USB 2.0 Bus
USB Device: Hub
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: IR Receiver
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Hub
USB Device: Logitech USB Optical Mouse
USB Device: Keyboard Hub
USB Device: Apple Keyboard
USB Device: USB 3.0 Bus
Thunderbolt Bus: MacBook Pro, Apple Inc., 25.1
ghostsun89 commented 5 years ago

I got the same error on MacOS 10.15 with Python 2.7.14 and coremltools 3.03b.

TobyRoseman commented 3 years ago

The NeuralNetworkShaper has been removed from coremltools.