You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
TrainingKit
PPO training on the GSM8K dataset with veRL
Copy page
Download PDF
PPO training on the GSM8K dataset with veRL
Introduction​
This topic provides the algorithm engineering team with a solution for deploying a multi-node training environment based on Volcengine Kubernetes Engine (VKE) clusters by using distributed reinforcement learning (RL) frameworks (veRL+Ray) in RL training scenarios. This topic describes how to configure clusters, create PersistentVolumes (PVs), and deploy KubeRay and Ray clusters in detail. This topic provides the complete workflow of performing Proximal Policy Optimization (PPO) training on the GSM8K dataset, including dataset processing, task submission, and monitoring. For more details, see Quickstart: PPO training on GSM8K dataset.​
The training framework veRL used in this topic is short for Volcano Engine Reinforcement Learning for large language models (LLMs). It is an RL framework designed for LLMs on the cloud platform. It not only provides flexible, efficient, and scalable RL training, but also provides a framework named HybridEngine. This framework separates the control flow, which runs in a single process, from the computation flow, which runs in multiple distributed processes, and supports multiple computation backends, parallel policies for training and inference, and performance optimization technologies.​
Prerequisites​
Preparing materials​
Prepare the dataset and model files. For more details, see Quickstart: PPO training on GSM8K dataset.​
  • Download the Qwen2.5-0.5B-Instruct model to your on-premises computer.​
  • ​
    # You need to install git-lfs first, such as apt install git-lfs (Ubuntu), brew install git-lfs (MacOS)​
    git lfs install​
    git clone https://www.modelscope.cn/Qwen/Qwen2.5-0.5B-Instruct.git​
    ​
  • You need to locally download and preprocess the GSM8k dataset file in the configured veRL environment. For details, see Installation.​
  • ​
    git clone https://github.com/volcengine/verl​
    cd verl​
    python3 examples/data_preprocess/gsm8k.py --local_dir ~/data/gsm8k​
    ​
Uploading the model and dataset files​
  1. Create a Torch Object Storage (TOS) bucket.​
  1. Log in to the TOS console.​
  1. In the left navigation bar, click Buckets. On the page that appears, click Create bucket.​
  1. Specify the parameters of the TOS bucket and click Confirm to create the TOS bucket. For more parameter descriptions, see the official documentation of TOS.​
  1. Upload files. Go to the Objects page of the TOS bucket. Click Upload file and then click Select folder to upload the folders that contain the dataset and model files.​
Creating a VKE cluster​
When you create a cluster in VKE, take note of the configurations of the following parameters. For more details, see Creating clusters.​
​
Parameter​
Description​
Cluster configuration​
​
Kubernetes version​
Select v1.28 or later.​
Network model​
Select VPC-CNI.​
Node pool configuration​
​
Managed node pool​
Select Enable to enable the managed node pool.​
Instance type​
Select the GPU instance specification for the node pool based on task requirements. This topic takes ecs.gni3cl.11xlarge (44 vCPU, 240 GiB, NVIDIA L20*2) as an example.​
Number of nodes​
2​
Data volume​
Select ESSD and 1000 GiB.​
Addon configuration​
​
Platform functional addons​
Install the following add-ons in the cluster:​
  • nvidia-device-plugin: required for using GPUs​
  • prometheus-agent: the monitoring add-on of VMP, which collects and sends metrics of Kubernetes clusters to VMP​
  • apmplus-opentelemetry-collector: the add-on that collects and sends OpenTelemetry data and Prometheus metrics to APMPlus.​
  • apmplus-server-agent: the add-on that collects monitoring data from services and hosts, and sends the data to APMPlus​
  • csi-tos: required for mounting TOS​
