Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Same as #50 and #73: NSInvalidArgumentException #116

Open
ryohajika opened this issue Jan 4, 2021 · 4 comments
Open

Same as #50 and #73: NSInvalidArgumentException #116

ryohajika opened this issue Jan 4, 2021 · 4 comments

Comments

@ryohajika
Copy link

Hi there, thank you so much for this fork! This looks promising and want to try this out on my Mac (MacBook Pro 15, 2018, Radeon Pro 560X)

As similar as the issues currently open (#50 and #73), I also get an error due to an exception NSInvalidArgumentException.
Also I see the same issue mentioned in #71, however, it seems not linked to this.
I can't share you the code at this point, but I configured the TF like this:

####   macOS fine-tune   ####
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
print(tf.__version__)  # it says 2.4.0-rc0
from tensorflow.python.compiler.mlcompute import mlcompute
mlcompute.set_mlc_device(device_name = 'gpu')
#### macOS fine-tune end ####

please check the console log in below to investigate the issue. I hope it helps 🙏
Environment: MBP15, 2018, RadeonPro 560X, macOS11.1

2021-01-04 18:39:40.080443: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-01-04 18:39:48.128459: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:196] None of the MLIR optimization passes are enabled (registered 0 passes)
2021-01-04 18:39:50.838 python3[22471:85314] -[__NSArrayI setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x7fed90d75770
2021-01-04 18:39:50.859 python3[22471:85314] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x7fed90d75770'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff204f86af __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007fff202303c9 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2057ac85 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff2046007d ___forwarding___ + 1467
	4   CoreFoundation                      0x00007fff2045fa38 _CF_forwarding_prep_0 + 120
	5   _pywrap_tensorflow_internal.so      0x0000000131161bc9 _ZN10tensorflow9mlcompute7convertL16ConvertMLCLSTMOpERNS1_23OpConverterCommonParamsE + 1173
	6   _pywrap_tensorflow_internal.so      0x0000000131191ff8 _ZNSt3__110__function6__funcIPFN10tensorflow6StatusERNS2_9mlcompute7convert23OpConverterCommonParamsEENS_9allocatorIS9_EES8_EclES7_ + 18
	7   _pywrap_tensorflow_internal.so      0x0000000131191acb _ZN10tensorflow9mlcompute7convertL9ConvertOpERNS1_23OpConverterCommonParamsEPKNS_4NodeE + 190
	8   _pywrap_tensorflow_internal.so      0x000000013117f138 _ZN10tensorflow9mlcompute7convert20ConvertSubgraphNodesEPNS1_11TFGraphInfoEPNS_15OpKernelContextEPKNS_5GraphERKNSt3__16vectorIPNS_4NodeENS9_9allocatorISC_EEEERKNSA_INS9_12basic_stringIcNS9_11char_traitsIcEENSD_IcEEEENSD_ISM_EEEERKNSA_IiNSD_IiEEEEPNS1_24MLCSubgraphConvertResultEP14NSMutableArrayIP9MLCTensorEPSX_IP18MLCTensorParameterERNS9_13unordered_mapIPNS1_10TFOpOutputEiNS9_4hashIS18_EENS9_8equal_toIS18_EENSD_INS9_4pairIKS18_iEEEEEE + 4147
	9   _pywrap_tensorflow_internal.so      0x00000001311394a5 _ZN10tensorflow9mlcompute7convert26MLCGraphConversionPassImpl15ConvertSubgraphEPNS_15OpKernelContextEPNS1_11TFGraphInfoEPKNS_5GraphERKNSt3__16vectorINSA_12basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEENSF_ISH_EEEERKNSB_IiNSF_IiEEEEPNS1_24MLCSubgraphConvertResultE + 1963
	10  _pywrap_tensorflow_internal.so      0x000000013111b90d _ZN10tensorflow9mlcompute3ops13MLCSubgraphOp20ProcessMLCSubgraphOpEPNS_15OpKernelContextEPNS1_27MLCSubgraphExecutionContextE + 223
	11  _pywrap_tensorflow_internal.so      0x000000013111ec6a _ZN10tensorflow9mlcompute3ops13MLCSubgraphOp7ComputeEPNS_15OpKernelContextE + 1166
	12  libtensorflow_framework.2.dylib     0x0000000145d488ec _ZN10tensorflow12_GLOBAL__N_113ExecutorStateINS_15PropagatorStateEE7ProcessENS2_10TaggedNodeEx + 3852
	13  libtensorflow_framework.2.dylib     0x0000000145d49c74 _ZNSt3__110__function6__funcIZN10tensorflow12_GLOBAL__N_113ExecutorStateINS2_15PropagatorStateEE7RunTaskINS_6__bindIMS6_FvNS5_10TaggedNodeExEJPS6_RKS9_RxEEEEEvOT_EUlvE_NS_9allocatorISJ_EEFvvEEclEv + 66
	14  libtensorflow_framework.2.dylib     0x0000000145dca485 _ZN5Eigen15ThreadPoolTemplIN10tensorflow6thread16EigenEnvironmentEE10WorkerLoopEi + 605
	15  libtensorflow_framework.2.dylib     0x0000000145dca154 _ZZN10tensorflow6thread16EigenEnvironment12CreateThreadENSt3__18functionIFvvEEEENKUlvE_clEv + 66
	16  libtensorflow_framework.2.dylib     0x0000000145dbbb47 _ZN10tensorflow12_GLOBAL__N_17PThread8ThreadFnEPv + 97
	17  libsystem_pthread.dylib             0x00007fff20386950 _pthread_start + 224
	18  libsystem_pthread.dylib             0x00007fff2038247b thread_start + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
@anna-tikhonova
Copy link
Collaborator

Thank you very much for reporting this. This is a very generic crash. Is it possible for you to create a smaller reproducible test case that you could share?

@atomiccatfish
Copy link

I'm having the same problem with the most out-of-the-box configuration I believe to be possible for this installation. I'm using Python 3.8.7 on a 2020 MBP with an AMD Radeon Pro 5500M 8 GB and 2.4 GHz 8-Core Intel Core i9 running Mac OS X Big Sur.

@raulm28
Copy link

raulm28 commented Feb 18, 2021

I'm having the same issue on a M1 Mac, 16 Gb RAM, running MacOS Big Sur.
I see it getting to the fitting portion, but it crashes at that point.

2021-02-18 10:31:20.063847: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE4.2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-18 10:31:20.157593: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
Epoch 1/100
2021-02-18 10:31:20.455 Python[54098:626632] -[__NSArrayI setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x7ff9b8a88b40
2021-02-18 10:31:20.466 Python[54098:626632] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x7ff9b8a88b40'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20483083 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201bb17c objc_exception_throw + 48
2 CoreFoundation 0x00007fff205059a0 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff203eaa67 forwarding + 1467
4 CoreFoundation 0x00007fff203ea418 _CF_forwarding_prep_0 + 120
5 _pywrap_tensorflow_internal.so 0x000000012a02f712 _ZN10tensorflow9mlcompute7convertL16ConvertMLCLSTMOpERNS1_23OpConverterCommonParamsE + 1161
6 _pywrap_tensorflow_internal.so 0x000000012a05e862 ZNSt3__110__function6__funcIPFN10tensorflow6StatusERNS2_9mlcompute7convert23OpConverterCommonParamsEENS_9allocatorIS9_EES8_EclES7 + 18
7 _pywrap_tensorflow_internal.so 0x000000012a05e2f0 _ZN10tensorflow9mlcompute7convertL9ConvertOpERNS1_23OpConverterCommonParamsEPKNS_4NodeE + 181
8 _pywrap_tensorflow_internal.so 0x000000012a04bef4 _ZN10tensorflow9mlcompute7convert20ConvertSubgraphNodesEPNS1_11TFGraphInfoEPNS_15OpKernelContextEPKNS_5GraphERKNSt3__16vectorIPNS_4NodeENS9_9allocatorISC_EEEERKNSA_INS9_12basic_stringIcNS9_11char_traitsIcEENSD_IcEEEENSD_ISM_EEEERKNSA_IiNSD_IiEEEERKNSA_IbNSD_IbEEEEPNS1_24MLCSubgraphConvertResultEP14NSMutableArrayIP9MLCTensorEPS11_IP18MLCTensorParameterERNS9_13unordered_mapIPNS1_10TFOpOutputEiNS9_4hashIS1C_EENS9_8equal_toIS1C_EENSD_INS9_4pairIKS1C_iEEEEEE + 3903
9 _pywrap_tensorflow_internal.so 0x000000012a007207 _ZN10tensorflow9mlcompute7convert26MLCGraphConversionPassImpl15ConvertSubgraphEPNS_15OpKernelContextEPNS1_11TFGraphInfoEPKNS_5GraphERKNSt3__16vectorINSA_12basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEENSF_ISH_EEEERKNSB_IiNSF_IiEEEERKNSB_IbNSF_IbEEEEPNS1_24MLCSubgraphConvertResultE + 913
10 _pywrap_tensorflow_internal.so 0x0000000129fe91ce _ZN10tensorflow9mlcompute3ops13MLCSubgraphOp20ProcessMLCSubgraphOpEPNS_15OpKernelContextEPNS1_27MLCSubgraphExecutionContextE + 242
11 _pywrap_tensorflow_internal.so 0x0000000129fec63a _ZN10tensorflow9mlcompute3ops13MLCSubgraphOp7ComputeEPNS_15OpKernelContextE + 1208
12 libtensorflow_framework.2.dylib 0x00000001577fb21d _ZN10tensorflow12_GLOBAL__N_113ExecutorStateINS_21SimplePropagatorStateEE7ProcessENS2_10TaggedNodeEx + 3765
13 libtensorflow_framework.2.dylib 0x0000000157878f3b _ZN5Eigen15ThreadPoolTemplIN10tensorflow6thread16EigenEnvironmentEE10WorkerLoopEi + 605
14 libtensorflow_framework.2.dylib 0x0000000157878be2 _ZZN10tensorflow6thread16EigenEnvironment12CreateThreadENSt3__18functionIFvvEEEENKUlvE_clEv + 66
15 libtensorflow_framework.2.dylib 0x0000000157869eb1 _ZN10tensorflow12_GLOBAL__N_17PThread8ThreadFnEPv + 97
16 libsystem_pthread.dylib 0x00007fff20311950 _pthread_start + 224
17 libsystem_pthread.dylib 0x00007fff2030d47b thread_start + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException

@thinhhoang95
Copy link

Mine too. It would crash once it get to the training point. However it seems that only the LSTM layer is affected. If I remove the LSTM layer, the training goes fine. I also tried TensorFlow on Linux and no such error occurred.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants