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 Tune
进行超参数调优
|
121
5.3.2
调优
Keras
模型
结束本章之前,我们再看一个稍微示例。正如前文提到的,本书不是侧重机器
学习,而是介绍
Ray
及其库的入门知识。因此,我们不会介绍机器学习的基础
知识,也不会详细介绍机器学习框架。所以,本文假设你已经熟悉
Keras
及其
API
,并对监督学习有一些基本了解。如果你不具备这些先决条件,仍然可以学
Ray Tune
的部分知识。你可以将以下示例作为
Tune
应用于机器学习任务的
更真实场景。
步骤如下:
1.
加载常见数据集;
2.
为机器学习任务准备数据集;
3.
使用
Keras
创建深度学习模型,并定义
Tune
目标,该模型将准确性指标报
告给
Tune
4.
使用
Tune
集成的
Hyperopt
定义搜索算法,用于调整
Keras
模型的超参数。
Tune
工作流维持不变:定义目标和搜索空间,然后使用想要的配置运行
tune.
run
。在较高层级
上,使用
Tune
与任意机器学习框架的过程如图
5.2
所示。
Tune 驱动程序
模型训练
模型训练
试验
驱动程序
试验 worker
5.2 Tune 通过在集群中的 Ray worker 进程上执行试验,并将指标返回给驱动程序,为机
器学习模型设置分布式超参数调优过程
为了定义训练数据集,我们编写一个简单的
load_data
实用函数,它加载
Keras
MNIST
数据集。
MNIST
28
×
28
像素的手写数字图像组成。我们将像素
 ...
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