​
Creating a PV and a PVC​
  1. Create a static TOS PV in the VKE cluster to achieve the TOS-based network storage capability for the VKE cluster. For details, see Using static TOS PVs.​
  • ​
    Parameter​
    Description​
    StorageClass type​
    Select TOS.​
    Access key​
    Click Create key, and configure the key. Set the AccessKey ID and AccessKey Secret parameters to the AccessKey ID and AccessKey secret of your Volcano Engine root user. For information on how to obtain an API access key, see API access key management.​
    Storage bucket​
    Select the created TOS bucket.​
    Subdirectory​
    Use the default/.​
    ​
  1. Create a PersistentVolumeClaim (PVC) and associate it with the PV created in the previous step.​
Procedure​
Deploy the kuberay-operator application​
  1. Log in to the VKE console.​
  1. In the left navigation bar, click Application center > Application template.​
  1. On the Application template page, find the kuberay-operator application template section and click Deploy.​
  1. On the Deploy application page, specify the parameters of kuberay-operator.​
  • ​
    Parameter​
    Description​
    Orchestration template​
    ​
    Application template​
    Select the Chart version of the application. We recommend that you select the latest version.​
    Parameter configuration​
    The configuration method varies based on the values.yaml file of each application template. For detailed descriptions, see the annotations in the values.yaml file.​
    Name​
    Specify the name of the application. The name must be unique within the same namespace.​
    Deployment environment​
    ​
    Cluster type​
    Select the cluster type where the application needs to be deployed. ​
    Cluster​
    Select the project and cluster where the application needs to be deployed. The project named default is selected by default. For details, see Project management.​
    Namespace​
    Select a namespace for the target cluster.​
    ​
  1. Click Confirm to deploy the application. The deployed application will be displayed on the Helm page. You can go to the details page of the application to view the basic information, associated workloads, services, and other resources of the application.​
Deploying a Ray cluster​
  1. Modify the content of the following YAML file based on your business requirements.​
  • Modify the containers.image mirror addresses in headGroupSpec and workerGroupSpecs according to the business location.​
  • ​
    China (Beijing)
    China (Shanghai)
    China (Guangzhou)
    Asia Pacific (Johor)
    ​
    ​
    vke-cn-beijing.cr.volces.com/vke/verl:ngc-th2.6.0-cu126-vllm0.8.4-flashinfer0.2.2-cxx11abi0-custom-v1​
    ​
    ​
  • Modify resource configurations for head and worker instances in the YAML file based on the node specifications. Set the nvidia.com/gpu parameter to the number of GPUs on the node. We recommend that you allocate CPUs and memory as much as possible while reserving some resources for other system add-ons. For example, allocate 80% of the node resources. Set the requests and limits parameters to the same values.​
  • Set the persistentVolumeClaim.claimName parameter to the name of the created PVC.​
  • The tracing-startup-hook parameter of the rayStartParams parameter is required for starting in-depth observability. The startup script is already provided in /workspace/verl/tracing/setup_tracing.py. You only need to perform the following steps to start in-depth observability. The sample code already includes the following configurations and can be directly used.​
  • Add tracing-startup-hook: "tracing.setup_tracing:setup_tracing" to the startup command.​
  • Configure the environment variable PYTHONPATH=/workspace/verl to start in-depth observability. The data will be automatically reported to APMPlus.​
  • Add the annotation instrumentation.apmplus.volcengine.com/inject-python:"true" to worker and header instances.​
  • To reduce system consumption, you need to configure the environment variable OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=system_metrics.​
