Skip to Content
Ray 分布式机器学习:利用Ray 进行大模型的数据处理、训练、推理和部署
book

Ray 分布式机器学习:利用Ray 进行大模型的数据处理、训练、推理和部署

by Max Pumperla, Edward Oakes, Richard Liaw
May 2024
Intermediate
252 pages
5h 31m
Chinese
China Machine Press
Content preview from Ray 分布式机器学习:利用Ray 进行大模型的数据处理、训练、推理和部署
利用
Ray Train
进行分布式训练
|
151
},
)
result = trainer.fit()
trained_model = result.checkpoint
每个
TorchTrainer
都需要指定
train_loop_per_worker
可选地,如果训练循环接收了
config
字典,可以将其指定为
train_loop_
config
每个
Ray Train
Trainer
都需要
ScalingConfig
,以了解如何在
Ray
集群上
进行训练。
每个
Trainer
的另一个必需参数是
datasets
字典,其中定义了
"train"
据集,并在训练循环中使用数据。
使用
.fit()
训练
TorchTrainer
最后一行将训练好的模型导出为检查点,以供下游应用程序(如服务和推理)
使用。
Ray Train
生成检查点的目的是序列化训练的中间状态。检查点可以包括
模型和其他训练组件,如预处理器。
7.2.5
分布式批量推理
训练好模型并获得了最佳准确率后,下一步是在实际应用中使用模型。有时这
意味着提供低延迟的服务,我们将在第
8
章探讨这个问题,但通常的任务是在
数据批次到达时应用模型。
我们使用
trained_mo del
中训练好的模型权重,并将其应用于新的数据批次
(在这种情况下,新数据只是相同公共数据集的部分数据)。为此,我们首先用
与训练相同的方式加载、预处理和特征化数据。然后,加载模型并将其映射到
整个数据集上。
Ray Dataset
支持使用
Ray
执行器高效完成这个任务,甚至只
需修改一个参数就可以使用 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

通过可观测性确保数据与AI的可靠性

通过可观测性确保数据与AI的可靠性

Barr Moses, Michael Segner

Publisher Resources

ISBN: 9787111753384