libc++abi: terminating with uncaught exception of type NSException

creating model "model3"
Metal device set to: Apple M1

systemMemory: 16.00 GB
maxCacheSize: 5.33 GB

Episode 1 of 1
2021-10-14 17:46:13.626 python[10722:54381] -[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:maximumVelocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x16acdc810
2021-10-14 17:46:13.640 python[10722:54381] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:maximumVelocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x16acdc810'
*** First throw call stack:
(
        0   CoreFoundation                      0x0000000182887838 __exceptionPreprocess + 240
        1   libobjc.A.dylib                     0x00000001825b10a8 objc_exception_throw + 60
        2   CoreFoundation                      0x0000000182918694 -[NSObject(NSObject) __retain_OA] + 0
        3   CoreFoundation                      0x00000001827e8cd4 ___forwarding___ + 1444
        4   CoreFoundation                      0x00000001827e8670 _CF_forwarding_prep_0 + 96
        5   libmetal_plugin.dylib               0x000000015630a290 _ZN12metal_plugin14MPSApplyAdamOpIfEC2EPNS_20OpKernelConstructionE + 656
        6   libmetal_plugin.dylib               0x0000000156309ebc _ZN12metal_pluginL14CreateOpKernelINS_14MPSApplyAdamOpIfEEEEPvP23TF_OpKernelConstruction + 52
        7   libtensorflow_framework.2.dylib     0x000000012a00c5d4 _ZN10tensorflow12_GLOBAL__N_120KernelBuilderFactory6CreateEPNS_20OpKernelConstructionE + 88
        8   libtensorflow_framework.2.dylib     0x000000012a08e158 _ZN10tensorflow14CreateOpKernelENS_10DeviceTypeEPNS_10DeviceBaseEPNS_9AllocatorEPNS_22FunctionLibraryRuntimeEPNS_11ResourceMgrERKNSt3__110shared_ptrIKNS_14NodePropertiesEEEiPPNS_8OpKernelE + 784
        9   libtensorflow_framework.2.dylib     0x000000012a2692b8 _ZN10tensorflow21CreateNonCachedKernelEPNS_6DeviceEPNS_22FunctionLibraryRuntimeERKNSt3__110shared_ptrIKNS_14NodePropertiesEEEiPPNS_8OpKernelE + 272
        10  libtensorflow_framework.2.dylib     0x000000012a213c20 _ZN10tensorflow26FunctionLibraryRuntimeImpl12CreateKernelERKNSt3__110shared_ptrIKNS_14NodePropertiesEEEPNS_22FunctionLibraryRuntimeEPPNS_8OpKernelE + 600
        11  libtensorflow_framework.2.dylib     0x000000012a27e430 _ZN10tensorflow22ImmutableExecutorState10InitializeERKNS_5GraphE + 1192
        12  libtensorflow_framework.2.dylib     0x000000012a269064 _ZN10tensorflow16NewLocalExecutorERKNS_19LocalExecutorParamsERKNS_5GraphEPPNS_8ExecutorE + 304
        13  libtensorflow_framework.2.dylib     0x000000012a276e6c _ZN10tensorflow12_GLOBAL__N_124DefaultExecutorRegistrar7Factory11NewExecutorERKNS_19LocalExecutorParamsERKNS_5GraphEPNSt3__110unique_ptrINS_8ExecutorENS9_14default_deleteISB_EEEE + 48
        14  libtensorflow_framework.2.dylib     0x000000012a2777e8 _ZN10tensorflow11NewExecutorERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_19LocalExecutorParamsERKNS_5GraphEPNS0_10unique_ptrINS_8ExecutorENS0_14default_deleteISG_EEEE + 92
        15  libtensorflow_framework.2.dylib     0x000000012a216278 _ZN10tensorflow26FunctionLibraryRuntimeImpl10CreateItemEPPNS0_4ItemE + 2676
        16  libtensorflow_framework.2.dylib     0x000000012a21706c _ZN10tensorflow26FunctionLibraryRuntimeImpl3RunERKNS_22FunctionLibraryRuntime7OptionsEyN4absl12lts_202103244SpanIKNS_6TensorEEEPNSt3__16vectorIS8_NSB_9allocatorIS8_EEEENSB_8functionIFvRKNS_6StatusEEEE + 676
        17  libtensorflow_framework.2.dylib     0x000000012a2250c0 _ZNK10tensorflow29ProcessFunctionLibraryRuntime14RunMultiDeviceERKNS_22FunctionLibraryRuntime7OptionsEyPNSt3__16vectorIN4absl12lts_202103247variantIJNS_6TensorENS_11TensorShapeEEEENS5_9allocatorISC_EEEEPNS6_INS5_10unique_ptrINS0_11CleanUpItemENS5_14default_deleteISI_EEEENSD_ISL_EEEENS5_8functionIFvRKNS_6StatusEEEENSP_IFSQ_RKNS0_21ComponentFunctionDataEPNS0_12InternalArgsEEEE + 2640
        18  libtensorflow_framework.2.dylib     0x000000012a228098 _ZNK10tensorflow29ProcessFunctionLibraryRuntime3RunERKNS_22FunctionLibraryRuntime7OptionsEyN4absl12lts_202103244SpanIKNS_6TensorEEEPNSt3__16vectorIS8_NSB_9allocatorIS8_EEEENSB_8functionIFvRKNS_6StatusEEEE + 2012
        19  libtensorflow_framework.2.dylib     0x000000012a228868 _ZNK10tensorflow29ProcessFunctionLibraryRuntime7RunSyncERKNS_22FunctionLibraryRuntime7OptionsEyN4absl12lts_202103244SpanIKNS_6TensorEEEPNSt3__16vectorIS8_NSB_9allocatorIS8_EEEE + 160
        20  _pywrap_tensorflow_internal.so      0x000000013c175554 _ZN10tensorflow19KernelAndDeviceFunc3RunEPNS_19ScopedStepContainerERKNS_15EagerKernelArgsEPNSt3__16vectorIN4absl12lts_202103247variantIJNS_6TensorENS_11TensorShapeEEEENS6_9allocatorISD_EEEEPNS_19CancellationManagerERKNS9_8optionalINS_25EagerRemoteFunctionParamsEEERKNSK_INS_17ManagedStackTraceEEE + 516
        21  _pywrap_tensorflow_internal.so      0x000000013c13fd60 _ZN10tensorflow18EagerKernelExecuteEPNS_12EagerContextERKN4absl12lts_2021032413InlinedVectorIPNS_12TensorHandleELm4ENSt3__19allocatorIS6_EEEERKNS3_8optionalINS_25EagerRemoteFunctionParamsEEERKNS7_10unique_ptrINS_15KernelAndDeviceENS_4core15RefCountDeleterEEEPNS_14GraphCollectorEPNS_19CancellationManagerENS3_4SpanIS6_EERKNSD_INS_17ManagedStackTraceEEE + 372
       ...
       ...
        80  python                              0x00000001021f5ddc main + 56
        81  libdyld.dylib                       0x0000000182729430 start + 4
)
libc++abi: terminating with uncaught exception of type NSException

I have built a deep Q network using python. It can work on Windows, but I cannot run it on MacBook with M1. I had already checked the issue about matplotlib, it is not the case.

Hope to get a response ASAP, thanks in advance.

This is probably a bug in tensorflow-metal 0.2.0. The same error occurred in the environment where tensorflow-metal 0.2.0 was installed.

If you install tensorflow-metal 0.1.2 as shown below, the error will no longer occur.

pip install tensorflow-metal==0.1.2

We are unable to get this issue reproduced. Please try updating to the latest version of the OS and let us know if this issue still persists, and provide a short script we can use to reproduce the issue.

libc++abi: terminating with uncaught exception of type NSException
 
 
Q