​
apiVersion: ray.io/v1​
kind: RayCluster​
metadata:​
name: raycluster-kuberay​
namespace: default​
spec:​
headGroupSpec:​
serviceType: ClusterIP​
rayStartParams:​
dashboard-host: "0.0.0.0"​
tracing-startup-hook: "tracing.setup_tracing:setup_tracing"​
template:​
metadata:​
annotations:​
instrumentation.apmplus.volcengine.com/inject-python: "true"​
spec:​
containers:​
- name: ray-head​
image: ai-containers-cn-beijing.cr.volces.com/deeplearning/verl:ngc-th2.6.0-cu126-vllm0.8.4-flashinfer0.2.2-cxx11abi0-custom-v1​
imagePullPolicy: IfNotPresent​
resources:​
limits:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
requests:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
volumeMounts:​
- name: log-volume​
mountPath: /tmp/ray​
- name: tos-pv​
mountPath: /data​
env: ​
- name: PYTHONPATH​
value: /workspace/verl​
- name: OTEL_PYTHON_DISABLED_INSTRUMENTATIONS​
value: system_metrics​
volumes:​
- name: log-volume​
emptyDir: {}​
- name: tos-pv​
persistentVolumeClaim:​
claimName: verl-pvc​
​
workerGroupSpecs:​
- groupName: workergroup​
replicas: 1​
minReplicas: 1​
maxReplicas: 3​
rayStartParams: {}​
template:​
metadata:​
annotations:​
instrumentation.apmplus.volcengine.com/inject-python: "true"​
spec:​
containers:​
- name: ray-worker​
image: ai-containers-cn-beijing.cr.volces.com/deeplearning/verl:ngc-th2.6.0-cu126-vllm0.8.4-flashinfer0.2.2-cxx11abi0-custom-v1​
imagePullPolicy: IfNotPresent​
resources:​
limits:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
requests:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
volumeMounts:​
- name: log-volume​
mountPath: /tmp/ray​
- name: tos-pv​
mountPath: /data​
env: ​
- name: PYTHONPATH​
value: /workspace/verl​
- name: OTEL_PYTHON_DISABLED_INSTRUMENTATIONS​
value: system_metrics​
volumes:​
- name: log-volume​
emptyDir: {}​
- name: tos-pv​
persistentVolumeClaim:​
claimName: verl-pvc​
​
​
  1. Log in to the VKE console. Click the name of the target cluster to go to the cluster management page.​
  1. In the left navigation bar, click Workload > Resource Explorer.​
  1. Click Create with Yaml. On the Create with Yaml page, select Custom from the Type list. Enter the content of the modified YAML file and then click Confirm. By default, the resource explorer is deployed in the namespace named default.​
Checking running status​
In the left navigation bar, click Workload > Pod to view the status of the head and worker pods, which are respectively named raycluster-kuberay-head-xxxx and raycluster-kuberay-workergroup-worker-xxxx. When Running is displayed in the Status column, it indicates that the pods are started, which takes a long period of time.​
Running a training task​
Submitting a training task​
  1. In the left navigation bar, click Workload > Pod. Click the name of raycluster-kuberay-head-xxxx, and then click Console in the upper-right corner to go to the console of the pod.​
  1. Enter the following command in the console to navigate to the verl directory and submit the training task.​
​
cd /workspace/verl​
ray job submit --address="http://127.0.0.1:8265" \​
--runtime-env=verl/trainer/runtime_env.yaml \​
--no-wait \​
-- \​
python3 -m verl.trainer.main_ppo \​
data.train_files=/data/data/gsm8k/train.parquet \​
data.val_files=/data/data/gsm8k/test.parquet \​
data.train_batch_size=256 \​
data.max_prompt_length=512 \​
data.max_response_length=256 \​
actor_rollout_ref.model.path=/data/Qwen2.5-0.5B-Instruct \​
actor_rollout_ref.actor.optim.lr=1e-6 \​
actor_rollout_ref.actor.ppo_mini_batch_size=64 \​
actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=4 \​
actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=8 \​
actor_rollout_ref.rollout.tensor_model_parallel_size=1 \​
actor_rollout_ref.rollout.gpu_memory_utilization=0.4 \​
actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4 \​
critic.optim.lr=1e-5 \​
critic.model.path=/data/Qwen2.5-0.5B-Instruct \​
critic.ppo_micro_batch_size_per_gpu=4 \​
algorithm.kl_ctrl.kl_coef=0.001 \​
trainer.logger=['console'] \​
trainer.default_hdfs_dir=null \​
trainer.n_gpus_per_node=2 \​
trainer.nnodes=2 \​
trainer.save_freq=10 \​
trainer.test_freq=10 \​
trainer.total_epochs=15​
​
​​​
The following figure shows the expected output after the training task is submitted.​
​​​
Viewing training job status​
Create an Ingress to expose the Ray dashboard service.​
  1. In the left navigation bar, click Services and Ingresses > Ingress, and click Create Ingress to configure an Ingress.​
  • ​
    Parameter​
    Description​
    Ingress type​
    Select Application Load Balancer (ALB).​
    Protocol​
    Select HTTP.​
    Path​
    Enter a slash (/).​
    Service​
    Select raycluster-kuberay-head-xxxxxx and 8265.​
    ​
  1. After the ALB Ingress is created, enter the virtual IP address (VIP) of the Ingress in the browser address bar to access the dashboard, on which you can view training task logs and cluster status.​
  • ​alt​​
