set -x
MODEL_PATH=/root/workspace/CP-Zero/checkpoints
export VLLM_ATTENTION_BACKEND=XFORMERS
echo $LD_LIBRARY_PATH
python verl/trainer/main_ppo.py \
    algorithm.adv_estimator=grpo \
    data.train_files=/root/workspace/CP-Zero/data/openai_at_train.json \
    data.val_files=/root/workspace/CP-Zero/data/openai_at_valid.json \
    data.train_batch_size=7 \
    data.val_batch_size=8 \
    data.max_prompt_length=4096 \
    data.max_response_length=8192 \
    actor_rollout_ref.model.path=/root/workspace/models_hub/Qwen2.5-7B-Instruct-1M \
    actor_rollout_ref.actor.optim.lr=3e-7 \
    actor_rollout_ref.model.use_remove_padding=True \
    actor_rollout_ref.actor.ppo_mini_batch_size=256 \
    actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=80 \
    actor_rollout_ref.actor.use_kl_loss=True \
    actor_rollout_ref.actor.kl_loss_coef=0.001 \
    actor_rollout_ref.actor.kl_loss_type=low_var_kl \
    actor_rollout_ref.model.enable_gradient_checkpointing=True \
    actor_rollout_ref.actor.fsdp_config.param_offload=False \
    actor_rollout_ref.actor.fsdp_config.optimizer_offload=True \
    actor_rollout_ref.rollout.log_prob_micro_batch_size=160 \
    actor_rollout_ref.rollout.tensor_model_parallel_size=1 \
    actor_rollout_ref.rollout.temperature=1.0 \
    actor_rollout_ref.rollout.name=vllm \
    actor_rollout_ref.rollout.gpu_memory_utilization=0.9 \
    actor_rollout_ref.rollout.n=16 \
    actor_rollout_ref.ref.log_prob_micro_batch_size=160 \
    actor_rollout_ref.ref.fsdp_config.param_offload=False \
    reward_model.reward_manager="cpzero" \
    algorithm.kl_ctrl.kl_coef=0.0005 \
    trainer.critic_warmup=0 \
    trainer.logger=["console"] \
    trainer.project_name="CP-Zero" \
    trainer.experiment_name="Qwen-7B-Coder" \
    trainer.n_gpus_per_node=7 \
    trainer.nnodes=1 \
    trainer.default_local_dir=/root/workspace/CP-Zero/checkpoints \
    trainer.default_hdfs_dir=null \
    trainer.save_freq=500 \
    trainer.test_freq=50 \
    trainer.total_epochs=5 >grpo.log 2>grpo.err
