Open lucasgelfond opened 1 year ago
Thanks- this is a well-referenced error report!
One fix that skirts around the problem rather than solving it-- but one which I would be happy with for the time being-- is to update the tutorial workflow to use the PyTorch pretrained classifiers rather than the tensorflow ones (that is, assuming that they are unproblematic with Apple Silicon). There is nothing in my mind that directly ties the mtriage tutorial to using an analyser that runs Tensorflow on Apple Silicon.This is arguably more of an architecture-specific corner case than a fundamental issue that we should solve in the tutorial workflow.
That said; using an ARM-specific Docker image seems the best solution to the actual problem. As we have discussed, a lot of mtriage has not been updated in several years, and this causes sticking points in the Docker compatibility/runtime in particular, as virtualization support for the latest versions of low-level libraries like Tensorflow is variable across versions. I'd be happy to discuss/pair program solutions to this at the level of the Docker image.
I can’t believe this issue still exists in 2024. I tried installing TensorFlow with Anaconda, Docker, and specific TensorFlow versions, but none worked. Finally, this is how I solved it:
Miniforge is optimized for Apple Silicon.
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
bash Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
conda create -n tensorflow_env python=3.10 -y
conda activate tensorflow_env
conda install -c apple tensorflow-deps
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
Run the following script to verify:
import tensorflow as tf
print("TensorFlow Version:", tf.__version__)
print("Is GPU available:", tf.config.list_physical_devices('GPU'))
See #184, seems as if we can use Docker Desktop to emulate Intel architecture and don't need to have a platform specific implementation here. Used those changes + a new Docker image, but now getting issues when I try to run 3b, seemingly platform-dependent. When I run 3b, I get:
On further inspection, it looks like AVX is a processor architecture extension that isn't supported on really old machines. Per some of the Apple Developer Documentation it looks like there's some internal framework they use for AVX, but I can't tell if it's supported natively.
A ton of people seem to have similar issues. My working knowledge of processor arch/Docker stuff is pretty limited, but I sense there's two options:
I tried the second, which looks like it's effectively x-platform (or: compatible with the linux/amd64 Docker container, as far as I understand) but getting this error:
Googling this error, I found this thread, which suggests some of the problem might be that the installation expects I'm on Python 3.5, when I'm actually on Python 3.7. Running
python3 --version
in the developer shell confirms that I'm on Python 3.7.5. However, when I run the suggestedpip3 install https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.4.0/tensorflow-2.4.0-cp37-none-linux_armv7l.whl
I get the same error:Any ideas? I think I might still be somewhat lost as to how TF is installed in Docker, and what lies in / outside of pip. Seems like - even if some of the binaries installed are outside of pip and are system-specific, that Rosetta emulation should cover it? (Although evidently not). Any ideas? Open to trying anything, LOL