By default, the trained checkpoints are saved in the /tmp/ray/session_xxxxx/runtime_resources/working_dir_files/_ray_pkg_xxxxx/checkpoints/verl_examples/gsm8k directory of the raycluster-kuberay-head-xxxx pod.​
​​​
Enabling observability​
Basic observability​
Enabling observability​
  1. Log in to the VKE console.​
  1. In the left navigation bar of the management page for the target cluster, click Cloud native observability > Overview, and then enable cloud native observability and container monitoring based on the prompt on the page. You need to perform the following steps:​
  • Enable cloud native observability.​
  • Bind a VMP workspace.​
  • Install the prometheus-agent add-on.​
tip​
For more configuration details, see Enabling observability.​
  1. Create collection configurations.​
First, check whether Ray PodMonitors are already created in the cluster. If not, create one.​
Confirmation method: In the left navigation bar of the cluster management page, click Workload > Resource Explorer. On the page that appears, search for podmonitor. Click the name of the target PodMonitor to check whether Ray-related collection configurations exist.​
tip​
You still need to verify that the label volcengine.vmp: "true" is added to the preceding two PodMonitors resources even if you have created PodMonitors. If the label does not exist, prometheus-agent cannot identify the resources and thus cannot collect metrics.​
If Ray PodMonitors are not created in the cluster, perform the following steps to create Ray PodMonitors.​
  1. In the left navigation bar of the cluster management page, click Workload > Resource Explorer.​
  1. Click Create with Yaml. Copy the following code to create the corresponding PodMonitor.​
  • PodMonitor configuration for collecting head node metrics​
  • ​
    apiVersion: monitoring.coreos.com/v1​
    kind: PodMonitor​
    metadata:​
    labels:​
    volcengine.vmp: "true"​
    name: ray-head-monitor​
    namespace: default​
    spec:​
    jobLabel: ray-head​
    # Only select Kubernetes Pods in the "default" namespace.​
    namespaceSelector:​
    matchNames:​
    - default​
    # Only select Kubernetes Pods with "matchLabels".​
    selector:​
    matchLabels:​
    ray.io/node-type: head​
    # A list of endpoints allowed as part of this PodMonitor.​
    podMetricsEndpoints:​
    - port: metrics​
    relabelings:​
    - action: replace​
    sourceLabels:​
    - __meta_kubernetes_pod_label_ray_io_cluster​
    targetLabel: ray_io_cluster​
    - port: as-metrics # autoscaler metrics​
    relabelings:​
    - action: replace​
    sourceLabels:​
    - __meta_kubernetes_pod_label_ray_io_cluster​
    targetLabel: ray_io_cluster​
    - port: dash-metrics # dashboard metrics​
    relabelings:​
    - action: replace​
    sourceLabels:​
    - __meta_kubernetes_pod_label_ray_io_cluster​
    targetLabel: ray_io_cluster​
    ​
  • PodMonitor configuration for collecting worker node metrics​
  • ​
    apiVersion: monitoring.coreos.com/v1​
    kind: PodMonitor​
    metadata:​
    name: ray-workers-monitor​
    namespace: default​
    labels:​
    volcengine.vmp: "true"​
    spec:​
    jobLabel: ray-workers​
    # Only select Kubernetes Pods in the "default" namespace.​
    namespaceSelector:​
    matchNames:​
    - default​
    # Only select Kubernetes Pods with "matchLabels".​
    selector:​
    matchLabels:​
    ray.io/node-type: worker​
    # A list of endpoints allowed as part of this PodMonitor.​
    podMetricsEndpoints:​
    - port: metrics​
    relabelings:​
    - sourceLabels: [__meta_kubernetes_pod_label_ray_io_cluster]​
    targetLabel: ray_io_cluster​
    ​
