当前位置:网站首页>MindSpore:npu 多卡训练自定义数据集如何给不同npu传递不同数据
MindSpore:npu 多卡训练自定义数据集如何给不同npu传递不同数据
2022-07-30 19:04:00 【小乐快乐】
问题描述:
mindspore npu 多卡训练自定义数据集如何给不同npu传递不同数据?
是在ds.GeneratorDataset传递num_shards=num_shards, shard_id=device_id还是自定义数据集__getitem__里面用rank id取不同数据?
解决方案:
使用GeneratorDataset的时候,可以使用 num_shards=num_shards, shard_id=device_id 参数来控制不同卡读取哪个分片的数据,__getitem__ 和 __len__ 按全量数据集处理即可。
举例:
卡0:ds.GeneratorDataset(..., num_shards=8, shard_id=0, ...)
卡1:ds.GeneratorDataset(..., num_shards=8, shard_id=1, ...)
卡2:ds.GeneratorDataset(..., num_shards=8, shard_id=2, ...)
...
卡7:ds.GeneratorDataset(..., num_shards=8, shard_id=7, ...)
边栏推荐
- Basic use of scrapy
- 荐号 | 对你有恩的人,不要请吃饭来报答
- 【剑指 Offe】剑指 Offer 17. 打印从1到最大的n位数
- MongoDB打破了原则引入SQL?
- JS提升:Promise中reject与then之间的关系
- AWS 控制台
- The Meta metaverse division lost 2.8 billion in the second quarter!Still want to keep betting?Metaverse development has yet to see a way out!
- 又一家公司面试的内容
- 在华为云,见证迷你世界的神奇觉醒
- Witness the magical awakening of the mini world in HUAWEI CLOUD
猜你喜欢
Alibaba Cloud Martial Arts Headline Event Sharing
VBA 连接Access数据库和Excle
JS提升:Promise中reject与then之间的关系
natural language processing nltk
NC | Tao Liang Group of West Lake University - TMPRSS2 "assists" virus infection and mediates the host invasion of Clostridium sothrix hemorrhagic toxin...
Meta元宇宙部门第二季度亏损28亿!仍要继续押注?元宇宙发展尚未看到出路!
VBA connects Access database and Excel
The advanced version of the Niu Ke brushing series (team competition, sorting subsequences, inverting strings, deleting common characters, repairing pastures)
中集世联达飞瞳全球工业人工智能AI领军者,全球顶尖AI核心技术高泛化性高鲁棒性稀疏样本持续学习,工业级高性能成熟AI产品规模应用
NXP IMX8QXP replacement DDR model operation process
随机推荐
Swiper rotates pictures and plays background music
第十七届“振兴杯”全国青年 职业技能大赛——计算机程序设计员(云计算平台与运维)参赛回顾与总结
【PHPWord】Quick Start of PHPWord in PHPOffice Suite
Scrapy框架介绍
Talking about Contrastive Learning (Contrastive Learning) the first bullet
Another company interview
SimpleOSS第三方库libcurl与引擎libcurl错误解决方法
延时队列优化 (2)
Go 系统收集
NC | Tao Liang Group of West Lake University - TMPRSS2 "assists" virus infection and mediates the host invasion of Clostridium sothrix hemorrhagic toxin...
MYSQL (Basic) - An article takes you into the wonderful world of MYSQL
JS提升:Promise中reject与then之间的关系
requet.getHeader("token") is null
ctf.show_web5
架构师如何成长
自然语言处理nltk
Pytorch foundation -- tensorboard use (1)
VS Code connects to SQL Server
VBA 运行时错误‘-2147217900(80040e14):自动化(Automation)错误
【剑指 Offe】剑指 Offer 18. 删除链表的节点