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 进行大模型的数据处理、训练、推理和部署
90
|
4
量”评估。特别地,如果模型评估需要很长时间,这样分组环境可以加
训练。
num_rollout_workers > 0
时,驱动程序(本地
worker
)不需要环境。
这是因为
rollout worker
负责采样和评估。如果你仍然希望驱动程序中有环
境,可以将该选项设置为
True
4.3.3
配置环境
代码如下:
from ray.rllib.algorithms.dqn import DQNConfig
config = DQNConfig().environment(
env="CartPole-v1",
env_config={"my_config": "value"},
observation_space=None,
action_space=None,
render_env=True,
)
指定用于训练的环境。这可以是已知的
Ray RLlib
环境的字符串(如任意
Gym
环境),也可以是自己实现的自定义环境的类名
15
1
为环境指定一组可选的配置选项字典,这些选项将传递给环境构造函数。
可以指定环境的观测空间和动作空间。如果不指定,则会从环境中推理观
测空间和动作空间。
默认情况下为
False
,该属性负责打开环境的渲染,前提是需要实现环境
render
方法。
注意,这里省略了每种类型的多个配置选项。除此之外,我们没有涉及修改强
化学习的训练过程(例如修改使用的底层模型)。感兴趣的读者可参考
RLlib
Training API
文档(
https://or
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