当前位置: 首页> 文旅> 酒店 > 胶州企业网站设计_分类网站推广费用多少_企业网络营销目标_关键词seo价格

胶州企业网站设计_分类网站推广费用多少_企业网络营销目标_关键词seo价格

时间:2025/8/23 12:50:59来源:https://blog.csdn.net/while_BLUE_/article/details/144300916 浏览次数:0次
胶州企业网站设计_分类网站推广费用多少_企业网络营销目标_关键词seo价格

conda创建环境

CONDA_SUBDIR=osx-arm64 conda create -n ml python=3.9 -c conda-forge
conda env config vars set CONDA_SUBDIR=osx-arm64
conda activate ml

pip安装包

pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
pip install transformers datasets
pip install matplotlib

下载del源文件

del链接
放到本地项目内
在这里插入图片描述
修改del下的torch.py的两个函数内容

# 修改try gpu函数
def try_gpu(i=0):"""Return gpu(i) if exists, otherwise return cpu().Defined in :numref:`sec_use_gpu`"""if torch.cuda.device_count() >= i + 1:return torch.device(f'cuda:{i}')try:return torch.device('mps')except:return torch.device('cpu')# 修改try gpu函数
def try_all_gpus():"""Return all available GPUs, or [cpu(),] if no GPU exists.Defined in :numref:`sec_use_gpu`"""devices = [torch.device(f'cuda:{i}')for i in range(torch.cuda.device_count())]try:device_macos = torch.device('mps')except:device_macos = torch.device('cpu')return devices if devices else [device_macos]

测试

运行lenet.ipynb测试效果
在这里插入图片描述
速度还可以。

还不懂的可以看M1版本的教程

关键字:胶州企业网站设计_分类网站推广费用多少_企业网络营销目标_关键词seo价格

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: