“错误:MLIR Pass Manager 失败”:MacBook Pro M1 Max 上的 TensorFlow

kpm*_*ott 5 python keras tensorflow apple-silicon apple-m1

我在配备 M1 Max 芯片的 MacBook Pro 上通过 MiniForge 管理的虚拟环境中运行 Python 3.9.7 和 TensorFlow 2.5。(由Jeff Heaton设置)。

\n

我的模型中有一个自定义损失函数。这段代码在我的另一台机器(基于 Ubuntu 的 Pop!OS)上运行良好。

\n

当我从 Keras 运行 model.fit 时,偶尔会出现以下错误。有时它运行得很好。知道是什么原因造成的,为什么它只是有时发生,以及如何解决它?

\n

此外,它仅从我的自定义损失函数中产生此错误。不是来自任何 Keras 本地人。

\n

谢谢!

\n
:5:10: error: invalid length (0) for size 20                                                                                                                             | 0.00/1.00 [00:00<?, ?batch/s]\n-:5:10: error: \'mps.slice\' op failed to fold or infer return types\n-:5:10: note: see current operation: %2 = "mps.slice"(%arg0) {axis = 0 : si32, length = 999 : i32, start = 1 : i32} : (tensor<20xf32>) -> tensor<*xf32>\n/System/Volumes/Data/SWE/macOS/BuildRoots/5b2e67f8af/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/MetalPerformanceShadersGraph-2.2.1/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphExecutable.mm:1179: failed assertion `Error: MLIR pass manager failed\'\nmodel.fit(tf.convert_to_tensor(\xce\xa3),tf.zeros((T,output)),batch_size=T,epochs=1,verbose=0,callbacks=[TqdmCallback()])#,tbc])\nzsh: abort      python3\n(tensorflow) kpmott@kevins-mbp-7 tf.olg % model.fit(tf.convert_to_tensor(\xce\xa3),tf.zeros((T,output)),batch_size=T,epochs=1,verbose=0,callbacks=[TqdmCallback()])#,tbc])\nzsh: parse error near `)\'\n(tensorflow) kpmott@kevins-mbp-7 tf.olg % /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown\n  warnings.warn(\'resource_tracker: There appear to be %d \'\nmodel.fit(tf.convert_to_tensor(\xce\xa3),tf.zeros((T,output)),batch_size=T,epochs=1,verbose=0,callbacks=[TqdmCallback()])#,tbc])\nzsh: parse error near `)\'\n
Run Code Online (Sandbox Code Playgroud)\n