tip​
Take note of and modify the following parameters:​
  • namespace: The namespace where the PodMonitor resides. Theoretically, the PodMonitor can be created in any namespace.​
  • namespaceSelector: Select a namespace of which Ray cluster pods are to be matched. Enter the namespace where Ray is located.​
Viewing the monitoring dashboard​
After a collection rule is configured, metrics related to Ray will be collected and stored in VMP workspaces. You can use the Explore feature of VMP to query the corresponding metrics.​
You can use the preset dashboard of VMP to view Ray metrics. To view Ray metrics, you need to apply to add your account to the allowlist.​
  1. Log in to the VMP console.​
  1. Click Monitor dashboard in the left navigation bar. Search for ray to view Ray-related dashboards.​
You can also install Grafana to view Ray monitoring charts.​
  1. Install the Grafana service in the VKE cluster. For details, see Deploying Grafana in a VKE cluster and integrating Grafana with a workspace.​
  1. Log in to your self-managed Grafana and import the following dashboard.​
  • ​
    ​
    ray_default_dashboard.json
    ​
    ​
  1. Select VMP as the data source for importing.​
  • ​​​
  • The following figure shows the result after importing.​
  • ​​​
  • ​​​
In-depth observability​
Enabling observability configuration​
  1. Deploy the APMPlus observability add-on.​
  • In the left navigation bar of the VKE cluster management page, click Addons. On the page that appears, click the Monitoring tab. Find the apmplus-opentelemetry-collector and apmplus-server-agent add-ons and install them. The following figure shows the result after the add-ons are installed. Verify that both add-ons are installed and that no error messages appear.​
  1. Enable in-depth observability. Add the following annotation to Ray-related instances.​
  • ​
    key​
    value​
    instrumentation.apmplus.volcengine.com/inject-python​
    true​
    ​
