I’ve been reading that both Tensorflow and Pytorch deep learning frameworks are now supported by Apple M1/M2 chips. This means that a deep learning acoustic species classifier should run an order of magnitude faster on these chips than on an Intel or AMD PC (without an Nvidea graphics card). Has anyone tried to use these Apple chips in acoustics yet and, if so, were you able to measure performance increase?

EDIT. Although this question may seem general, there are nuances applying deep learning models to acoustics. For example, there is a whole acoustic processing chain to convert a waveform to an image (usually) which can involve multiple signal processing techniques such as filter or FFT calculations which may or may not be optimised on different chips. In addition, the community often use frameworks such as Ketos or AnimalSpot for developing models which may perform differently depending on whether the developer has optomised for different types of processor. The question is therefore asked in a bioacoustics context and answers ideally will also be focussed on performance increases in bioacoustics applications.

  • 4
    $\begingroup$ I still can't get Tensorflow or Keras to load on my M1 Macbook after many attempts and head-banging-against-wall. Love that the error message I get literally says "illegal hardware"... Pytorch seems to load easier. Do you have links/code that have worked for you to load Tensorflow on M1 chips? $\endgroup$
    – Carly Batist
    Jul 19, 2022 at 19:49
  • 6
    $\begingroup$ Also, I'll be able to answer this in about 3 weeks as I will be doing just that (ML models for automatic species detection from PAM data) for the CV4Ecology summer school at CalTech. $\endgroup$
    – Carly Batist
    Jul 19, 2022 at 19:50
  • 4
    $\begingroup$ How about this. Seems like it takes a bit to get working but it should be possible to run a tensorflow model on the AI portion of the chip. developer.apple.com/metal/tensorflow-plugin $\endgroup$
    – user213
    Jul 19, 2022 at 19:56
  • 3
    $\begingroup$ Thanks! I'll check it out and see if that works for me. Such a frustrating problem! $\endgroup$
    – Carly Batist
    Jul 20, 2022 at 12:26
  • 4
    $\begingroup$ Not doing this as an answer per se but this is a thought: it'd be useful to start collecting benchmarks of various key acoustic processes for posterity: I'm doing X process on Y dataset with Z hardware and it took N hours $\endgroup$
    – dtsavage
    Jul 21, 2022 at 20:32

1 Answer 1


Yes, it is definitely possible. We are successfully running training and inference of deep learning models on Apple Silicon M1/M2 chips using OpenSoundscape (opensoundscape.org) which uses PyTorch under the hood.

Currently, not all operations are supported by these chips (mps) - in particular, FFT is not yet supported (follow https://github.com/pytorch/pytorch/issues/78044). However, you can still take advantage of GPU speedups in the forward and backward passes of the CNN, while using parallelized CPUs for preprocessing of samples (including fft during spectrogram generation). We've seen great performance so far using M1 chips for training CNNs. (I don't have any head-to-head tests to share at the moment).

To use mps in OpenSoundscape's CNN class, set the object's .device to torch.device('mps'). For example:

import torch
from opensoundscape import CNN

cnn = CNN('resnet18',classes=['a','b','c'],sample_duration=3.0)

if torch.backends.mps.is_available():
    cnn.device = torch.device("mps")

You can also use mps with pytorch directly (check out the source code of OpenSoundscape's CNN class and https://pytorch.org/docs/stable/notes/mps.html#mps-backend)

(in case it matters - I'm a developer of OpenSoundscape)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.