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 进行大模型的数据处理、训练、推理和部署
34
|
2
'node:127.0.0.1': 1.0,
'object_store_memory': 2147483648.0}
继续之前,你需要一个正在运行的
Ray
集群来运行本章的示例。本节的目标是
快速介绍
Ray Core API
(简称为
Ray API
)。
对于
Python
开发者,
Ray API
的优点是其
API
风格非常类似其他常用的
Python
库。
Ray API
使用了装饰器、函数和类等大家熟悉的概念,因此非常容易上手。
Ray API
旨在为分布式计算提供通用的编程接口。因为
Ray
提供了简单直观、
易学易用的良好抽象,所以非常适合分布式计算任务。而
Ray
的引擎在后台负
责处理大量繁重的工作。这种设计理念使得
Ray
可以与现有的
Python
库和系统
一起使用。
本书之所以从
Ray Core
开始介绍,是因为我们认为它可使分布式计算更加易
用。本质上,本章的目标是介绍
Ray
的工作原理以及掌握
Ray
的基础知识。如
果你的
Python
开发经验有限,或者只想专注于更高级的任务,则可能需要一些
时间适应
Ray Core
4
。话虽如此,我们强烈推荐学习
Ray Core API
,因为它是
利用
Python
进行分布式计算的绝佳方式。
1
2.1.1 Ray API
的第一个示例
下面的函数从数据库中检索和处理数据。示例数据库是一个简单的
Python
表,包含了本书书名中的单词。假设从该数据库中检索一个单独的
item
并进行
处理是很耗时的,借用
Python
sleep
方法进行模拟:
import time
database = ...
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