已关闭
[ignore] [ci-test] Testcases for patch names #66
hanboyou创建于 2025年12月12日关闭于 2025年12月24日
[ignore] [ci-test] Testcases for patch names #66
已关闭
共 9 个文件变更+182-0
| @@ -0,0 +1,37 @@ | |||
| 1 | +From dc8e024b47ed2bb91fe950f190f4abb985c935d9 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: caojingyi <caojingyi@noreply.gitcode.com> | ||
| 3 | +Date: Wed, 12 Nov 2025 15:24:26 +0800 | ||
| 4 | +Subject: [PATCH 12/18] Update vllm: kv_cache_configs | ||
| 5 | +KV cache requires multiple initializations during training to achieve offloading. | ||
| 6 | +This patch makes the `kv_cache_configs` retrievable, ensuring that every reinitialization uses | ||
| 7 | +the exact config from the initial allocation, thereby guaranteeing memory layout consistency. | ||
| 8 | +--- | ||
| 9 | + llm_rl/qwen3/vllm/v1/engine/core.py | 6 +++--- | ||
| 10 | + 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 11 | + | ||
| 12 | +diff --git a/llm_rl/qwen3/vllm/v1/engine/core.py b/llm_rl/qwen3/vllm/v1/engine/core.py | ||
| 13 | +index a43042a..47361ae 100644 | ||
| 14 | +--- a/llm_rl/qwen3/vllm/v1/engine/core.py | ||
| 15 | ++++ b/llm_rl/qwen3/vllm/v1/engine/core.py | ||
| 16 | + class EngineCore: | ||
| 17 | + | ||
| 18 | + assert len(kv_cache_specs) == len(available_gpu_memory) | ||
| 19 | + | ||
| 20 | +- kv_cache_configs = get_kv_cache_configs(vllm_config, kv_cache_specs, | ||
| 21 | ++ self.kv_cache_configs = get_kv_cache_configs(vllm_config, kv_cache_specs, | ||
| 22 | + available_gpu_memory) | ||
| 23 | + scheduler_kv_cache_config = generate_scheduler_kv_cache_config( | ||
| 24 | +- kv_cache_configs) | ||
| 25 | ++ self.kv_cache_configs) | ||
| 26 | + num_gpu_blocks = scheduler_kv_cache_config.num_blocks | ||
| 27 | + num_cpu_blocks = 0 | ||
| 28 | + | ||
| 29 | + # Initialize kv cache and warmup the execution | ||
| 30 | +- self.model_executor.initialize_from_config(kv_cache_configs) | ||
| 31 | ++ self.model_executor.initialize_from_config(self.kv_cache_configs) | ||
| 32 | + | ||
| 33 | + elapsed = time.time() - start | ||
| 34 | + logger.info(("init engine (profile, create kv cache, " | ||
| 35 | +-- | ||
| 36 | +2.50.1.windows.1 | ||
| 37 | + | ||
| @@ -0,0 +1,37 @@ | |||
| 1 | +From 233fadd6ac6259494429fe104f66c49a90ddaaf9 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: qushiyi <qushiyi@huawei.com> | ||
| 3 | +Date: Wed, 26 Nov 2025 18:19:26 +0800 | ||
| 4 | +Subject: [PATCH] megatron-feature-enable_hdp | ||
| 5 | + | ||
| 6 | +--- | ||
| 7 | + .../megatron/core/models/common/embeddings/rope_utils.py | 7 +++++++ | ||
| 8 | + 1 file changed, 7 insertions(+) | ||
| 9 | + | ||
| 10 | +diff --git a/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py b/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py | ||
| 11 | +index 08c9457..b38a6ca 100644 | ||
| 12 | +--- a/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py | ||
| 13 | ++++ b/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py | ||
| 14 | + try: | ||
| 15 | + except ImportError: | ||
| 16 | + apply_rotary_emb_flash = None | ||
| 17 | + | ||
| 18 | ++from patches.verl.utils.hybrid_data_parallel.utils import set_batch_hdp_group, get_batch_hdp_group | ||
| 19 | ++ | ||
| 20 | + | ||
| 21 | + __all__ = ['apply_rotary_emb_flash'] | ||
| 22 | + | ||
| 23 | + def _apply_rotary_pos_emb_thd( | ||
| 24 | + | ||
| 25 | + cp_size = parallel_state.get_context_parallel_world_size() | ||
| 26 | + cp_rank = parallel_state.get_context_parallel_rank() | ||
| 27 | ++ batch_hdp_group = get_batch_hdp_group() | ||
| 28 | ++ if batch_hdp_group is not None: | ||
| 29 | ++ hdp_group = next(group for group in batch_hdp_group if cp_rank in group) | ||
| 30 | ++ cp_size = len(hdp_group) | ||
| 31 | ++ cp_rank = hdp_group.index(cp_rank) | ||
| 32 | + cu_seqlens = cu_seqlens // cp_size | ||
| 33 | + seqlens = (cu_seqlens[1:] - cu_seqlens[:-1]).tolist() | ||
| 34 | + | ||
| 35 | +-- | ||
| 36 | +2.50.1.windows.1 | ||
| 37 | + | ||
| @@ -0,0 +1,37 @@ | |||
| 1 | +From 233fadd6ac6259494429fe104f66c49a90ddaaf9 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: qushiyi <qushiyi@huawei.com> | ||
| 3 | +Date: Wed, 26 Nov 2025 18:19:26 +0800 | ||
| 4 | +Subject: [PATCH] megatron-feature-enable_hdp | ||
| 5 | + | ||
| 6 | +--- | ||
| 7 | + .../megatron/core/models/common/embeddings/rope_utils.py | 7 +++++++ | ||
| 8 | + 1 file changed, 7 insertions(+) | ||
| 9 | + | ||
| 10 | +diff --git a/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py b/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py | ||
| 11 | +index 08c9457..b38a6ca 100644 | ||
| 12 | +--- a/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py | ||
| 13 | ++++ b/llm_rl/qwen3/megatron/core/models/common/embeddings/rope_utils.py | ||
| 14 | + try: | ||
| 15 | + except ImportError: | ||
| 16 | + apply_rotary_emb_flash = None | ||
| 17 | + | ||
| 18 | ++from patches.verl.utils.hybrid_data_parallel.utils import set_batch_hdp_group, get_batch_hdp_group | ||
| 19 | ++ | ||
| 20 | + | ||
| 21 | + __all__ = ['apply_rotary_emb_flash'] | ||
| 22 | + | ||
| 23 | + def _apply_rotary_pos_emb_thd( | ||
| 24 | + | ||
| 25 | + cp_size = parallel_state.get_context_parallel_world_size() | ||
| 26 | + cp_rank = parallel_state.get_context_parallel_rank() | ||
| 27 | ++ batch_hdp_group = get_batch_hdp_group() | ||
| 28 | ++ if batch_hdp_group is not None: | ||
| 29 | ++ hdp_group = next(group for group in batch_hdp_group if cp_rank in group) | ||
| 30 | ++ cp_size = len(hdp_group) | ||
| 31 | ++ cp_rank = hdp_group.index(cp_rank) | ||
| 32 | + cu_seqlens = cu_seqlens // cp_size | ||
| 33 | + seqlens = (cu_seqlens[1:] - cu_seqlens[:-1]).tolist() | ||
| 34 | + | ||
| 35 | +-- | ||
| 36 | +2.50.1.windows.1 | ||
| 37 | + | ||
The file is empty
The file is empty
The file is empty
The file is empty
The file is empty
| @@ -0,0 +1,71 @@ | |||
| 1 | +From 9ae300030b796fc7c18cbe6f3e1dbe2d8abf347d Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: mystri <mystri@noreply.gitcode.com> | ||
| 3 | +Date: Tue, 2 Dec 2025 00:38:07 +0800 | ||
| 4 | +Subject: [PATCH] Integrated SAM spec decoding into vllm-ascend | ||
| 5 | + | ||
| 6 | +--- | ||
| 7 | + .../patch/platform/patch_common/patch_config.py | 10 +++++++--- | ||
| 8 | + qwen3/vllm_ascend/spec_decode/__init__.py | 3 +++ | ||
| 9 | + qwen3/vllm_ascend/spec_decode/interface.py | 1 + | ||
| 10 | + 3 files changed, 11 insertions(+), 3 deletions(-) | ||
| 11 | + | ||
| 12 | +diff --git a/llm_rl/qwen3/vllm_ascend/patch/platform/patch_common/patch_config.py b/llm_rl/qwen3/vllm_ascend/patch/platform/patch_common/patch_config.py | ||
| 13 | +index 9b6f5c2..274338b 100644 | ||
| 14 | +--- a/llm_rl/qwen3/vllm_ascend/patch/platform/patch_common/patch_config.py | ||
| 15 | ++++ b/llm_rl/qwen3/vllm_ascend/patch/platform/patch_common/patch_config.py | ||
| 16 | + def __post_init__(self): | ||
| 17 | + self.quantization = self.target_model_config.quantization | ||
| 18 | + elif self.method in ("ngram", "[ngram]"): | ||
| 19 | + self.model = "ngram" | ||
| 20 | ++ elif self.method == "sam": | ||
| 21 | ++ self.model = "sam" | ||
| 22 | + else: | ||
| 23 | + raise ValueError("num_speculative_tokens was provided but without " | ||
| 24 | + "speculative model.") | ||
| 25 | + def __post_init__(self): | ||
| 26 | + and self.model in ("ngram", "[ngram]")): | ||
| 27 | + self.method = "ngram" | ||
| 28 | + | ||
| 29 | +- if self.method in ("ngram", "[ngram]"): | ||
| 30 | +- # Unified to "ngram" internally | ||
| 31 | +- self.method = "ngram" | ||
| 32 | ++ # Patch: setup parameters for model-free methods. | ||
| 33 | ++ if self.method in ("ngram", "[ngram]", "sam"): | ||
| 34 | ++ if self.method in ("ngram", "[ngram]"): | ||
| 35 | ++ # Unified to "ngram" internally | ||
| 36 | ++ self.method = "ngram" | ||
| 37 | + # Set default values if not provided | ||
| 38 | + if (self.prompt_lookup_min is None and self.prompt_lookup_max is None): | ||
| 39 | + # TODO(woosuk): Tune these values. They are arbitrarily chosen. | ||
| 40 | +diff --git a/llm_rl/qwen3/vllm_ascend/spec_decode/__init__.py b/llm_rl/qwen3/vllm_ascend/spec_decode/__init__.py | ||
| 41 | +index 64076c2..f31affc 100644 | ||
| 42 | +--- a/llm_rl/qwen3/vllm_ascend/spec_decode/__init__.py | ||
| 43 | ++++ b/llm_rl/qwen3/vllm_ascend/spec_decode/__init__.py | ||
| 44 | + | ||
| 45 | + from vllm_ascend.spec_decode.eagle_proposer import EagleProposer | ||
| 46 | + from vllm_ascend.spec_decode.mtp_proposer import MtpProposer | ||
| 47 | + from vllm_ascend.spec_decode.ngram_proposer import NgramProposer | ||
| 48 | ++from patches.vllm_ascend.spec_decode.sam_proposer import SAMProposer | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + def get_spec_decode_method(method, vllm_config, device, runner): | ||
| 52 | ++ if method == "sam": | ||
| 53 | ++ return SAMProposer(vllm_config, device, runner) | ||
| 54 | + if method == "ngram": | ||
| 55 | + return NgramProposer(vllm_config, device, runner) | ||
| 56 | + elif method in ["eagle", "eagle3"]: | ||
| 57 | +diff --git a/llm_rl/qwen3/vllm_ascend/spec_decode/interface.py b/llm_rl/qwen3/vllm_ascend/spec_decode/interface.py | ||
| 58 | +index 0efe93d..9ec115f 100644 | ||
| 59 | +--- a/llm_rl/qwen3/vllm_ascend/spec_decode/interface.py | ||
| 60 | ++++ b/llm_rl/qwen3/vllm_ascend/spec_decode/interface.py | ||
| 61 | + class SpecDcodeType(enum.Enum): | ||
| 62 | + EAGLE = 1 | ||
| 63 | + EAGLE3 = 2 | ||
| 64 | + MTP = 4 | ||
| 65 | ++ SAM = 5 | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + class Proposer: | ||
| 69 | +-- | ||
| 70 | +2.28.0.windows.1 | ||
| 71 | + | ||