In the deployment YAML file of the Ray cluster, add the following configuration. The preceding sample one already includes the following configurations and can be directly used.​
​
apiVersion: ray.io/v1​
kind: RayCluster​
metadata:​
creationTimestamp: "2025-05-23T05:23:37Z"​
generation: 2​
name: raycluster-kuberay​
namespace: default​
resourceVersion: "52584"​
uid: cdb81f16-e53d-481f-9426-5db7f93155b5​
spec:​
headGroupSpec:​
rayStartParams:​
dashboard-host: 0.0.0.0​
tracing-startup-hook: ray.util.tracing.setup_local_tmp_tracing:setup_tracing​
serviceType: ClusterIP​
template:​
metadata:​
annotations:​
instrumentation.apmplus.volcengine.com/inject-python: "true"​
spec:​
containers:​
- env: ​
- name: OTEL_PYTHON_DISABLED_INSTRUMENTATIONS​
value: system_metrics​
- image: cr-helm-test-cn-beijing.cr.volces.com/cr-helm-test/verl:ngc-th2.6.0-cu126-vllm0.8.4-flashinfer0.2.2-cxx11abi0-custom-v1​
imagePullPolicy: IfNotPresent​
name: ray-head​
resources:​
limits:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
requests:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
volumeMounts:​
- mountPath: /tmp/ray​
name: log-volume​
- mountPath: /data​
name: tos-pv​
volumes:​
- emptyDir: {}​
name: log-volume​
- name: tos-pv​
persistentVolumeClaim:​
claimName: verl-pvc​
workerGroupSpecs:​
- groupName: workergroup​
maxReplicas: 3​
minReplicas: 1​
numOfHosts: 1​
rayStartParams: {}​
replicas: 1​
template:​
metadata:​
annotations:​
instrumentation.apmplus.volcengine.com/inject-python: "true"​
spec:​
containers:​
- env: ​
- name: OTEL_PYTHON_DISABLED_INSTRUMENTATIONS​
value: system_metrics​
- image: cr-helm-test-cn-beijing.cr.volces.com/cr-helm-test/verl:ngc-th2.6.0-cu126-vllm0.8.4-flashinfer0.2.2-cxx11abi0-custom-v1​
imagePullPolicy: IfNotPresent​
name: ray-worker​
resources:​
limits:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
requests:​
cpu: "30"​
memory: 100Gi​
nvidia.com/gpu: 2​
volumeMounts:​
- mountPath: /tmp/ray​
name: log-volume​
- mountPath: /data​
name: tos-pv​
volumes:​
- emptyDir: {}​
name: log-volume​
- name: tos-pv​
persistentVolumeClaim:​
claimName: verl-pvc​
status:​
availableWorkerReplicas: 1​
conditions:​
- lastTransitionTime: "2025-05-23T07:23:08Z"​
message: ""​
reason: HeadPodRunningAndReady​
status: "True"​
type: HeadPodReady​
- lastTransitionTime: "2025-05-23T05:29:39Z"​
message: All Ray Pods are ready for the first time​
reason: AllPodRunningAndReadyFirstTime​
status: "True"​
type: RayClusterProvisioned​
- lastTransitionTime: "2025-05-23T05:23:37Z"​
message: ""​
reason: RayClusterSuspended​
status: "False"​
type: RayClusterSuspended​
- lastTransitionTime: "2025-05-23T05:23:37Z"​
message: ""​
reason: RayClusterSuspending​
status: "False"​
type: RayClusterSuspending​
desiredCPU: "60"​
desiredGPU: "4"​
desiredMemory: 200Gi​
desiredTPU: "0"​
desiredWorkerReplicas: 1​
endpoints:​
client: "10001"​
dashboard: "8265"​
gcs-server: "6379"​
metrics: "8080"​
serve: "8000"​
head:​
podIP: 192.168.5.38​
podName: raycluster-kuberay-head-wcrb7​
serviceIP: 192.168.5.38​
serviceName: raycluster-kuberay-head-svc​
lastUpdateTime: "2025-05-23T07:23:24Z"​
maxWorkerReplicas: 3​
minWorkerReplicas: 1​
observedGeneration: 2​
readyWorkerReplicas: 1​
state: ready​
stateTransitionTimes:​
ready: "2025-05-23T05:29:39Z"​
​
​
  1. Configure Ray tracing.​
  • To enable the tracing feature, you need to provide a tracing startup script that includes a function for configuring the tracing provider and span processor. This function has no input parameters and must be available in the Python environment of all worker processes.​
  • The following sample code shows how to send tracing data to the server based on environment variable configurations. After the apmplus-opentelemetry-collector and apmplus-server-agent add-ons are installed, the environment variable will be set to apmplus-opentelemetry-collector. The code is automatically included in the image.​
​
import ray​
import logging​
from opentelemetry import trace​
from opentelemetry.sdk.trace import TracerProvider​
from opentelemetry.sdk.trace.export import (​
BatchSpanProcessor,​
)​
from opentelemetry.exporter.otlp.proto.http.trace_exporter import (​
OTLPSpanExporter as HTTPExporter,​
)​
​
def setup_tracing() -> None:​
logging.warning("setup_tracing")​
trace.set_tracer_provider(TracerProvider())​
trace.get_tracer_provider().add_span_processor(​
BatchSpanProcessor(​
HTTPExporter()​
)​
)​
​
Add the following parameters to rayStartParams in the YAML file of the Ray cluster.​
​
spec:​
headGroupSpec:​
serviceType: ClusterIP​
rayStartParams:​
dashboard-host: "0.0.0.0"​
tracing-startup-hook: "tracing.setup_tracing:setup_tracing"​
template:​
​
Viewing Observability data​
After you enable the observability configuration, the generated tracing data will be sent to APMPlus. In the left-side navigation bar in the APMPlus console, click Server-side Monitoring to view the ray-worker and ray-header services.​
Click the service name to go to the observability dashboard page.​
  • On the Service overview tab, you can view the key metrics of the service, such as QPS and request error rate.​
  • On the Trace analysis tab, you can view the reported tracing data. Click the ID of the target trace to go to the details page of the trace. On the List tab, you can view the details of the trace.​
