如何在Mac M1上安装FastAi
我正在尝试在新的Mac M1上安装FastAi(1.0.61版)。
我首先尝试了:
pip install fastai==1.0.61
这给了我一个没有CMAKE的错误,因此我使用 Brew install cmake
成功安装了CMAKE。
然后,重新启动FastAi安装命令,我会收到此错误:
Collecting fastai==1.0.61
Using cached fastai-1.0.61-py3-none-any.whl (239 kB)
Collecting fastprogress>=0.2.1
Using cached fastprogress-1.0.2-py3-none-any.whl (12 kB)
Collecting numexpr
Using cached numexpr-2.8.1-cp310-cp310-macosx_11_0_arm64.whl
Collecting scipy
Using cached scipy-1.8.0-cp310-cp310-macosx_12_0_arm64.whl (28.7 MB)
Collecting pyyaml
Using cached PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl (173 kB)
Collecting bottleneck
Using cached Bottleneck-1.3.4-cp310-cp310-macosx_11_0_arm64.whl
Collecting matplotlib
Using cached matplotlib-3.5.1-cp310-cp310-macosx_11_0_arm64.whl (7.2 MB)
Collecting pynvx>=1.0.0
Using cached pynvx-1.0.0.tar.gz (150 kB)
Preparing metadata (setup.py) ... done
Collecting beautifulsoup4
Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting nvidia-ml-py3
Using cached nvidia_ml_py3-7.352.0-py3-none-any.whl
Requirement already satisfied: requests in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (2.27.1)
Requirement already satisfied: Pillow in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (9.1.0)
Requirement already satisfied: pandas in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (1.4.2)
Collecting packaging
Using cached packaging-21.3-py3-none-any.whl (40 kB)
Requirement already satisfied: torch>=1.0.0 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (1.11.0)
Requirement already satisfied: torchvision in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (0.12.0)
Requirement already satisfied: numpy>=1.15 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from fastai==1.0.61) (1.22.3)
Requirement already satisfied: typing-extensions in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from torch>=1.0.0->fastai==1.0.61) (4.2.0)
Collecting soupsieve>1.2
Using cached soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Collecting pyparsing>=2.2.1
Using cached pyparsing-3.0.8-py3-none-any.whl (98 kB)
Collecting kiwisolver>=1.0.1
Using cached kiwisolver-1.4.2-cp310-cp310-macosx_11_0_arm64.whl (63 kB)
Requirement already satisfied: python-dateutil>=2.7 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from matplotlib->fastai==1.0.61) (2.8.2)
Collecting cycler>=0.10
Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting fonttools>=4.22.0
Using cached fonttools-4.33.3-py3-none-any.whl (930 kB)
Requirement already satisfied: pytz>=2020.1 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from pandas->fastai==1.0.61) (2022.1)
Requirement already satisfied: certifi>=2017.4.17 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests->fastai==1.0.61) (2021.10.8)
Requirement already satisfied: idna<4,>=2.5 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests->fastai==1.0.61) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests->fastai==1.0.61) (2.0.12)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from requests->fastai==1.0.61) (1.26.9)
Requirement already satisfied: six>=1.5 in /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->fastai==1.0.61) (1.16.0)
Building wheels for collected packages: pynvx
Building wheel for pynvx (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [78 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-cpython-310
creating build/lib.macosx-11.0-arm64-cpython-310/pynvx
copying pynvx/pynvml.py -> build/lib.macosx-11.0-arm64-cpython-310/pynvx
copying pynvx/__init__.py -> build/lib.macosx-11.0-arm64-cpython-310/pynvx
running build_ext
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10 (found version "3.10.4")
-- Found PythonLibs: /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/libpython3.10.dylib
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.3.dev0
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
CMake Error at /opt/homebrew/Cellar/cmake/3.23.1/share/cmake/Modules/FindCUDA.cmake:859 (message):
Specify CUDA_TOOLKIT_ROOT_DIR
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
-- Configuring incomplete, errors occurred!
See also "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeOutput.log".
See also "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py", line 68, in <module>
setup(
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 136, in run
self.run_command(cmd_name)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py", line 32, in run
self.build_extension(ext)
File "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py", line 56, in build_extension
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/lib.macosx-11.0-arm64-cpython-310', '-DPYTHON_EXECUTABLE=/Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pynvx
Running setup.py clean for pynvx
Failed to build pynvx
Installing collected packages: pynvx, nvidia-ml-py3, soupsieve, scipy, pyyaml, pyparsing, kiwisolver, fonttools, fastprogress, cycler, bottleneck, packaging, beautifulsoup4, numexpr, matplotlib, fastai
Running setup.py install for pynvx ... error
error: subprocess-exited-with-error
× Running setup.py install for pynvx did not run successfully.
│ exit code: 1
╰─> [82 lines of output]
running install
/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-cpython-310
creating build/lib.macosx-11.0-arm64-cpython-310/pynvx
copying pynvx/pynvml.py -> build/lib.macosx-11.0-arm64-cpython-310/pynvx
copying pynvx/__init__.py -> build/lib.macosx-11.0-arm64-cpython-310/pynvx
running build_ext
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10 (found version "3.10.4")
-- Found PythonLibs: /Users/connoreaton/miniforge3/envs/spaff_nlp/lib/libpython3.10.dylib
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.3.dev0
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
CMake Error at /opt/homebrew/Cellar/cmake/3.23.1/share/cmake/Modules/FindCUDA.cmake:859 (message):
Specify CUDA_TOOLKIT_ROOT_DIR
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
-- Configuring incomplete, errors occurred!
See also "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeOutput.log".
See also "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/temp.macosx-11.0-arm64-cpython-310/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py", line 68, in <module>
setup(
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 670, in run
self.run_command('build')
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 136, in run
self.run_command(cmd_name)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py", line 32, in run
self.build_extension(ext)
File "/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/setup.py", line 56, in build_extension
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
File "/Users/connoreaton/miniforge3/envs/spaff_nlp/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/fn/lgvtrxd90cl3nqryfdfcsld80000gn/T/pip-install-81yvkyvs/pynvx_19ff0317a3854976bb7ea683521d385f/build/lib.macosx-11.0-arm64-cpython-310', '-DPYTHON_EXECUTABLE=/Users/connoreaton/miniforge3/envs/spaff_nlp/bin/python3.10', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pynvx
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
我显然无法安装 pynvx
。这是有道理的,因为 pynvx
涉及CUDA,显然Mac M1无法支持。我尝试了CPU仅在此处从Fastai构建安装文档:
https://fastai1.fast.fast.ai/install。 html
但是我遇到了同样的错误。
我能做些什么?如果我不能在本地训练模型,那还可以,但是我至少希望能够加载模型并预测它们。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Fastai似乎需要
pyenv
需要CUDA才能工作。 CUDA仅在NVIDIA GPU上可用,Mac M1具有完全不同的SOC,没有NVIDIA GPU,您可以阅读实际错误
fastai seems to need
pyenv
which needs CUDA to work. CUDA is available only on Nvidia GPUs and the MAC M1 has a completly differente SOC with no Nvidia GPUYou can read the actual error
我可以在第一章中获得第一个培训示例,以在我的Mac Mini上使用M1。我正在使用Ventura(Beta),但我认为这并不重要。最新的Xcode可以。我已经尝试并失败了很多次来实现此功能,如果您也有,那么看到它实际上播放真的很有趣,即使只是一点点。但是我可以用一些帮助将其哄骗。
我制作了一个bash脚本,可以创建一个Miniconda环境,并在MacOS上的Jupyter笔记本中安装了运行FastAi所需的一切。我是Conda,Python和Fastai的新手,因此可能有更好的方法可以做到这一点,但它对我有用,并且可以重现。
我们需要下载FastBook,但是在撰写本文时,我们还需要一些出血的Edge Nightly Source构建才能使这项工作。因此,制作一个空目录并进入其中。然后运行此脚本,为其提供您希望创建的新虚拟环境的名称。安装所有内容将需要几分钟,而且运气可能会不会出错。就是这样。
Conda激活环境,然后运行Jupyter笔记本。从那里导航到快速书 /清洁 / 01_intro。
您将需要编辑任何数据加载程序,以添加显式“ num_workers = 0”参数。因此,第一个笔记本电脑将看起来像:
运行时,第一个示例通常会显示折旧警告(将其更改为“ Arch = Resnet34”,而不是仅仅是“ Resnet34”可以修复它)。但是无论是否警告,它都会运行:进度栏很快就会出现,任务在大约五分钟内完成(对我来说)。
这是我创建或更新环境的脚本。
I can get the first training example in chapter one to use the M1 on my mac mini. I'm using Ventura (beta), but I don't think that matters. The latest Xcode does. I've tried and failed many times to get this working, and if you have too, it's really fun to see it actually play, if only a little. But I could use some help coaxing it farther.
I made a bash script that creates a miniconda environment and installs everything needed to run fastai in jupyter notebook on macOS. I'm new to conda and python and fastai so there may be better ways to do this, but it works for me and is reproducible.
We need to download fastbook, but at the time of this writing we also need some bleeding edge nightly source builds to make this work. So make an empty directory and cd into it. Then run this script, giving it the name of a new virtual environment you'd like it to create. It will take several minutes to install everything, and with some luck may finish without error. That's it.
Conda activate the environment, then run jupyter notebook. From there navigate to fastbook / clean / 01_intro.
You will need to edit any DataLoaders to add an explicit "num_workers=0" argument. So the first notebook will look like:
When run, the first example usually shows a deprecation warning (changing it to "arch=resnet34" instead of just "resnet34" may fix it). But warning or not, it runs: a progress bar is quickly presented, and the task finishes in about five minutes (for me).
Here's my script to create or update the environment.
时间到了,今天,您可以在M1芯片上运行Fastai。
虽然您必须为很多问题做好准备。
这是我的详细经验:
但是,长话短说,CPU从开箱即用。要使用GPU加速度,您需要将设备设置为MPS以使用Pytorch中的Apple Cuda模拟。
GPU用法:
第一课的第一次培训的时间:
Time goes, and today, you can run FastAI on the M1 chip.
Though you have to be ready for a lot of issues.
Here is my detailed experience: https://medium.com/@johnniet19/fastai-2022-on-macbook-m1-pro-max-gpu-faa51d379a8c
But, long story short, the CPU works from out of the box. To use the GPU acceleration, you need to set a device to MPS to use APPLE CUDA analog in PyTorch.

GPU usage:
Time for the first training in the 1st lesson:
