chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:17:40 +08:00
commit f1825c8ceb
10096 changed files with 2364182 additions and 0 deletions
View File
+13
View File
@@ -0,0 +1,13 @@
<!-- APIs-tab sidebar (Pattern B): a tiny container that loads ONE shared API nav
fragment (_static/api-nav.html) client-side, instead of server-rendering the
nav into every page. The fragment is generated once (see _ext/api_sidebar.py)
and hydrated/highlighted by _static/api-nav-loader.js. Reuses id="main-sidebar"
so it inherits Ray's #main-sidebar CSS. -->
<nav id="main-sidebar" class="bd-docs-nav bd-links" aria-label="{{ _('APIs Navigation') }}">
<div id="api-nav-mount" class="bd-toc-item navbar-nav"
data-api-nav-url="{{ pathto('_static/api-nav.html', 1) }}"
data-pagename="{{ pagename }}">
<p class="api-nav-status">{{ _('Loading API navigation…') }}</p>
</div>
</nav>
<script src="{{ pathto('_static/api-nav-loader.js', 1) }}" defer></script>
@@ -0,0 +1,16 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autopydantic_model:: {{ fullname }}
:members:
:inherited-members: BaseModel
:exclude-members: Config
:model-show-config-summary: False
:model-show-validator-summary: False
:model-show-field-summary: False
:field-list-validators: False
:model-show-json: False
@@ -0,0 +1,17 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autopydantic_model:: {{ fullname }}
:inherited-members: BaseModel
:exclude-members: Config
:model-show-config-summary: False
:model-show-validator-summary: False
:model-show-field-summary: False
:field-list-validators: False
:model-show-json: True
:model-summary-list-order: bysource
:undoc-members:
@@ -0,0 +1,8 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline }}
.. currentmodule:: {{ module }}
.. auto{{ objtype }}:: {{ objname }}
@@ -0,0 +1,48 @@
{#
It's a known bug (https://github.com/sphinx-doc/sphinx/issues/9884)
that autosummary will generate warning for inherited instance attributes.
Those warnings will fail our build.
For now, we don't autosummary classes with inherited instance attributes.
To opt out, use `:template: autosummary/class_without_autosummary.rst`
#}
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:show-inheritance:
{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}
.. autosummary::
:nosignatures:
:toctree:
{% for item in methods %}
{{ item | filter_out_undoc_class_members(name, module) }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}
.. autosummary::
:nosignatures:
:toctree:
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
@@ -0,0 +1,29 @@
.. currentmodule:: {{ module }}
{% if name | has_public_constructor(module) %}
{{ name }}
{{ '-' * name | length }}
.. autoclass:: {{ objname }}
{% endif %}
{% block methods %}
{% if methods %}
{% set api_groups = methods | get_api_groups(name, module) %}
{% for api_group in api_groups %}
{% if api_groups | length > 1 %}
{{ api_group }}
{{ '-' * api_group | length }}
{% endif %}
.. autosummary::
:nosignatures:
:toctree: doc
{% for method in methods | select_api_group(name, module, api_group) %}
{{ name }}.{{ method }}
{%- endfor %}
{% endfor %}
{% endif %}
{% endblock %}
@@ -0,0 +1,10 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:members:
:show-inheritance:
@@ -0,0 +1,11 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:members:
:noindex:
:show-inheritance:
@@ -0,0 +1,9 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:members:
@@ -0,0 +1,9 @@
{# Short label: fullname is the fully-qualified path (e.g. ray.data.Dataset.map);
split('.')[-1] keeps just the leaf ("map") so the API-sidebar label (and page H1)
stay readable rather than repeating the full dotted path. -#}
{{ fullname.split('.')[-1] | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}()
:members:
+25
View File
@@ -0,0 +1,25 @@
<div id="csat">
<div id="csat-feedback-received" class="csat-hidden">
<span>Thanks for the feedback!</span>
</div>
<div id="csat-inputs">
<span>Was this helpful?</span>
<div id="csat-yes" class="csat-button">
<svg id="csat-yes-icon" class="csat-hidden csat-icon" width="18" height="13" viewBox="0 0 18 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.00023 10.172L16.1922 0.979004L17.6072 2.393L7.00023 13L0.63623 6.636L2.05023 5.222L7.00023 10.172Z" />
</svg>
<span>Yes</span>
</div>
<div id="csat-no" class="csat-button">
<svg id="csat-no-icon" class="csat-hidden csat-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.00023 5.58599L11.9502 0.635986L13.3642 2.04999L8.41423 6.99999L13.3642 11.95L11.9502 13.364L7.00023 8.41399L2.05023 13.364L0.63623 11.95L5.58623 6.99999L0.63623 2.04999L2.05023 0.635986L7.00023 5.58599Z" />
</svg>
<span>No</span>
</div>
</div>
<div id="csat-textarea-group" class="csat-hidden">
<span id="csat-feedback-label">Feedback</span>
<textarea id="csat-textarea"></textarea>
<div id="csat-submit">Submit</div>
</div>
</div>
+14
View File
@@ -0,0 +1,14 @@
{# Displays a link to the edit interface of the page source in the specified
Version Control System. #} {% if sourcename is defined and
theme_use_edit_page_button==true and page_source_suffix and
show_edit_button==true %} {% set src = sourcename.split('.') %}
<div class="tocsection editthispage">
<a href="{{ get_edit_provider_and_url()[1] }}">
<i class="fa-solid fa-pencil"></i>
{% set provider = get_edit_provider_and_url()[0] %} {% block
edit_this_page_text %} {% if provider %} {% trans provider=provider %}Edit
on {{ provider }}{% endtrans %} {% else %} {% trans %}Edit{% endtrans %} {%
endif %} {% endblock %}
</a>
</div>
{% endif %}
+13
View File
@@ -0,0 +1,13 @@
{# This page is a template used for all Ray library example pages. #}
<!-- prettier-ignore -->
{% extends "!layout.html" %}
{%- block extrahead -%}
{% include 'extrahead.html' %}
{{ super() }}
{% endblock %}
<!-- prettier-ignore -->
{% block body %}
{{ render_library_examples() }}
{% endblock %}
+78
View File
@@ -0,0 +1,78 @@
<!-- Extra header to include at the top of each template.
Kept separately so that it can easily be included in any templates
that need to be overridden for individual pages; e.g. included
both in the usual template (layout.html) as well as (index.html). -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;900&family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
title="light"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css"
disabled="disabled"
/>
<link
rel="stylesheet"
title="dark"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css"
disabled="disabled"
/>
<link
href="https://cdn.jsdelivr.net/npm/remixicon@4.1.0/fonts/remixicon.css"
rel="stylesheet"
/>
<!-- Used for text embedded in html on the index page -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<!-- Parser used to call hljs on responses from Ray Assistant -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<!-- Sanitizer for Ray Assistant AI -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.3.3/purify.min.js"></script>
<!-- Fathom - beautiful, simple website analytics -->
<script src="https://deer.ray.io/script.js" data-site="WYYANYOS" defer></script>
<!-- / Fathom -->
<!-- Google Tag Manager -->
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js',
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-N7VD67MZ');
</script>
<!-- End Google Tag Manager -->
<!-- Data to be shared with JS on every page -->
<script>
window.data = {
copyIconSrc: "{{ pathto('_static/copy-button.svg', 1) }}",
};
</script>
<!-- Herald Widget -->
<script
type="module"
id="runllm-widget-script"
src="https://widget.runllm.com"
version="stable"
crossorigin="anonymous"
runllm-keyboard-shortcut="Mod+j"
runllm-name="Ray Docs"
runllm-position="BOTTOM_RIGHT"
runllm-assistant-id="1003"
></script>
+511
View File
@@ -0,0 +1,511 @@
{% extends "!layout.html" %}
<!-- prettier-ignore -->
{%- block extrahead -%}
{% include 'extrahead.html' %}
{{ super() }}
{% endblock %}
{% block body %}
<div class="main-content">
<div class="centered-heading">
<h1>Welcome to Ray</h1>
<p>
An open source framework to build and scale your ML and Python
applications easily
</p>
</div>
<div class="heading-buttons">
<a href="{{ pathto('ray-overview/getting-started') }}">
<div class="header-button">
<i class="ri-play-line"></i>
<span>Get started with Ray</span>
</div>
</a>
<a href="{{ pathto('ray-overview/installation') }}">
<div class="header-button">
<i class="ri-install-line"></i>
<span>Install Ray</span>
</div>
</a>
<a href="{{ pathto('ray-overview/examples') }}">
<div class="header-button">
<i class="ri-code-block"></i>
<span>Ray Example Gallery</span>
</div>
</a>
</div>
<div class="clicky-tab-widget">
<h3>Scale with Ray</h3>
<div class="clicky-tab-side-by-side">
<div class="nav flex-column nav-pills" id="v-pills-tab">
<a class="nav-link active" id="v-pills-batch-tab">Batch inference</a>
<a class="nav-link" id="v-pills-training-tab">Model training</a>
<a class="nav-link" id="v-pills-tuning-tab">Hyperparameter tuning</a>
<a class="nav-link" id="v-pills-serving-tab">Model serving</a>
<a class="nav-link" id="v-pills-rl-tab">Reinforcement learning</a>
</div>
<div class="tab-area">
<div class="tab-content" id="v-pills-tabContent">
<!-- prettier-ignore -->
<div class="tab-pane fade show active no-copybutton" id="v-pills-data">
{{ pygments_highlight_python('''
from typing import Dict
import numpy as np
import ray
# Step 1: Create a Ray Dataset from in-memory Numpy arrays.
ds = ray.data.from_numpy(np.asarray(["Complete this", "for me"]))
# Step 2: Define a Predictor class for inference.
class HuggingFacePredictor:
def __init__(self):
from transformers import pipeline
# Initialize a pre-trained GPT2 Huggingface pipeline.
self.model = pipeline("text-generation", model="gpt2")
# Logic for inference on 1 batch of data.
def __call__(self, batch: Dict[str, np.ndarray]) -> Dict[str, list]:
# Get the predictions from the input batch.
predictions = self.model(
list(batch["data"]), max_length=20, num_return_sequences=1)
# `predictions` is a list of length-one lists. For example:
# [[{"generated_text": "output_1"}], ..., [{"generated_text": "output_2"}]]
# Modify the output to get it into the following format instead:
# ["output_1", "output_2"]
batch["output"] = [sequences[0]["generated_text"] for sequences in predictions]
return batch
# Use 2 parallel actors for inference. Each actor predicts on a
# different partition of data.
# Step 3: Map the Predictor over the Dataset to get predictions.
predictions = ds.map_batches(HuggingFacePredictor, compute=ray.data.ActorPoolStrategy(size=2))
# Step 4: Show one prediction output.
predictions.show(limit=1)
''') }}
<div class="tab-pane-links">
<a href="{{ pathto('data/data') }}" target="_blank">Learn more about Ray Data</a>
<a href="{{ pathto('data/examples') }}" target="_blank">Examples</a>
</div>
</div>
<!-- prettier-ignore -->
<div class="tab-pane fade no-copybutton" id="v-pills-training">
{{ pygments_highlight_python('''
from ray.train import ScalingConfig
from ray.train.torch import TorchTrainer
# Step 1: Set up PyTorch model training as you normally would.
def train_func():
model = ...
train_dataset = ...
for epoch in range(num_epochs):
... # model training logic
# Step 2: Set up Ray\'s PyTorch Trainer to run on 32 GPUs.
trainer = TorchTrainer(
train_loop_per_worker=train_func,
scaling_config=ScalingConfig(num_workers=32, use_gpu=True),
datasets={"train": train_dataset},
)
# Step 3: Run distributed model training on 32 GPUs.
result = trainer.fit()
''') }}
<div class="tab-pane-links">
<a href="{{ pathto('train/train') }}" target="_blank">Learn more about Ray Train</a>
<a href="{{ pathto('train/examples') }}" target="_blank">Examples</a>
</div>
</div>
<!-- prettier-ignore -->
<div class="tab-pane fade no-copybutton" id="v-pills-tuning">
{{ pygments_highlight_python('''
from ray import tune
# Step 1: Define an objective function to optimize.
def objective(config):
# Train model with config hyperparameters
model = train_model(
lr=config["lr"],
batch_size=config["batch_size"],
num_layers=config["num_layers"],
)
accuracy = evaluate_model(model)
# Report metrics back to Tune
tune.report(accuracy=accuracy)
# Step 2: Define hyperparameter search space.
search_space = {
"lr": tune.loguniform(1e-4, 1e-1),
"batch_size": tune.choice([32, 64, 128]),
"num_layers": tune.randint(1, 10),
}
# Step 3: Configure and run 1000 trials with Ray Tune.
tuner = tune.Tuner(
objective,
param_space=search_space,
tune_config=tune.TuneConfig(num_samples=1000),
)
result_grid = tuner.fit()
best_result = result_grid.get_best_result(metric="accuracy", mode="max")
''') }}
<div class="tab-pane-links">
<a href="{{ pathto('tune/index') }}" target="_blank">Learn more about Ray Tune</a>
<a href="{{ pathto('tune/examples/index') }}" target="_blank">Examples</a>
</div>
</div>
<!-- prettier-ignore -->
<div class="tab-pane fade no-copybutton" id="v-pills-serving">
{{ pygments_highlight_python('''
from io import BytesIO
from fastapi import FastAPI
from fastapi.responses import Response
import torch
from ray import serve
from ray.serve.handle import DeploymentHandle
app = FastAPI()
@serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, diffusion_model_handle: DeploymentHandle) -> None:
self.handle = diffusion_model_handle
@app.get(
"/imagine",
responses={200: {"content": {"image/png": {}}}},
response_class=Response,
)
async def generate(self, prompt: str, img_size: int = 512):
assert len(prompt), "prompt parameter cannot be empty"
image = await self.handle.generate.remote(prompt, img_size=img_size)
file_stream = BytesIO()
image.save(file_stream, "PNG")
return Response(content=file_stream.getvalue(), media_type="image/png")
@serve.deployment(
ray_actor_options={"num_gpus": 1},
autoscaling_config={"min_replicas": 0, "max_replicas": 2},
)
class StableDiffusionV2:
def __init__(self):
from diffusers import EulerDiscreteScheduler, StableDiffusionPipeline
model_id = "stabilityai/stable-diffusion-2"
scheduler = EulerDiscreteScheduler.from_pretrained(
model_id, subfolder="scheduler"
)
self.pipe = StableDiffusionPipeline.from_pretrained(
model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16
)
self.pipe = self.pipe.to("cuda")
def generate(self, prompt: str, img_size: int = 512):
assert len(prompt), "prompt parameter cannot be empty"
with torch.autocast("cuda"):
image = self.pipe(prompt, height=img_size, width=img_size).images[0]
return image
entrypoint = APIIngress.bind(StableDiffusionV2.bind())
''') }}
<div class="tab-pane-links">
<a href="{{ pathto('serve/index') }}" target="_blank">Learn more about Ray Serve</a>
<a href="https://console.anyscale.com/register/ha?render_flow=ray&utm_source=ray_docs&utm_medium=docs&utm_campaign=scale_with_ray&redirectTo=/v2/template-preview/serve-stable-diffusion-v2" target="_blank">Quickstart</a>
</div>
</div>
<!-- prettier-ignore -->
<div class="tab-pane fade no-copybutton" id="v-pills-rl">
{{ pygments_highlight_python('''
from ray.rllib.algorithms.ppo import PPOConfig
# Step 1: Configure PPO to run 64 parallel workers to collect samples from the env.
ppo_config = (
PPOConfig()
.environment(env="Taxi-v3")
.rollouts(num_rollout_workers=64)
.framework("torch")
.training(model=rnn_lage)
)
# Step 2: Build the PPO algorithm.
ppo_algo = ppo_config.build()
# Step 3: Train and evaluate PPO.
for _ in range(5):
print(ppo_algo.train())
ppo_algo.evaluate()
''') }}
<div class="tab-pane-links">
<a href="{{ pathto('rllib/index') }}" target="_blank">Learn more about Ray RLlib</a>
<a href="{{ pathto('rllib/rllib-examples') }}" target="_blank">Examples</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-area">
<h3>Beyond the basics</h3>
<div class="card-row">
<div class="link-card">
<div class="link-card-icon-label">
<div class="card-icon">
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_129_1153)">
<path
d="M28 7H4C3.44772 7 3 7.44772 3 8V11C3 11.5523 3.44772 12 4 12H28C28.5523 12 29 11.5523 29 11V8C29 7.44772 28.5523 7 28 7Z"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M27 12V24C27 24.2652 26.8946 24.5196 26.7071 24.7071C26.5196 24.8946 26.2652 25 26 25H6C5.73478 25 5.48043 24.8946 5.29289 24.7071C5.10536 24.5196 5 24.2652 5 24V12"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M13 17H19"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</g>
<defs>
<clipPath id="clip0_129_1153">
<rect width="32" height="32" fill="white" />
</clipPath>
</defs>
</svg>
</div>
<h4>Ray Libraries</h4>
</div>
<div class="card-text-area">
<p>
Scale the entire ML pipeline from data ingest to model serving with
high-level Python APIs that integrate with popular ecosystem
frameworks.
</p>
<a
href="{{ pathto('ray-overview/getting-started') }}"
target="_blank"
>
Learn more
</a>
</div>
</div>
<div class="link-card">
<div class="link-card-icon-label">
<div class="card-icon">
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_129_1163)">
<path
d="M13.0003 15.8675C12.2009 14.4208 11.8692 12.762 12.0509 11.1192C12.2325 9.47632 12.9185 7.93006 14.0147 6.69294C15.1108 5.45582 16.5632 4.58859 18.1722 4.21046C19.7812 3.83233 21.4679 3.96186 23.0003 4.58125L18.0003 10L18.7078 13.2925L22.0003 14L27.4191 9C28.0385 10.5324 28.168 12.2191 27.7899 13.8281C27.4117 15.4371 26.5445 16.8895 25.3074 17.9857C24.0703 19.0818 22.524 19.7678 20.8811 19.9495C19.2383 20.1311 17.5795 19.7994 16.1328 19L9.12532 27.125C8.56174 27.6886 7.79735 28.0052 7.00032 28.0052C6.20329 28.0052 5.43891 27.6886 4.87532 27.125C4.31174 26.5614 3.99512 25.797 3.99512 25C3.99512 24.203 4.31174 23.4386 4.87532 22.875L13.0003 15.8675Z"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</g>
<defs>
<clipPath id="clip0_129_1163">
<rect width="32" height="32" fill="white" />
</clipPath>
</defs>
</svg>
</div>
<h4>Ray Core</h4>
</div>
<div class="card-text-area">
<p>
Scale generic Python code with simple, foundational primitives that
enable a high degree of control for building distributed
applications or custom platforms.
</p>
<a href="{{ pathto('ray-core/walkthrough') }}" target="_blank">
Learn more
</a>
</div>
</div>
<div class="link-card">
<div class="link-card-icon-label">
<div class="card-icon">
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_129_1171)">
<path
d="M14 23H4C3.46957 23 2.96086 22.7893 2.58579 22.4142C2.21071 22.0391 2 21.5304 2 21V12C2 11.4696 2.21071 10.9609 2.58579 10.5858C2.96086 10.2107 3.46957 10 4 10H14"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M14 27H8"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M26 9H22"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M26 13H22"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M29 5H19C18.4477 5 18 5.44772 18 6V26C18 26.5523 18.4477 27 19 27H29C29.5523 27 30 26.5523 30 26V6C30 5.44772 29.5523 5 29 5Z"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M11 23V27"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
id="link-card-icon-filled"
d="M24 24C24.8284 24 25.5 23.3284 25.5 22.5C25.5 21.6716 24.8284 21 24 21C23.1716 21 22.5 21.6716 22.5 22.5C22.5 23.3284 23.1716 24 24 24Z"
/>
</g>
<defs>
<clipPath id="clip0_129_1171">
<rect width="32" height="32" fill="white" />
</clipPath>
</defs>
</svg>
</div>
<h4>Ray Clusters</h4>
</div>
<div class="card-text-area">
<p>
Deploy a Ray cluster on AWS, GCP, Azure, or Kubernetes to seamlessly
scale workloads for production.
</p>
<a href="{{ pathto('cluster/getting-started') }}" target="_blank">
Learn more
</a>
</div>
</div>
</div>
</div>
<div class="links-grid-wrapper">
<h3>Getting involved</h3>
<div class="links-grid">
<b>Join the community</b>
<b>Get support</b>
<b>Contribute to Ray</b>
<a
class="community-box"
href="https://www.meetup.com/Bay-Area-Ray-Meetup/"
target="_blank"
>
<i class="ri-team-line"></i>
<p>Attend community events</p>
</a>
<a
class="community-box"
href="https://www.ray.io/join-slack?utm_source=ray_docs&utm_medium=docs"
target="_blank"
>
<i class="ri-slack-line"></i>
<p>Find community on Slack</p>
</a>
<a
class="community-box"
href="./ray-contribute/getting-involved.html"
target="_blank"
>
<i class="ri-send-plane-2-line"></i>
<p>Contributor's guide</p>
</a>
<a
class="community-box"
href="https://share.hsforms.com/1Ee3Gh8c9TY69ZQib-yZJvgc7w85"
target="_blank"
>
<i class="ri-send-plane-2-line"></i>
<p>Subscribe to the newsletter</p>
</a>
<a class="community-box" href="https://discuss.ray.io/" target="_blank">
<i class="ri-chat-4-line"></i>
<p>Ask questions on the forum</p>
</a>
<a
class="community-box"
href="https://github.com/ray-project/ray/pulls"
target="_blank"
>
<i class="ri-github-line"></i>
<p>Create pull requests</p>
</a>
<a
class="community-box"
href="https://x.com/raydistributed"
target="_blank"
>
<i class="ri-twitter-line"></i>
<p>Follow us on Twitter</p>
</a>
<a
class="community-box"
href="https://github.com/ray-project/ray/issues/new/choose"
target="_blank"
>
<i class="ri-github-line"></i>
<p>Open an issue</p>
</a>
</div>
</div>
</div>
{{ super() }} {% endblock %}
+6
View File
@@ -0,0 +1,6 @@
<!-- prettier-ignore -->
{% extends "!layout.html" %}
{%- block extrahead -%}
{% include 'extrahead.html' %}
{{ super() }}
{% endblock %}
@@ -0,0 +1,3 @@
<nav id="main-sidebar" class="bd-docs-nav bd-links" aria-label="{{ _('Section Navigation') }}">
<div class="bd-toc-item navbar-nav">{{ cached_toctree }}</div>
</nav>
+3
View File
@@ -0,0 +1,3 @@
<nav id="main-sidebar" class="bd-docs-nav bd-links" aria-label="{{ _('Section Navigation') }}">
<div class="bd-toc-item navbar-nav">{{ generate_toctree_html("sidebar", show_nav_level=0, startdepth=0, maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}</div>
</nav>
@@ -0,0 +1,10 @@
<a
id="try-anyscale-href"
href="https://console.anyscale.com/register/ha?render_flow=ray&utm_source=ray_docs&utm_medium=docs&utm_campaign=navbar"
target="_blank"
rel="noopener noreferrer"
>
<div id="try-anyscale-text">
<span>Try Managed Ray</span>
</div>
</a>
+9
View File
@@ -0,0 +1,9 @@
<nav class="navbar-nav">
<p class="sidebar-header-items__title"
role="heading"
aria-level="1"
aria-label="{{ _('Site Navigation') }}">
{{ _("Site Navigation") }}
</p>
{{ render_header_nav_links() }}
</nav>
@@ -0,0 +1,13 @@
{# Logo link generation -#}
{% if not theme_logo.get("link") %}
{% set href = pathto(root_doc) %}
{% elif hasdoc(theme_logo.get("link")) %}
{% set href = pathto(theme_logo.get("link")) %} {# internal page #}
{% else %}
{% set href = theme_logo.get("link") %} {# external url #}
{% endif %}
{#- Logo HTML and image #}
<a class="navbar-brand logo" href="{{ href }}">
{{ theme_logo["svg"] }}
</a>
@@ -0,0 +1,175 @@
<!-- prettier-ignore -->
{% extends "!layout.html" %}
{%- block extrahead -%}
{% include 'extrahead.html' %}
{{ super() }}
{% endblock %}
<!-- prettier-ignore -->
{% block body %}
{# Main example gallery for Ray. Examples here are pulled in from the individual Ray library
`examples.html` pages, which themselves are built from the `examples.yml` file for the library. #}
<div class="content-wrapper">
<div class="content">
<div class="examples-search-area">
<label id="examples-search-input-label" for="examples-search-input">
<svg
id="examples-search-icon"
width="25"
height="25"
viewBox="0 0 25 25"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M18.4295 16.6717L22.7125 20.9537L21.2975 22.3687L17.0155 18.0857C15.4223 19.3629 13.4405 20.0576 11.3985 20.0547C6.43053 20.0547 2.39853 16.0227 2.39853 11.0547C2.39853 6.08669 6.43053 2.05469 11.3985 2.05469C16.3665 2.05469 20.3985 6.08669 20.3985 11.0547C20.4014 13.0967 19.7068 15.0784 18.4295 16.6717ZM16.4235 15.9297C17.6926 14.6246 18.4014 12.8751 18.3985 11.0547C18.3985 7.18669 15.2655 4.05469 11.3985 4.05469C7.53053 4.05469 4.39853 7.18669 4.39853 11.0547C4.39853 14.9217 7.53053 18.0547 11.3985 18.0547C13.219 18.0576 14.9684 17.3488 16.2735 16.0797L16.4235 15.9297V15.9297Z"
/>
</svg>
</label>
<input
type="text"
id="examples-search-input"
class="examples-search-term"
placeholder="Search examples"
/>
</div>
<div id="dropdown-area">
{{ render_use_cases_dropdown() }} {{ render_libraries_dropdown() }} {{
render_frameworks_dropdown() }} {{ render_contributor_dropdown() }}
</div>
<div id="no-matches" class="hidden">
<div id="no-matches-inner-content">
<svg
width="119"
height="119"
viewBox="0 0 119 119"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle
cx="59.5"
cy="59.5"
r="59.5"
fill="url(#paint0_linear_362_3841)"
fill-opacity="0.2"
/>
<path
d="M19.1665 6.66663C19.1665 5.8382 19.8381 5.16663 20.6665 5.16663H58.9165H78.0702C78.5301 5.16663 78.9647 5.37767 79.2491 5.73919L88.8648 17.9624L88.8658 17.9637L98.3484 30.0984C98.5545 30.3622 98.6665 30.6873 98.6665 31.0221V56V105.333C98.6665 106.162 97.9949 106.833 97.1665 106.833H20.6665C19.8381 106.833 19.1665 106.162 19.1665 105.333V6.66663Z"
fill="#FBFEFF"
stroke="#D0EAF9"
/>
<path
d="M77.485 29.4856C76.3051 29.4097 75.4482 28.3324 75.6397 27.1657L79.2591 5.11847C79.2874 4.94627 79.5072 4.89033 79.6143 5.02808L99.477 30.5658C99.5829 30.702 99.4784 30.8993 99.3063 30.8882L77.485 29.4856Z"
fill="#11608D"
/>
<rect
x="25.6665"
y="15.1666"
width="46.6667"
height="3.5"
rx="1.75"
fill="#D6EEFC"
/>
<rect
x="25.6665"
y="31.5"
width="46.6667"
height="3.5"
rx="1.75"
fill="#D6EEFC"
/>
<rect
x="25.6665"
y="23.3334"
width="16.3333"
height="3.5"
rx="1.75"
fill="#D6EEFC"
/>
<rect
x="25.6665"
y="39.6666"
width="16.3333"
height="3.5"
rx="1.75"
fill="#D6EEFC"
/>
<rect
x="45.5"
y="23.3334"
width="26.8333"
height="3.5"
rx="1.75"
fill="#D6EEFC"
/>
<rect
x="22.1665"
y="98"
width="30.3333"
height="3.5"
rx="1.75"
fill="#D6EEFC"
/>
<g clip-path="url(#clip0_362_3841)">
<path
d="M90.5158 91.8128L104.257 105.551L99.7173 110.091L85.9792 96.3494C80.8675 100.447 74.5094 102.676 67.958 102.667C52.019 102.667 39.083 89.7306 39.083 73.7916C39.083 57.8526 52.019 44.9166 67.958 44.9166C83.897 44.9166 96.833 57.8526 96.833 73.7916C96.8423 80.343 94.6135 86.7011 90.5158 91.8128ZM84.0799 89.4323C88.1516 85.245 90.4255 79.6322 90.4163 73.7916C90.4163 61.3818 80.3646 51.3333 67.958 51.3333C55.5482 51.3333 45.4997 61.3818 45.4997 73.7916C45.4997 86.1982 55.5482 96.25 67.958 96.25C73.7985 96.2592 79.4114 93.9852 83.5986 89.9135L84.0799 89.4323Z"
fill="#60ABD7"
/>
</g>
<ellipse
cx="61.8335"
cy="71.1667"
rx="3.5"
ry="4.66667"
fill="#60ABD7"
/>
<ellipse
cx="73.5"
cy="71.1667"
rx="3.5"
ry="4.66667"
fill="#60ABD7"
/>
<path
d="M60.6665 84.5834V84.5834C65.0731 82.3801 70.2599 82.3801 74.6665 84.5834V84.5834"
stroke="#60ABD7"
stroke-width="2"
/>
<defs>
<linearGradient
id="paint0_linear_362_3841"
x1="59.5"
y1="0"
x2="59.5"
y2="119"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#19B1E2" />
<stop offset="1" stop-color="#3D89E9" />
</linearGradient>
<clipPath id="clip0_362_3841">
<rect
width="77"
height="77"
fill="white"
transform="translate(32.6665 38.5)"
/>
</clipPath>
</defs>
</svg>
<h4>Sorry! We could not find an example matching that filter.</h4>
<a
id="new-example-issue-link"
href="https://github.com/ray-project/ray/issues/new?assignees=&labels=docs%2Ctriage&projects=&template=documentation-issue.yml&title=%5B%3CRay+component%3A+Core%7CRLlib%7Cetc...%3E%5D+"
>
<span id="new-example-issue-text">
Help us improve our examples by suggesting one. Tell us what example
you would like to have.
</span>
</a>
</div>
</div>
{{ render_example_gallery() }} {% endblock %}
</div>
</div>
+154
View File
@@ -0,0 +1,154 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "3efe505a",
"metadata": {},
"source": [
"(document-tag-to-refer-to)=\n",
"\n",
"# Creating an Example\n",
"\n",
"This is an example template file for writing Jupyter Notebooks in markdown, using MyST.\n",
"For more information on MyST notebooks, see the\n",
"[MyST-NB documentation](https://myst-nb.readthedocs.io/en/latest/index.html).\n",
"If you want to learn more about the MyST parser, see the\n",
"[MyST documentation](https://myst-parser.readthedocs.io/en/latest/).\n",
"\n",
"MyST is CommonMark compliant, so you can use plain markdown here.\n",
"In case you need to execute restructured text (rST) directives, you can use `{eval-rst}` to execute the code.\n",
"For instance, here's a note written in rST:\n",
"\n",
"```{eval-rst}\n",
".. note::\n",
"\n",
" A note written in reStructuredText.\n",
"```\n",
"\n",
"```{margin}\n",
"You can create margins with this syntax for smaller notes that don't make it into the main\n",
"text.\n",
"```\n",
"\n",
"You can also easily define footnotes.[^example]\n",
"\n",
"[^example]: This is a footnote.\n",
"\n",
"## Adding code cells"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6b6ccdcf",
"metadata": {},
"outputs": [],
"source": [
"import ray\n",
"import ray.rllib.agents.ppo as ppo\n",
"from ray import serve\n",
"\n",
"def train_ppo_model():\n",
" trainer = ppo.PPOTrainer(\n",
" config={\"framework\": \"torch\", \"num_workers\": 0},\n",
" env=\"CartPole-v0\",\n",
" )\n",
" # Train for one iteration\n",
" trainer.train()\n",
" trainer.save(\"/tmp/rllib_checkpoint\")\n",
" return \"/tmp/rllib_checkpoint/checkpoint_000001/checkpoint-1\"\n",
"\n",
"\n",
"checkpoint_path = train_ppo_model()"
]
},
{
"cell_type": "markdown",
"id": "c21b9968",
"metadata": {},
"source": [
"## Hiding and removing cells\n",
"\n",
"You can hide cells, so that they toggle when you click the cell header.\n",
"You can use different `:tags:` like `hide-cell`, `hide-input`, or `hide-output` to hide cell content,\n",
"and you can use `remove-cell`, `remove-input`, or `remove-output` to completely remove the cell when rendered.\n",
"Those cells still show up in the notebook itself."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "607e444a",
"metadata": {
"tags": [
"hide-cell"
]
},
"outputs": [],
"source": [
"# This can be useful if you don't want to clutter the page with details.\n",
"\n",
"import ray\n",
"import ray.rllib.agents.ppo as ppo\n",
"from ray import serve"
]
},
{
"cell_type": "markdown",
"id": "0f4c428c",
"metadata": {},
"source": [
":::{tip}\n",
"Here's a quick tip.\n",
":::\n",
"\n",
"\n",
":::{note}\n",
"And this is a note.\n",
":::\n",
"\n",
"The following cell doesn't render:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f008643b",
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"ray.shutdown()"
]
},
{
"cell_type": "markdown",
"id": "c206f666",
"metadata": {},
"source": [
"## Equations\n",
"\n",
"\\begin{equation}\n",
"\\frac {\\partial u}{\\partial x} + \\frac{\\partial v}{\\partial y} = - \\, \\frac{\\partial w}{\\partial z}\n",
"\\end{equation}\n",
"\n",
"\\begin{align*}\n",
"2x - 5y &= 8 \\\\\n",
"3x + 9y &= -12\n",
"\\end{align*}"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
+98
View File
@@ -0,0 +1,98 @@
---
jupytext:
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
(document-tag-to-refer-to)=
# Creating an Example
This is an example template file for writing Jupyter Notebooks in markdown, using MyST. For more information on MyST notebooks, see the [MyST-NB documentation](https://myst-nb.readthedocs.io/en/latest/index.html). If you want to learn more about the MyST parser, see the [MyST documentation](https://myst-parser.readthedocs.io/en/latest/).
MyST is CommonMark compliant, so you can use plain markdown here. In case you need to execute restructured text (rST) directives, you can use `{eval-rst}` to execute the code. For instance, here's a note written in rST:
```{eval-rst}
.. note::
A note written in reStructuredText.
```
```{margin}
You can create margins with this syntax for smaller notes that don't make it into the main
text.
```
You can also easily define footnotes.[^example]
[^example]: This is a footnote.
## Adding code cells
```{code-cell} python3
import ray
import ray.rllib.agents.ppo as ppo
from ray import serve
def train_ppo_model():
trainer = ppo.PPOTrainer(
config={"framework": "torch", "num_workers": 0},
env="CartPole-v0",
)
# Train for one iteration
trainer.train()
trainer.save("/tmp/rllib_checkpoint")
return "/tmp/rllib_checkpoint/checkpoint_000001/checkpoint-1"
checkpoint_path = train_ppo_model()
```
## Hiding and removing cells
You can hide cells, so that they toggle when you click the cell header. You can use different `:tags:` like `hide-cell`, `hide-input`, or `hide-output` to hide cell content, and you can use `remove-cell`, `remove-input`, or `remove-output` to completely remove the cell when rendered. Those cells still show up in the notebook itself.
```{code-cell} python3
:tags: [hide-cell]
# This can be useful if you don't want to clutter the page with details.
import ray
import ray.rllib.agents.ppo as ppo
from ray import serve
```
:::{tip}
Here's a quick tip.
:::
:::{note}
And this is a note.
:::
The following cell doesn't render:
```{code-cell} python3
:tags: [remove-cell]
ray.shutdown()
```
## Equations
\begin{equation}
\frac {\partial u}{\partial x} + \frac{\partial v}{\partial y} = - \, \frac{\partial w}{\partial z}
\end{equation}
\begin{align*}
2x - 5y &= 8 \\
3x + 9y &= -12
\end{align*}