Deploying and connecting to wandb​
Weights & Biases (wandb) is a platform for tracking and managing machine learning experiments. It is designed to help data scientists and machine learning engineers develop, optimize, and deploy models more efficiently. It provides a set of streamlined tools. These tools automatically record key metrics during experiments, visualize results, manage code versions and datasets, and support team collaboration.​
This section describes how to deploy the local version of wandb in the preceding clusters and how to push veRL training metrics to wandb.​
Preparing an image​
Prepare a wandb local image. Two solutions are provided in the Chinese mainland, where Docker Hub may be inaccessible.​
  1. First, pull the image to your on-premises computer. Then, push the image to your Container Registry (CR) instance. For specific steps, see Pushing and Pulling Images Using Docker.​
Creating a FileNAS file system​
  1. Log in to FileNAS console.​
  1. In the top navigation bar, select the region for which you want to create a file system.​
  1. In the left navigation bar, click File System > File System list. On the File System list page, click Create File System. For detailed parameter descriptions, see Creating a file system.​
  1. Click the name of the created file system to go to the details page of the file system. Click the Mount Target tab, and then click Create Mount Target. Select the Virtual Private Cloud (VPC) where the VKE cluster is located from the Private network list.​
  1. Go to the management page of the VKE cluster. Create a PV for the cluster. When you create the PV, select the created FileNAS file system and mount point.​
  1. Create a PVC and associate it with the created PV.​
Deploying wandb local​
  1. Deploy wandb local​
  1. Modify the content of the following YAML file to modify the wandb local image address and PVC name based on your business requirements.​
  • ​
    apiVersion: apps/v1​
    kind: Deployment​
    metadata:​
    name: wandb​
    labels:​
    app: wandb​
    spec:​
    strategy:​
    type: RollingUpdate​
    replicas: 1​
    selector:​
    matchLabels:​
    app: wandb​
    template:​
    metadata:​
    labels:​
    app: wandb​
    spec:​
    initContainers:​
    - name: init-permissions​
    image: cr-helm-test-cn-beijing.cr.volces.com/cr-helm-test/wandb-local:0.68.2​
    command: ["sh", "-c", "chmod 777 /vol"]​
    securityContext:​
    runAsUser: 0​
    volumeMounts:​
    - name: wandb-pv​
    mountPath: /vol​
    containers:​
    - name: wandb​
    imagePullPolicy: IfNotPresent​
    image: cr-helm-test-cn-beijing.cr.volces.com/cr-helm-test/wandb-local:0.68.2​
    ports:​
    - name: http​
    containerPort: 8080​
    protocol: TCP​
    volumeMounts:​
    - name: wandb-pv​
    mountPath: /vol​
    livenessProbe:​
    httpGet:​
    path: /healthz​
    port: http​
    readinessProbe:​
    httpGet:​
    path: /ready​
    port: http​
    resources:​
    requests:​
    cpu: "2000m"​
    memory: 4G​
    limits:​
    cpu: "4000m"​
    memory: 8G​
    volumes:​
    - name: wandb-pv​
    persistentVolumeClaim:​
    claimName: wandb-pvc​
    ---​
    apiVersion: v1​
    kind: Service​
    metadata:​
    name: wandb-service​
    spec:​
    type: ClusterIP​
    selector:​
    app: wandb​
    ports:​
    - protocol: TCP​
    port: 8080​
    targetPort: 8080​
    ​
  1. Log in to the VKE console. In the left navigation bar, click Cluster. Then, click the name of the target cluster to go to the cluster management page.​
  1. In the left navigation bar, click Workload > Resource Explorer.​
  1. Click Create with Yaml. On the Create with Yaml page, select Custom from the Type list. Enter the content of the modified YAML file and then click Confirm in the lower-right corner of the page. By default, the resource explorer is deployed in the default namespace.​
  1. Create an Ingress to expose the wandb service.​
  1. In the left navigation bar of the cluster management page, click Services and Ingresses > Ingress. On the page that appears, click Create Ingress.​
  1. Take note of the configurations of the following parameters. For more details, see Creating an ALB Ingress in the console.​
  • ​
    Parameter​
    Description​
    Ingress type​
    Select Application Load Balancer (ALB).​
    Protocol​
    Select HTTP.​
    Path​
    Enter a slash (/).​
    Service​
    Select wandb-service and 8080.​
    ​
  1. After the Ingress is created, enter the VIP of the Ingress in the browser address bar to go to the wandb management page.​
