ML Compute

RSS for tag

Accelerate training and validation of neural networks using the CPU and GPUs.

Posts under ML Compute tag

156 Posts

Post

Replies

Boosts

Views

Activity

Error when trying to use Tensorflow mixed-precision on M1 Pro
I tried training my model on my M1 Pro using Tensorflow's mixed-precision, hoping it will boost the performance, but I got an error: .../mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:289:0: error: 'mps.select' op failed to verify that all of {true_value, false_value, result} have same element type .../mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:289:0: note: see current operation: %5 = "mps.select"(%4, %3, %2) : (tensor<1xi1>, tensor<1xf16>, tensor<1xf32>) -> tensor<1xf16>
1
0
2.3k
Oct ’22
Mac Studio Machine Learning script failing to use the GPU
I'm using tensorflow in python and I'm exploring the hyper parameters of a machine learning models for my dataset. My workflow involves two python scripts. Script 1 iterates through a suite of ML hyper parameters calling a second python script that fits resulting ML model to the data. Script 2 is command line implementation of the ML model setup and fitting to the data. On my Macbook pro (M1 chip) everything works fine. On my new Mac Studio, script 2 hangs after a number of calls because it fails to run on the GPU. I cannot avoid this behaviour. If I kill the hung job the first script continues to call script 2 until it hangs again after another 10ish calls of script 2. What going on? Problem with the GPU of Mac studio? Any suggestion to test would be appreciated. R
0
0
1.4k
Sep ’22
M1 Pro After installing TF based on Official apple guide gives ERROR for even importing TF
SYSTEM: MacBook Pro 14 (M1 Apple Silicon) MacOS 12.0.1 DONE: https://developer.apple.com/metal/tensorflow-plugin/ I have followed this for ARM M1 apple silicon for my 14" (I had anaconda installed before, that may causing the error but I DO NOT want to delete my anaconda all together) CODE import tensorflow as tf ERROR --------------------------------------------------------------------------- ImportError Traceback (most recent call last) ~/miniforge3/lib/python3.9/site-packages/numpy/core/__init__.py in <module> 21 try: ---> 22 from . import multiarray 23 except ImportError as exc: ~/miniforge3/lib/python3.9/site-packages/numpy/core/multiarray.py in <module> 11 ---> 12 from . import overrides 13 from . import _multiarray_umath ~/miniforge3/lib/python3.9/site-packages/numpy/core/overrides.py in <module> 6 ----> 7 from numpy.core._multiarray_umath import ( 8 add_docstring, implement_array_function, _get_implementing_args) ImportError: dlopen(/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib Referenced from: /Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so Reason: tried: '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file) During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) /var/folders/yp/mq9ddgh54gjg2rp7mw_t015c0000gn/T/ipykernel_95218/3793406994.py in <module> ----> 1 import tensorflow as tf ~/miniforge3/lib/python3.9/site-packages/tensorflow/__init__.py in <module> 39 import sys as _sys 40 ---> 41 from tensorflow.python.tools import module_util as _module_util 42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader 43 ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/__init__.py in <module> 39 40 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow ---> 41 from tensorflow.python.eager import context 42 43 # pylint: enable=wildcard-import ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/context.py in <module> 28 29 from absl import logging ---> 30 import numpy as np 31 import six 32 ~/miniforge3/lib/python3.9/site-packages/numpy/__init__.py in <module> 138 from . import _distributor_init 139 --> 140 from . import core 141 from .core import * 142 from . import compat ~/miniforge3/lib/python3.9/site-packages/numpy/core/__init__.py in <module> 46 """ % (sys.version_info[0], sys.version_info[1], sys.executable, 47 __version__, exc) ---> 48 raise ImportError(msg) 49 finally: 50 for envkey in env_added: ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "/Users/ps/miniforge3/bin/python" * The NumPy version is: "1.19.5" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: dlopen(/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib Referenced from: /Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so Reason: tried: '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)
4
0
4.7k
Sep ’22
Random hangs on M1 in Apple Accelerate when performing sparse Cholesky factorization
Hello, I'm trying to use Accelerate's sparse Cholesky solver but met an issue on M1. Is anyone aware of this issue or similar ones? The sparse factorization class _SparseNumericFactorSymmetric in Apple Accelerate will hang randomly for some large symmetric positive definite matrices with a specific sparsity pattern when created for Cholesky factorization. This issue happens in probability about 1/1000. It can be reproduced through following steps Read and load the attached sparse matrix (in MatrixMarket format). In a for-loop, repeatedly factorize the same matrix through _SparseNumericFactorSymmetric for 1000~2000 times. Matrix: https://www.dropbox.com/s/2pyl0cpmgy1qdrh/mat.mtx.zip?dl=0 The following code calls Apple Accelerate through a wrapper from Eigen 3.4.9 (https://eigen.tuxfamily.org/dox/group__AccelerateSupport__Module.html): #include <unsupported/Eigen/SparseExtra> #include <Eigen/AccelerateSupport> #include <iostream> int main() { Eigen::SparseMatrix<double> A; Eigen::loadMarket(A, "mat.mtx"); for (int i = 0; i < 2000; ++i) { Eigen::AccelerateLLT<Eigen::SparseMatrix<double>> solver; solver.compute(A); std::cout << i << std::endl; } return 0; } The factorizations should perform smoothly for the times specified in the for-loop. But the app will hang and stop being responsive infinitely after performing the factorization for hundreds of times (sometimes ~500+ loops, or sometimes ~900+ loops). I'm using a Xcode Version 13.1 (13A1030d) on MacOS Monterey 12.5.1 (21G83), with Apple M1 Max. It seems this issue is related to multithreading in VecLib since it only happens when we leave the environment variable unset (i.e., VECLIB_MAXIMUM_THREADS > 1). Setting VECLIB_MAXIMUM_THREADS = 1 will eliminate the issue at the cost of losing performance. And this issue only happens on M1 Macs, not on Intel-based ones.
0
0
1.3k
Aug ’22
Loading time of a CoreML model on iPhone varies in function of the computeUnits
We use several CoreML models on our swift application. Memory footprint of these coreML models varies in a range from 15 kB to 3.5 MB according to the XCode coreML utility tool. We observe a huge difference of loading time in function of the type of the compute units selected to run the model. Here is a small sample code used to load the model: let configuration = MLModelConfiguration() //Here I use the the .all compute units mode: configuration.computeUnits = .all let myModel = try! myCoremlModel(configuration: configuration).model Here are the profiling results of this sample code for different models sizes in function of the targeted compute units: Model-3.5-MB : computeUnits is .cpuAndGPU: 188 ms ⇒ 18 MB/s computeUnits is .all or .cpuAndNeuralEngine on iOS16: 4000 ms ⇒ 875 kB/s Model-2.6-MB: computeUnits is .cpuAndGPU: 144 ms ⇒ 18 MB/s computeUnits is .all or .cpuAndNeuralEngine on iOS16: 1300 ms ⇒ 2 MB/s Model-15-kB: computeUnits is .cpuAndGPU: 18 ms ⇒ 833 kB/s computeUnits is .all or .cpuAndNeuralEngine on iOS16: 700 ms ⇒ 22 kB/s What explained the difference of loading time in function en the computeUnits mode ? Is there a way to reduce the loading time of the models when using the .all or .cpuAndNeuralEngine computeUnits mode ?
1
2
2.1k
Aug ’22
Dynamic input size strongly impact neural engine performances
We use dynamic input size for some uses cases. When compute unit mode is .all there is strong difference in the execution time if the dynamic input shape doesn’t fit with the optimal shape. If we set the model optimal input shape as 896x896 but run it with an input shape of 1024x768 the execution time is almost twice as slower compared to an input size of 896x896. For example a model set with 896x896 preferred input shape can achieve inference at 66 ms when input shape is 896x896. However this model only achieve inference at 117 ms when input shape is 1024x768. In that case if we want to achieve best performances at inference time we need to switch from a model to another in function of the input shape which is not dynamic at all and memory greedy. There is a way to reduce the execution time when shape out of the preferred shape range?
1
1
1.2k
Aug ’22
Multiprocessing in Python on NPU
Hi, I am doing multiprocessing currently in python and need to upgrade my laptop. The scientific computing I am doing which usually takes awhile so I'd like to have as many cores as I can get. The question: How, if possible, might I use the NPU instead of (or in tandem with) the CPU for multiprocessing? In python it is fairly straight forward with the concurrent futures package, https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor .
0
0
1.4k
Aug ’22
tensorflow-metal freezing nondeterministically during model training
I am training a model using tensorflow-metal and model training (and the whole application) freezes up. The behavior is nondeterministic. I believe the problem is with Metal (1) because of the contents of the backtraces below, and (2) because when I run the same code on a machine with non-Metal TensorFlow (using a GPU), everything works fine. I can't share my code publicly, but I would be willing to share it with an Apple engineer privately over email if that would help. It's hard to create a minimum reproduction example since my program is somewhat complex and the bug is nondeterministic. The bug does appear pretty reliably. It looks like the problem might be in some Metal Performance Shaders init code. The state of everything (backtraces, etc.) when the program freezes is attached. Backtraces
5
1
2.9k
Aug ’22
Tensorflow metal: The Metal Performance Shaders operations encoded on it may not have completed.
This does not seem to be effecting the training, but it seems somewhat important (no clue on how to read it however): Error: command buffer exited with error status. The Metal Performance Shaders operations encoded on it may not have completed. Error: (null) Internal Error (0000000e:Internal Error) <AGXG13XFamilyCommandBuffer: 0x29b027b50> label = <none> device = <AGXG13XDevice: 0x12da25600> name = Apple M1 Max commandQueue = <AGXG13XFamilyCommandQueue: 0x106477000> label = <none> device = <AGXG13XDevice: 0x12da25600> name = Apple M1 Max retainedReferences = 1 This is happening during a "heavy" model training on "heavy" dataset, so maybe is related to some memory issue, but I have no clue how to confront it
6
0
3.1k
Aug ’22
Content for neural network training
Can someone tell me if using copyrighted content for neural network training is infringement or a fair use? For example: Someone took 100000 superhero pictures from Google for training. After this neural network can create superhero pictures with the query of user. Is it an infringement or a fair use? Can developer sell these created pictures to users (or a subscription to service)? Or everyone uses only public domain and open source content for training?
1
0
1.1k
Jul ’22
TensorFlow with Metal start giving wrong results after upgrading macOS from 12.0.1 to 12.1
After installing tensorflow-metal PluggableDevice according to Getting Started with tensorflow-metal PluggableDevice I have tested this DCGAN example: https://www.tensorflow.org/tutorials/generative/dcgan. Everything was working perfectly until I decided tu upgrade macOS from 12.0.1 to 12.1. Before the final result after 50 epoch was like on picture1 below , after upgrade is like on picture2 below . I am using: TensrofFlow 2.7.0 tensorflow-metal-0.3.0 python3.9 I hope this question will also help Apple to improve Metal PluggableDevice. I can't wait to use it in my research.
7
0
3.1k
Jun ’22
tf.signal.stft Problem on M1 tf.__version__:2.9.1
Hello everyone I found some problem in tf built-in function (tf.signal.stft) when I type the code below, it will cause problem. Device is MacBookPro with M1 Pro chip in jupyterlab However, the problem won't cause on linux with CUDA. Does anyone know how to fix the problem ? Thanks. code: import numpy as np import tensorflow as tf random_waveform = np.random.normal(size=(16000)) tf_waveform = tf.constant(random_waveform) tf_stft_waveform = tf.signal.stft(tf_waveform, frame_length=255, frame_step=128) error message: InvalidArgumentError Traceback (most recent call last) Input In [1], in <cell line: 6>() 4 random_waveform = np.random.normal(size=(16000)) 5 tf_waveform = tf.constant(random_waveform) ----> 6 tf_stft_waveform = tf.signal.stft(tf_waveform, frame_length=255, frame_step=128) File ~/miniconda3/envs/AI/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback.<locals>.error_handler(*args, **kwargs) 151 except Exception as e: 152 filtered_tb = _process_traceback_frames(e.__traceback__) --> 153 raise e.with_traceback(filtered_tb) from None 154 finally: 155 del filtered_tb File ~/miniconda3/envs/AI/lib/python3.9/site-packages/tensorflow/python/framework/ops.py:7164, in raise_from_not_ok_status(e, name) 7162 def raise_from_not_ok_status(e, name): 7163 e.message += (" name: " + name if name is not None else "") -> 7164 raise core._status_to_exception(e) from None InvalidArgumentError: Multiple Default OpKernel registrations match NodeDef '{{node ZerosLike}}': 'op: "ZerosLike" device_type: "DEFAULT" constraint { name: "T" allowed_values { list { type: DT_INT32 } } } host_memory_arg: "y"' and 'op: "ZerosLike" device_type: "DEFAULT" constraint { name: "T" allowed_values { list { type: DT_INT32 } } } host_memory_arg: "y"' [Op:ZerosLike] 1
2
0
1.6k
Jun ’22
Illegal instruction: 4
Trying to run python file in vs code but getting error mentioned in the title , I am basically trying to train deep learning model by importing libraries like tensorflow , numpy , pandas , matplotlib etc , I am only getting error Illegal instruction: 4 nothing else and one more thing same code is working fine in windows , plz help
0
1
1.2k
May ’22
Tensorflow M1 Max Metal 0.4 convergence problems
We are developing a simple GAN an when training the solution, the behavior of the convergence of the discriminator is different if we use GPU than using only CPU or even executing in Collab. We've read a lot, but this is the only one post that seems to talk about similar behavior. Unfortunately, after updating to 0.4 version problem persists. My Hardware/Software: MacBook Pro. model: MacBookPro18,2. Chip: Apple M1 Max. Cores: 10 (8 de rendimiento y 2 de eficiencia). Memory: 64 GB. firmware: 7459.101.3. OS: Monterey 12.3.1. OS Version: 7459.101.3. Python version 3.8 and libraries (the most related) using !pip freeze keras==2.8.0 Keras-Preprocessing==1.1.2 .... tensorboard==2.8.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow-datasets==4.5.2 tensorflow-docs @ git+https://github.com/tensorflow/docs@7d5ea2e986a4eae7573be3face00b3cccd4b8b8b tensorflow-macos==2.8.0 tensorflow-metadata==1.7.0 tensorflow-metal==0.4.0 #####. CODE TO REPRODUCE. ####### Code does not fit in the max space in this message... I've shared a Google Collab Notebook at: https://colab.research.google.com/drive/1oDS8EV0eP6kToUYJuxHf5WCZlRL0Ypgn?usp=sharing You can easily see that loss goes to 0 after 1 or 2 epochs when GPU is enabled, buy if GPU is disabled everything is OK
0
0
976
May ’22
CoreML performance issue on M1Max about Neural Engine
I am using a CoreML model from https://github.com/PeterL1n/RobustVideoMatting. I have an M1Macbook13 16G and an M1Max Macbook 16 64G. When "computeUnits" using .all or default, M1Max 16 is much slower than M1 13, finish one prediction time is 0.202 and 0.155. Using .cpuOnly, M1Max 16 is fast a little, time is 0.129 and 0.146. Using .cpuAndGPU, M1Max 16 is much fast than M1 13, time is 0.057 and 0.086. And when I use .all or default, M1Max will appear error messages like this: H11ANEDevice::H11ANEDeviceOpen IOServiceOpen failed result= 0xe00002e2 H11ANEDevice::H11ANEDeviceOpen kH11ANEUserClientCommand_DeviceOpen call failed result=0xe00002bc Error opening LB - status=0xe00002bc.. Skipping LB and retrying But M1 13 doesn't have any errors. So I want to know is this a bug of CoreML or M1Max? My Codes is like this: let config = MLModelConfiguration() config.computeUnits = .all let model = try rvm_mobilenetv3_1920x1080_s0_25_int8_ANE(configuration: config) let image1 = NSImage(named: "test1")?.cgImage(forProposedRect: nil, context: nil, hints: nil) let input = try? rvm_mobilenetv3_1920x1080_s0_25_int8_ANEInput(srcWith:image1!, r1i: MLMultiArray(), r2i: MLMultiArray(), r3i: MLMultiArray(), r4i: MLMultiArray())  _ = try? model.prediction(input: input!)
4
0
2.7k
Mar ’22
Using CreateML in Playgrounds
I need to build a model to add to my app and tried following the Apple docs here. No luck because I get an error that is discussed on this thread on the forum. I'm still not clear on why the error is occurring and can't resolve it. I wonder if CreateML inside Playgrounds is still supported at all? I tried using the CreateML app that you can access through developer tools but it just crashes my Mac (2017 MBP - is it just too much of a brick to use for ML at this point? I should think not because I've recently built and trained relatively simple models using Tensorflow. + Python on this machine, and the classifier I'm trying to make now is really simple and doesn't have a huge dataset).
1
0
1.5k
Feb ’22
Error when trying to use Tensorflow mixed-precision on M1 Pro
I tried training my model on my M1 Pro using Tensorflow's mixed-precision, hoping it will boost the performance, but I got an error: .../mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:289:0: error: 'mps.select' op failed to verify that all of {true_value, false_value, result} have same element type .../mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:289:0: note: see current operation: %5 = "mps.select"(%4, %3, %2) : (tensor<1xi1>, tensor<1xf16>, tensor<1xf32>) -> tensor<1xf16>
Replies
1
Boosts
0
Views
2.3k
Activity
Oct ’22
MLMultiArray how to write to text txt as string fast
MLMultiArray how to write to text txt as String fast
Replies
0
Boosts
0
Views
1.5k
Activity
Oct ’22
Xcode Coreml
The data format of MLMultiArray content is float32. How to convert the data format of content to int
Replies
0
Boosts
0
Views
1.1k
Activity
Oct ’22
Mac Studio Machine Learning script failing to use the GPU
I'm using tensorflow in python and I'm exploring the hyper parameters of a machine learning models for my dataset. My workflow involves two python scripts. Script 1 iterates through a suite of ML hyper parameters calling a second python script that fits resulting ML model to the data. Script 2 is command line implementation of the ML model setup and fitting to the data. On my Macbook pro (M1 chip) everything works fine. On my new Mac Studio, script 2 hangs after a number of calls because it fails to run on the GPU. I cannot avoid this behaviour. If I kill the hung job the first script continues to call script 2 until it hangs again after another 10ish calls of script 2. What going on? Problem with the GPU of Mac studio? Any suggestion to test would be appreciated. R
Replies
0
Boosts
0
Views
1.4k
Activity
Sep ’22
M1 Pro After installing TF based on Official apple guide gives ERROR for even importing TF
SYSTEM: MacBook Pro 14 (M1 Apple Silicon) MacOS 12.0.1 DONE: https://developer.apple.com/metal/tensorflow-plugin/ I have followed this for ARM M1 apple silicon for my 14" (I had anaconda installed before, that may causing the error but I DO NOT want to delete my anaconda all together) CODE import tensorflow as tf ERROR --------------------------------------------------------------------------- ImportError Traceback (most recent call last) ~/miniforge3/lib/python3.9/site-packages/numpy/core/__init__.py in <module> 21 try: ---> 22 from . import multiarray 23 except ImportError as exc: ~/miniforge3/lib/python3.9/site-packages/numpy/core/multiarray.py in <module> 11 ---> 12 from . import overrides 13 from . import _multiarray_umath ~/miniforge3/lib/python3.9/site-packages/numpy/core/overrides.py in <module> 6 ----> 7 from numpy.core._multiarray_umath import ( 8 add_docstring, implement_array_function, _get_implementing_args) ImportError: dlopen(/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib Referenced from: /Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so Reason: tried: '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file) During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) /var/folders/yp/mq9ddgh54gjg2rp7mw_t015c0000gn/T/ipykernel_95218/3793406994.py in <module> ----> 1 import tensorflow as tf ~/miniforge3/lib/python3.9/site-packages/tensorflow/__init__.py in <module> 39 import sys as _sys 40 ---> 41 from tensorflow.python.tools import module_util as _module_util 42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader 43 ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/__init__.py in <module> 39 40 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow ---> 41 from tensorflow.python.eager import context 42 43 # pylint: enable=wildcard-import ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/context.py in <module> 28 29 from absl import logging ---> 30 import numpy as np 31 import six 32 ~/miniforge3/lib/python3.9/site-packages/numpy/__init__.py in <module> 138 from . import _distributor_init 139 --> 140 from . import core 141 from .core import * 142 from . import compat ~/miniforge3/lib/python3.9/site-packages/numpy/core/__init__.py in <module> 46 """ % (sys.version_info[0], sys.version_info[1], sys.executable, 47 __version__, exc) ---> 48 raise ImportError(msg) 49 finally: 50 for envkey in env_added: ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "/Users/ps/miniforge3/bin/python" * The NumPy version is: "1.19.5" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: dlopen(/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libcblas.3.dylib Referenced from: /Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so Reason: tried: '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/python3.9/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/lib/libcblas.3.dylib' (no such file), '/Users/ps/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)
Replies
4
Boosts
0
Views
4.7k
Activity
Sep ’22
Random hangs on M1 in Apple Accelerate when performing sparse Cholesky factorization
Hello, I'm trying to use Accelerate's sparse Cholesky solver but met an issue on M1. Is anyone aware of this issue or similar ones? The sparse factorization class _SparseNumericFactorSymmetric in Apple Accelerate will hang randomly for some large symmetric positive definite matrices with a specific sparsity pattern when created for Cholesky factorization. This issue happens in probability about 1/1000. It can be reproduced through following steps Read and load the attached sparse matrix (in MatrixMarket format). In a for-loop, repeatedly factorize the same matrix through _SparseNumericFactorSymmetric for 1000~2000 times. Matrix: https://www.dropbox.com/s/2pyl0cpmgy1qdrh/mat.mtx.zip?dl=0 The following code calls Apple Accelerate through a wrapper from Eigen 3.4.9 (https://eigen.tuxfamily.org/dox/group__AccelerateSupport__Module.html): #include <unsupported/Eigen/SparseExtra> #include <Eigen/AccelerateSupport> #include <iostream> int main() { Eigen::SparseMatrix<double> A; Eigen::loadMarket(A, "mat.mtx"); for (int i = 0; i < 2000; ++i) { Eigen::AccelerateLLT<Eigen::SparseMatrix<double>> solver; solver.compute(A); std::cout << i << std::endl; } return 0; } The factorizations should perform smoothly for the times specified in the for-loop. But the app will hang and stop being responsive infinitely after performing the factorization for hundreds of times (sometimes ~500+ loops, or sometimes ~900+ loops). I'm using a Xcode Version 13.1 (13A1030d) on MacOS Monterey 12.5.1 (21G83), with Apple M1 Max. It seems this issue is related to multithreading in VecLib since it only happens when we leave the environment variable unset (i.e., VECLIB_MAXIMUM_THREADS > 1). Setting VECLIB_MAXIMUM_THREADS = 1 will eliminate the issue at the cost of losing performance. And this issue only happens on M1 Macs, not on Intel-based ones.
Replies
0
Boosts
0
Views
1.3k
Activity
Aug ’22
Loading time of a CoreML model on iPhone varies in function of the computeUnits
We use several CoreML models on our swift application. Memory footprint of these coreML models varies in a range from 15 kB to 3.5 MB according to the XCode coreML utility tool. We observe a huge difference of loading time in function of the type of the compute units selected to run the model. Here is a small sample code used to load the model: let configuration = MLModelConfiguration() //Here I use the the .all compute units mode: configuration.computeUnits = .all let myModel = try! myCoremlModel(configuration: configuration).model Here are the profiling results of this sample code for different models sizes in function of the targeted compute units: Model-3.5-MB : computeUnits is .cpuAndGPU: 188 ms ⇒ 18 MB/s computeUnits is .all or .cpuAndNeuralEngine on iOS16: 4000 ms ⇒ 875 kB/s Model-2.6-MB: computeUnits is .cpuAndGPU: 144 ms ⇒ 18 MB/s computeUnits is .all or .cpuAndNeuralEngine on iOS16: 1300 ms ⇒ 2 MB/s Model-15-kB: computeUnits is .cpuAndGPU: 18 ms ⇒ 833 kB/s computeUnits is .all or .cpuAndNeuralEngine on iOS16: 700 ms ⇒ 22 kB/s What explained the difference of loading time in function en the computeUnits mode ? Is there a way to reduce the loading time of the models when using the .all or .cpuAndNeuralEngine computeUnits mode ?
Replies
1
Boosts
2
Views
2.1k
Activity
Aug ’22
Dynamic input size strongly impact neural engine performances
We use dynamic input size for some uses cases. When compute unit mode is .all there is strong difference in the execution time if the dynamic input shape doesn’t fit with the optimal shape. If we set the model optimal input shape as 896x896 but run it with an input shape of 1024x768 the execution time is almost twice as slower compared to an input size of 896x896. For example a model set with 896x896 preferred input shape can achieve inference at 66 ms when input shape is 896x896. However this model only achieve inference at 117 ms when input shape is 1024x768. In that case if we want to achieve best performances at inference time we need to switch from a model to another in function of the input shape which is not dynamic at all and memory greedy. There is a way to reduce the execution time when shape out of the preferred shape range?
Replies
1
Boosts
1
Views
1.2k
Activity
Aug ’22
Multiprocessing in Python on NPU
Hi, I am doing multiprocessing currently in python and need to upgrade my laptop. The scientific computing I am doing which usually takes awhile so I'd like to have as many cores as I can get. The question: How, if possible, might I use the NPU instead of (or in tandem with) the CPU for multiprocessing? In python it is fairly straight forward with the concurrent futures package, https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor .
Replies
0
Boosts
0
Views
1.4k
Activity
Aug ’22
tensorflow-metal freezing nondeterministically during model training
I am training a model using tensorflow-metal and model training (and the whole application) freezes up. The behavior is nondeterministic. I believe the problem is with Metal (1) because of the contents of the backtraces below, and (2) because when I run the same code on a machine with non-Metal TensorFlow (using a GPU), everything works fine. I can't share my code publicly, but I would be willing to share it with an Apple engineer privately over email if that would help. It's hard to create a minimum reproduction example since my program is somewhat complex and the bug is nondeterministic. The bug does appear pretty reliably. It looks like the problem might be in some Metal Performance Shaders init code. The state of everything (backtraces, etc.) when the program freezes is attached. Backtraces
Replies
5
Boosts
1
Views
2.9k
Activity
Aug ’22
Tensorflow metal: The Metal Performance Shaders operations encoded on it may not have completed.
This does not seem to be effecting the training, but it seems somewhat important (no clue on how to read it however): Error: command buffer exited with error status. The Metal Performance Shaders operations encoded on it may not have completed. Error: (null) Internal Error (0000000e:Internal Error) <AGXG13XFamilyCommandBuffer: 0x29b027b50> label = <none> device = <AGXG13XDevice: 0x12da25600> name = Apple M1 Max commandQueue = <AGXG13XFamilyCommandQueue: 0x106477000> label = <none> device = <AGXG13XDevice: 0x12da25600> name = Apple M1 Max retainedReferences = 1 This is happening during a "heavy" model training on "heavy" dataset, so maybe is related to some memory issue, but I have no clue how to confront it
Replies
6
Boosts
0
Views
3.1k
Activity
Aug ’22
Content for neural network training
Can someone tell me if using copyrighted content for neural network training is infringement or a fair use? For example: Someone took 100000 superhero pictures from Google for training. After this neural network can create superhero pictures with the query of user. Is it an infringement or a fair use? Can developer sell these created pictures to users (or a subscription to service)? Or everyone uses only public domain and open source content for training?
Replies
1
Boosts
0
Views
1.1k
Activity
Jul ’22
Documentation for MPS graph has no information
Documentation for MPS graph has no information about class and methods functionality. Its only enumerates everything it's got without any explanation what it is and how it works. Why so? https://developer.apple.com/documentation/metalperformanceshadersgraph Though, In MPSGraph header files there is some commentaries, so it's seems like a bug
Replies
0
Boosts
1
Views
1.1k
Activity
Jul ’22
TensorFlow with Metal start giving wrong results after upgrading macOS from 12.0.1 to 12.1
After installing tensorflow-metal PluggableDevice according to Getting Started with tensorflow-metal PluggableDevice I have tested this DCGAN example: https://www.tensorflow.org/tutorials/generative/dcgan. Everything was working perfectly until I decided tu upgrade macOS from 12.0.1 to 12.1. Before the final result after 50 epoch was like on picture1 below , after upgrade is like on picture2 below . I am using: TensrofFlow 2.7.0 tensorflow-metal-0.3.0 python3.9 I hope this question will also help Apple to improve Metal PluggableDevice. I can't wait to use it in my research.
Replies
7
Boosts
0
Views
3.1k
Activity
Jun ’22
tf.signal.stft Problem on M1 tf.__version__:2.9.1
Hello everyone I found some problem in tf built-in function (tf.signal.stft) when I type the code below, it will cause problem. Device is MacBookPro with M1 Pro chip in jupyterlab However, the problem won't cause on linux with CUDA. Does anyone know how to fix the problem ? Thanks. code: import numpy as np import tensorflow as tf random_waveform = np.random.normal(size=(16000)) tf_waveform = tf.constant(random_waveform) tf_stft_waveform = tf.signal.stft(tf_waveform, frame_length=255, frame_step=128) error message: InvalidArgumentError Traceback (most recent call last) Input In [1], in <cell line: 6>() 4 random_waveform = np.random.normal(size=(16000)) 5 tf_waveform = tf.constant(random_waveform) ----> 6 tf_stft_waveform = tf.signal.stft(tf_waveform, frame_length=255, frame_step=128) File ~/miniconda3/envs/AI/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback.<locals>.error_handler(*args, **kwargs) 151 except Exception as e: 152 filtered_tb = _process_traceback_frames(e.__traceback__) --> 153 raise e.with_traceback(filtered_tb) from None 154 finally: 155 del filtered_tb File ~/miniconda3/envs/AI/lib/python3.9/site-packages/tensorflow/python/framework/ops.py:7164, in raise_from_not_ok_status(e, name) 7162 def raise_from_not_ok_status(e, name): 7163 e.message += (" name: " + name if name is not None else "") -> 7164 raise core._status_to_exception(e) from None InvalidArgumentError: Multiple Default OpKernel registrations match NodeDef '{{node ZerosLike}}': 'op: "ZerosLike" device_type: "DEFAULT" constraint { name: "T" allowed_values { list { type: DT_INT32 } } } host_memory_arg: "y"' and 'op: "ZerosLike" device_type: "DEFAULT" constraint { name: "T" allowed_values { list { type: DT_INT32 } } } host_memory_arg: "y"' [Op:ZerosLike] 1
Replies
2
Boosts
0
Views
1.6k
Activity
Jun ’22
Illegal instruction: 4
Trying to run python file in vs code but getting error mentioned in the title , I am basically trying to train deep learning model by importing libraries like tensorflow , numpy , pandas , matplotlib etc , I am only getting error Illegal instruction: 4 nothing else and one more thing same code is working fine in windows , plz help
Replies
0
Boosts
1
Views
1.2k
Activity
May ’22
Tensorflow M1 Max Metal 0.4 convergence problems
We are developing a simple GAN an when training the solution, the behavior of the convergence of the discriminator is different if we use GPU than using only CPU or even executing in Collab. We've read a lot, but this is the only one post that seems to talk about similar behavior. Unfortunately, after updating to 0.4 version problem persists. My Hardware/Software: MacBook Pro. model: MacBookPro18,2. Chip: Apple M1 Max. Cores: 10 (8 de rendimiento y 2 de eficiencia). Memory: 64 GB. firmware: 7459.101.3. OS: Monterey 12.3.1. OS Version: 7459.101.3. Python version 3.8 and libraries (the most related) using !pip freeze keras==2.8.0 Keras-Preprocessing==1.1.2 .... tensorboard==2.8.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow-datasets==4.5.2 tensorflow-docs @ git+https://github.com/tensorflow/docs@7d5ea2e986a4eae7573be3face00b3cccd4b8b8b tensorflow-macos==2.8.0 tensorflow-metadata==1.7.0 tensorflow-metal==0.4.0 #####. CODE TO REPRODUCE. ####### Code does not fit in the max space in this message... I've shared a Google Collab Notebook at: https://colab.research.google.com/drive/1oDS8EV0eP6kToUYJuxHf5WCZlRL0Ypgn?usp=sharing You can easily see that loss goes to 0 after 1 or 2 epochs when GPU is enabled, buy if GPU is disabled everything is OK
Replies
0
Boosts
0
Views
976
Activity
May ’22
TensorFlow installed with PDM not detecting GPU with M1 Pro
I tried to install dependencies with PDM for a project and found the inconvenience that TensorFlow does not detect the GPU of the M1 Pro. When I create a virtual environment with poetry I do not have the same problem. Any hint on how to solve this inconvenience?
Replies
0
Boosts
0
Views
1.1k
Activity
May ’22
CoreML performance issue on M1Max about Neural Engine
I am using a CoreML model from https://github.com/PeterL1n/RobustVideoMatting. I have an M1Macbook13 16G and an M1Max Macbook 16 64G. When "computeUnits" using .all or default, M1Max 16 is much slower than M1 13, finish one prediction time is 0.202 and 0.155. Using .cpuOnly, M1Max 16 is fast a little, time is 0.129 and 0.146. Using .cpuAndGPU, M1Max 16 is much fast than M1 13, time is 0.057 and 0.086. And when I use .all or default, M1Max will appear error messages like this: H11ANEDevice::H11ANEDeviceOpen IOServiceOpen failed result= 0xe00002e2 H11ANEDevice::H11ANEDeviceOpen kH11ANEUserClientCommand_DeviceOpen call failed result=0xe00002bc Error opening LB - status=0xe00002bc.. Skipping LB and retrying But M1 13 doesn't have any errors. So I want to know is this a bug of CoreML or M1Max? My Codes is like this: let config = MLModelConfiguration() config.computeUnits = .all let model = try rvm_mobilenetv3_1920x1080_s0_25_int8_ANE(configuration: config) let image1 = NSImage(named: "test1")?.cgImage(forProposedRect: nil, context: nil, hints: nil) let input = try? rvm_mobilenetv3_1920x1080_s0_25_int8_ANEInput(srcWith:image1!, r1i: MLMultiArray(), r2i: MLMultiArray(), r3i: MLMultiArray(), r4i: MLMultiArray())  _ = try? model.prediction(input: input!)
Replies
4
Boosts
0
Views
2.7k
Activity
Mar ’22
Using CreateML in Playgrounds
I need to build a model to add to my app and tried following the Apple docs here. No luck because I get an error that is discussed on this thread on the forum. I'm still not clear on why the error is occurring and can't resolve it. I wonder if CreateML inside Playgrounds is still supported at all? I tried using the CreateML app that you can access through developer tools but it just crashes my Mac (2017 MBP - is it just too much of a brick to use for ML at this point? I should think not because I've recently built and trained relatively simple models using Tensorflow. + Python on this machine, and the classifier I'm trying to make now is really simple and doesn't have a huge dataset).
Replies
1
Boosts
0
Views
1.5k
Activity
Feb ’22