Hemp Clone
2021-10-15T23:22:13+00:00
(推荐的看帖方式:看下标题,不感兴趣,X;太长,X;感兴趣,看正文,回复。
不推荐的看帖方式:看下标题,看下评论风向,开喷! )
如果你还没有分配到GPU,可以试试Google Colab和Kaggle,这俩都是可以给你白嫖GPU使用的。
Colab的免费版,提供一个12gb显存的k80,可以最长连续使用12小时,之后可以在申请。(很多人分享代码也喜欢在colab里面,不知道为啥在NGAer眼里colab一文不值)。
Kaggle提供每周41小时的16gb的P100,没有连续使用限制。而且Kaggle还有30小时的TPU使用时间,合起来就是71小时了,事实上,大部分人一周也用不到这么多时间,尤其是还打算用笔记本炼丹的同学。缺点就是,如果notebook一段时间不活跃会被掐掉。
(对,P100还没有3060跑得快,但是显存大了一倍)
应该还有很多类似的东西,比如说之前腾讯搞得广告算法大赛,直接给你白嫖2个月的V100,其实是有时限的,每段时间给你发个千元代金券,如果没比赛自己买还是贵的。
而且用云笔记本有个好处就是,你基本上不需要额外花时间配置环境,而且下载数据集的速度可能比你自己的电脑快很多,然后就是不需钱了。
云notebook不等同于云游戏,延迟不是很影响体验。就算是使用本地设备,多半也是要和notebook打交道的,缺点就是装不了插件(或许可以),调试麻烦...
至于在mac/macbook上训练模型,模型训练加速相关,TF是有支持的,不过我个人没有用过。所以对于相关的libraries支持情况我也不是很了解,比如说huggingface这些。
下面是M1芯片加速训练神经网络与N卡的对比。
[url]https://www.reddit.com/r/MachineLearning/comments/kwqev4/d_comparing_performance_on_apples_m1_with_nvidias/[/url]
[url]https://wandb.ai/vanpelt/m1-benchmark/reports/Can-Apple-s-M1-help-you-train-models-faster-cheaper-than-NVIDIA-s-V100---VmlldzozNTkyMzg[/url]
[quote]We ran a sweep of 8 different configurations of our training script and show that the Apple M1 offers impressive performance within reach of much more expensive and less energy efficient accelerators such as the Nvidia V100 for smaller architectures and datasets.[/quote]当然了,这个benchmark或许不应该当真, 大意是没有用半精度训练,而且benchmark使用模型是玩具尺寸,体现不出大显存的优势。
[quote]What the author essentially did (not using FP16 on FP16 optimized hardware, running batch-size 32 with a small model on a 16/32GB card) is comparable to trying to drive a Ferrari with the handbrake on. Then publish benchmarks about it. WHAT. A. JOKE.[/quote]下周应该就有M1 Max训练模型的测试了。
引用#56楼的话,
[quote]Google自己维护的硬件后端有TPU, AMD维护的是ROCm, 微软维护的是DirectML 苹果维护的是CoreML.[/quote]NVIDIA提供CUDA接口,APPLE有提供ML Compute接口,而TensorFlow有用ML compute加速训练的版本,也支持将macbook gpu通过metal当作pluggableDevice来加速训练。
同时,既然是unified memory,意味着超大显存,不知道用来训练网络会有什么效果。
然而,计算终究不是macbook的预期用途,M1 Max或许可以用来满足跑个prototype或者debug的需求。
[url]https://github.com/apple/tensorflow_macos[/url]
[url]https://blog.tensorflow.org/2021/06/pluggabledevice-device-plugins-for-TensorFlow.html[/url]
然而笔记本有笔记本的用途,长时间训练肯定没有那么舒适,因此能白嫖的云GPU还是不错的替代方案。
如果你还没有分配到GPU,可以试试Google Colab和Kaggle,这俩都是可以给你白嫖GPU使用的。
白嫖GPU
Colab的免费版,提供一个12gb显存的k80,可以最长连续使用12小时,之后可以在申请。(很多人分享代码也喜欢在colab里面,不知道为啥在NGAer眼里colab一文不值)。
Kaggle提供每周41小时的16gb的P100,没有连续使用限制。而且Kaggle还有30小时的TPU使用时间,合起来就是71小时了,事实上,大部分人一周也用不到这么多时间,尤其是还打算用笔记本炼丹的同学。缺点就是,如果notebook一段时间不活跃会被掐掉。
(对,P100还没有3060跑得快,但是显存大了一倍)
应该还有很多类似的东西,比如说之前腾讯搞得广告算法大赛,直接给你白嫖2个月的V100,其实是有时限的,每段时间给你发个千元代金券,如果没比赛自己买还是贵的。
而且用云笔记本有个好处就是,你基本上不需要额外花时间配置环境,而且下载数据集的速度可能比你自己的电脑快很多,然后就是不需钱了。
云notebook不等同于云游戏,延迟不是很影响体验。就算是使用本地设备,多半也是要和notebook打交道的,缺点就是装不了插件(或许可以),调试麻烦...
本地训练
至于在mac/macbook上训练模型,模型训练加速相关,TF是有支持的,不过我个人没有用过。所以对于相关的libraries支持情况我也不是很了解,比如说huggingface这些。
下面是M1芯片加速训练神经网络与N卡的对比。
[url]https://www.reddit.com/r/MachineLearning/comments/kwqev4/d_comparing_performance_on_apples_m1_with_nvidias/[/url]
[url]https://wandb.ai/vanpelt/m1-benchmark/reports/Can-Apple-s-M1-help-you-train-models-faster-cheaper-than-NVIDIA-s-V100---VmlldzozNTkyMzg[/url]
[quote]We ran a sweep of 8 different configurations of our training script and show that the Apple M1 offers impressive performance within reach of much more expensive and less energy efficient accelerators such as the Nvidia V100 for smaller architectures and datasets.[/quote]当然了,这个benchmark或许不应该当真, 大意是没有用半精度训练,而且benchmark使用模型是玩具尺寸,体现不出大显存的优势。
[quote]What the author essentially did (not using FP16 on FP16 optimized hardware, running batch-size 32 with a small model on a 16/32GB card) is comparable to trying to drive a Ferrari with the handbrake on. Then publish benchmarks about it. WHAT. A. JOKE.[/quote]下周应该就有M1 Max训练模型的测试了。
引用#56楼的话,
[quote]Google自己维护的硬件后端有TPU, AMD维护的是ROCm, 微软维护的是DirectML 苹果维护的是CoreML.[/quote]NVIDIA提供CUDA接口,APPLE有提供ML Compute接口,而TensorFlow有用ML compute加速训练的版本,也支持将macbook gpu通过metal当作pluggableDevice来加速训练。
同时,既然是unified memory,意味着超大显存,不知道用来训练网络会有什么效果。
然而,计算终究不是macbook的预期用途,M1 Max或许可以用来满足跑个prototype或者debug的需求。
tensorflow_macos
[quote] TensorFlow users on Intel Macs or Macs powered by Apple’s new M1 chip can now take advantage of accelerated training using Apple’s Mac-optimized version of TensorFlow 2.4 and the new ML Compute framework.[/quote][url]https://blog.tensorflow.org/2020/11/accelerating-tensorflow-performance-on-mac.html[/url][url]https://github.com/apple/tensorflow_macos[/url]
tensorflow_metal
[quote]Accelerate training of machine learning models with TensorFlow right on your Mac. Install TensorFlow and the tensorflow-metal PluggableDevice to accelerate training with Metal on Mac GPUs.[/quote][url]https://developer.apple.com/metal/tensorflow-plugin/[/url][url]https://blog.tensorflow.org/2021/06/pluggabledevice-device-plugins-for-TensorFlow.html[/url]
然而笔记本有笔记本的用途,长时间训练肯定没有那么舒适,因此能白嫖的云GPU还是不错的替代方案。