wandb configuration​
  1. Go to the wandb management page and create an account. You will need to use your email and password for login. Please remember them.​
  • ​​​
  1. Configure the license. If you do not have a license, you can apply for a free license based on prompts.​
  • ​​​
  • ​​​
  1. Return to the Home page to view the API key.​
  • ​​​
  1. Create a project.​
  • ​​​
veRL configuration​
  1. Go to the head pod console based on the instructions in the Submit a training task section of this topic. Edit the content of the verl/trainer/runtime_env.yaml file by using vim or nano before you submit the task. Add the WANDB_BASE_URL and WANDB_API_KEY parameters. Set the WANDB_API_KEY parameter to your API key.​
​
working_dir: ./​
excludes: ["/.git/"]​
env_vars:​
TORCH_NCCL_AVOID_RECORD_STREAMS: "1"​
# If you are using vllm<=0.6.3, you might need to set the following environment variable to avoid bugs:​
# VLLM_ATTENTION_BACKEND: "XFORMERS"​
WANDB_BASE_URL: "http://wandb-service:8080"​
WANDB_API_KEY: "local-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"​
​
  1. Add or modify the following content for the task submission command, and then submit the task.​
  • Add 'wandb' to trainer.logger.​
  • Set trainer.project_name to the project name that was created in wandb.​
  • Set trainer.experiment_name to an experiment name.​
​
ray job submit --address="http://127.0.0.1:8265" \​
--runtime-env=verl/trainer/runtime_env.yaml \​
--no-wait \​
-- \​
python3 -m verl.trainer.main_ppo \​
data.train_files=/data/data/gsm8k/train.parquet \​
data.val_files=/data/data/gsm8k/test.parquet \​
data.train_batch_size=256 \​
data.max_prompt_length=512 \​
data.max_response_length=256 \​
actor_rollout_ref.model.path=/data/Qwen2.5-0.5B-Instruct \​
actor_rollout_ref.actor.optim.lr=1e-6 \​
actor_rollout_ref.actor.ppo_mini_batch_size=64 \​
actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=4 \​
actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=8 \​
actor_rollout_ref.rollout.tensor_model_parallel_size=1 \​
actor_rollout_ref.rollout.gpu_memory_utilization=0.4 \​
actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4 \​
critic.optim.lr=1e-5 \​
critic.model.path=/data/Qwen2.5-0.5B-Instruct \​
critic.ppo_micro_batch_size_per_gpu=4 \​
algorithm.kl_ctrl.kl_coef=0.001 \​
trainer.default_hdfs_dir=null \​
trainer.n_gpus_per_node=2 \​
trainer.nnodes=2 \​
trainer.save_freq=10 \​
trainer.test_freq=10 \​
trainer.total_epochs=15 \​
trainer.logger=['console','wandb'] \​
trainer.project_name='verl_example_gsm8k' \​
trainer.experiment_name='experiment1'​
​
  1. After you complete the preceding configuration, you can view metric data during training on the wandb monitoring page.​
​​​
​
Last updated: 2026.10.16 17:40:20