From 0b4c1cba9b7619b292687f381069f9a6244bf9e8 Mon Sep 17 00:00:00 2001 From: YuBaoku <49938469+EmmonsCurse@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:42:23 +0800 Subject: [PATCH] [CI] Change 21b ep4 to tp1_dp4 in 4_cards_tests (#6745) * [CI] Change 21b ep4 to tp1_dp4 in 4_cards_tests --- ...e_21b_ep4.py => test_ernie_21b_tp1_dp4.py} | 51 ++++++++++++++----- ...4_mtp.py => test_ernie_21b_tp1_dp4_mtp.py} | 48 ++++++++++++----- 2 files changed, 71 insertions(+), 28 deletions(-) rename tests/e2e/4cards_cases/{test_ernie_21b_ep4.py => test_ernie_21b_tp1_dp4.py} (91%) rename tests/e2e/4cards_cases/{test_ernie_21b_ep4_mtp.py => test_ernie_21b_tp1_dp4_mtp.py} (89%) diff --git a/tests/e2e/4cards_cases/test_ernie_21b_ep4.py b/tests/e2e/4cards_cases/test_ernie_21b_tp1_dp4.py similarity index 91% rename from tests/e2e/4cards_cases/test_ernie_21b_ep4.py rename to tests/e2e/4cards_cases/test_ernie_21b_tp1_dp4.py index 590249e184..4fb178d458 100644 --- a/tests/e2e/4cards_cases/test_ernie_21b_ep4.py +++ b/tests/e2e/4cards_cases/test_ernie_21b_tp1_dp4.py @@ -1,4 +1,4 @@ -# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,9 +50,17 @@ def setup_and_run_server(api_url): ports_to_add = [ FD_API_PORT + 1, + FD_API_PORT + 2, + FD_API_PORT + 3, FD_METRICS_PORT + 1, + FD_METRICS_PORT + 2, + FD_METRICS_PORT + 3, FD_CACHE_QUEUE_PORT + 1, + FD_CACHE_QUEUE_PORT + 2, + FD_CACHE_QUEUE_PORT + 3, FD_ENGINE_QUEUE_PORT + 1, + FD_ENGINE_QUEUE_PORT + 2, + FD_ENGINE_QUEUE_PORT + 3, ] for port in ports_to_add: @@ -77,22 +85,22 @@ def setup_and_run_server(api_url): "-m", "fastdeploy.entrypoints.openai.multi_api_server", "--num-servers", - "2", + "4", "--ports", - f"{FD_API_PORT},{FD_API_PORT + 1}", + f"{FD_API_PORT},{FD_API_PORT + 1},{FD_API_PORT + 2},{FD_API_PORT + 3}", "--metrics-ports", - f"{FD_METRICS_PORT},{FD_METRICS_PORT + 1}", + f"{FD_METRICS_PORT},{FD_METRICS_PORT + 1},{FD_METRICS_PORT + 2},{FD_METRICS_PORT + 3}", "--args", "--model", model_path, "--engine-worker-queue-port", - f"{FD_ENGINE_QUEUE_PORT},{FD_ENGINE_QUEUE_PORT + 1}", + f"{FD_ENGINE_QUEUE_PORT},{FD_ENGINE_QUEUE_PORT + 1},{FD_ENGINE_QUEUE_PORT + 2},{FD_ENGINE_QUEUE_PORT + 3}", "--cache-queue-port", - f"{FD_CACHE_QUEUE_PORT},{FD_CACHE_QUEUE_PORT + 1}", + f"{FD_CACHE_QUEUE_PORT},{FD_CACHE_QUEUE_PORT + 1},{FD_CACHE_QUEUE_PORT + 2},{FD_CACHE_QUEUE_PORT + 3}", "--tensor-parallel-size", - "2", + "1", "--data-parallel-size", - "2", + "4", "--max-model-len", "65536", "--max-num-seqs", @@ -328,12 +336,17 @@ def test_text_diff(api_url): base_path = os.getenv("MODEL_PATH") if base_path: - base_file = os.path.join(base_path, "21b_ep4_text_baseline_dev_0311.txt") + base_file = os.path.join(base_path, "21b_tp1_dp4_text_baseline.txt") else: - base_file = "21b_ep4_text_baseline_dev_0311.txt" + base_file = "21b_tp1_dp4_text_baseline.txt" + with open(base_file, "r", encoding="utf-8") as f: baseline = f.read() + if result != baseline: + with open("21b_tp1_dp4_text_tmp.txt", "w", encoding="utf-8") as f: + f.write(result) + assert result == baseline, f"Text mismatch with baseline\nresult: {result}\nbaseline: {baseline}" @@ -596,12 +609,17 @@ def test_non_stream_with_logprobs(api_url): base_path = os.getenv("MODEL_PATH") if base_path: - base_file = os.path.join(base_path, "21b_ep4_logprobs_non_stream_static_baseline_dev_0311.txt") + base_file = os.path.join(base_path, "21b_tp1_dp4_logprobs_non_stream_static_baseline.txt") else: - base_file = "21b_ep4_logprobs_non_stream_static_baseline_dev_0311.txt" + base_file = "21b_tp1_dp4_logprobs_non_stream_static_baseline.txt" + with open(base_file, "r", encoding="utf-8") as f: baseline = json.load(f) + if logprobs != baseline: + with open("21b_tp1_dp4_logprobs_non_stream_static_tmp.txt", "w", encoding="utf-8") as f: + f.write(json.dumps(logprobs, ensure_ascii=False, indent=2)) + assert logprobs == baseline @@ -629,10 +647,15 @@ def test_stream_with_logprobs(api_url): base_path = os.getenv("MODEL_PATH") if base_path: - base_file = os.path.join(base_path, "21b_ep4_logprobs_stream_static_baseline_dev_0311.txt") + base_file = os.path.join(base_path, "21b_tp1_dp4_logprobs_stream_static_baseline.txt") else: - base_file = "21b_ep4_logprobs_stream_static_baseline_dev_0311.txt" + base_file = "21b_tp1_dp4_logprobs_stream_static_baseline.txt" + with open(base_file, "r", encoding="utf-8") as f: baseline = json.load(f) + if logprobs != baseline: + with open("21b_tp1_dp4_logprobs_stream_static_tmp.txt", "w", encoding="utf-8") as f: + f.write(json.dumps(logprobs, ensure_ascii=False, indent=2)) + assert logprobs == baseline diff --git a/tests/e2e/4cards_cases/test_ernie_21b_ep4_mtp.py b/tests/e2e/4cards_cases/test_ernie_21b_tp1_dp4_mtp.py similarity index 89% rename from tests/e2e/4cards_cases/test_ernie_21b_ep4_mtp.py rename to tests/e2e/4cards_cases/test_ernie_21b_tp1_dp4_mtp.py index c71c4d62da..6e4e36f739 100644 --- a/tests/e2e/4cards_cases/test_ernie_21b_ep4_mtp.py +++ b/tests/e2e/4cards_cases/test_ernie_21b_tp1_dp4_mtp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,9 +50,17 @@ def setup_and_run_server(api_url): ports_to_add = [ FD_API_PORT + 1, + FD_API_PORT + 2, + FD_API_PORT + 3, FD_METRICS_PORT + 1, + FD_METRICS_PORT + 2, + FD_METRICS_PORT + 3, FD_CACHE_QUEUE_PORT + 1, + FD_CACHE_QUEUE_PORT + 2, + FD_CACHE_QUEUE_PORT + 3, FD_ENGINE_QUEUE_PORT + 1, + FD_ENGINE_QUEUE_PORT + 2, + FD_ENGINE_QUEUE_PORT + 3, ] for port in ports_to_add: @@ -79,22 +87,22 @@ def setup_and_run_server(api_url): "-m", "fastdeploy.entrypoints.openai.multi_api_server", "--num-servers", - "2", + "4", "--ports", - f"{FD_API_PORT},{FD_API_PORT + 1}", + f"{FD_API_PORT},{FD_API_PORT + 1},{FD_API_PORT + 2},{FD_API_PORT + 3}", "--metrics-ports", - f"{FD_METRICS_PORT},{FD_METRICS_PORT + 1}", + f"{FD_METRICS_PORT},{FD_METRICS_PORT + 1},{FD_METRICS_PORT + 2},{FD_METRICS_PORT + 3}", "--args", "--model", model_path, "--engine-worker-queue-port", - f"{FD_ENGINE_QUEUE_PORT},{FD_ENGINE_QUEUE_PORT + 1}", + f"{FD_ENGINE_QUEUE_PORT},{FD_ENGINE_QUEUE_PORT + 1},{FD_ENGINE_QUEUE_PORT + 2},{FD_ENGINE_QUEUE_PORT + 3}", "--cache-queue-port", - f"{FD_CACHE_QUEUE_PORT},{FD_CACHE_QUEUE_PORT + 1}", + f"{FD_CACHE_QUEUE_PORT},{FD_CACHE_QUEUE_PORT + 1},{FD_CACHE_QUEUE_PORT + 2},{FD_CACHE_QUEUE_PORT + 3}", "--tensor-parallel-size", - "2", + "1", "--data-parallel-size", - "2", + "4", "--max-model-len", "65536", "--max-num-seqs", @@ -337,13 +345,17 @@ def test_text_diff(api_url): base_path = os.getenv("MODEL_PATH") if base_path: - base_file = os.path.join(base_path, "21b_ep4_mtp_text_baseline_dev_0311.txt") + base_file = os.path.join(base_path, "21b_tp1_dp4_mtp_text_baseline.txt") else: - base_file = "21b_ep4_mtp_text_baseline_dev_0311.txt" + base_file = "21b_tp1_dp4_mtp_text_baseline.txt" with open(base_file, "r", encoding="utf-8") as f: baseline = f.read() + if result != baseline: + with open("21b_tp1_dp4_mtp_text_tmp.txt", "w", encoding="utf-8") as f: + f.write(result) + assert result == baseline, f"Text mismatch with baseline\nresult: {result}\nbaseline: {baseline}" @@ -504,13 +516,17 @@ def test_non_stream_with_logprobs(api_url): base_path = os.getenv("MODEL_PATH") if base_path: - base_file = os.path.join(base_path, "21b_ep4_mtp_logprobs_non_stream_static_baseline_dev_0311.txt") + base_file = os.path.join(base_path, "21b_tp1_dp4_mtp_logprobs_non_stream_static_baseline.txt") else: - base_file = "21b_ep4_mtp_logprobs_non_stream_static_baseline_dev_0311.txt" + base_file = "21b_tp1_dp4_mtp_logprobs_non_stream_static_baseline.txt" with open(base_file, "r", encoding="utf-8") as f: baseline = json.load(f) + if logprobs != baseline: + with open("21b_tp1_dp4_mtp_logprobs_non_stream_static_tmp.txt", "w", encoding="utf-8") as f: + f.write(json.dumps(logprobs, ensure_ascii=False, indent=2)) + assert logprobs == baseline @@ -539,11 +555,15 @@ def test_stream_with_logprobs(api_url): base_path = os.getenv("MODEL_PATH") if base_path: - base_file = os.path.join(base_path, "21b_ep4_mtp_logprobs_stream_static_baseline_dev_0311.txt") + base_file = os.path.join(base_path, "21b_tp1_dp4_mtp_logprobs_stream_static_baseline.txt") else: - base_file = "21b_ep4_mtp_logprobs_stream_static_baseline_dev_0311.txt" + base_file = "21b_tp1_dp4_mtp_logprobs_stream_static_baseline.txt" with open(base_file, "r", encoding="utf-8") as f: baseline = json.load(f) + if logprobs != baseline: + with open("21b_tp1_dp4_mtp_logprobs_stream_static_tmp.txt", "w", encoding="utf-8") as f: + f.write(json.dumps(logprobs, ensure_ascii=False, indent=2)) + assert logprobs == baseline