sglang 0.5.2rc2__py3-none-any.whl → 0.5.3rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sglang/bench_one_batch_server.py +10 -1
- sglang/bench_serving.py +257 -29
- sglang/srt/configs/__init__.py +4 -0
- sglang/srt/configs/device_config.py +3 -1
- sglang/srt/configs/dots_vlm.py +139 -0
- sglang/srt/configs/load_config.py +1 -0
- sglang/srt/configs/model_config.py +50 -6
- sglang/srt/configs/qwen3_next.py +326 -0
- sglang/srt/connector/__init__.py +8 -1
- sglang/srt/connector/remote_instance.py +82 -0
- sglang/srt/constrained/base_grammar_backend.py +48 -12
- sglang/srt/constrained/llguidance_backend.py +0 -1
- sglang/srt/constrained/outlines_backend.py +0 -1
- sglang/srt/constrained/xgrammar_backend.py +28 -9
- sglang/srt/custom_op.py +11 -1
- sglang/srt/debug_utils/dump_comparator.py +81 -44
- sglang/srt/debug_utils/dump_loader.py +97 -0
- sglang/srt/debug_utils/dumper.py +11 -3
- sglang/srt/debug_utils/text_comparator.py +73 -11
- sglang/srt/disaggregation/base/conn.py +1 -1
- sglang/srt/disaggregation/common/conn.py +15 -12
- sglang/srt/disaggregation/decode.py +21 -10
- sglang/srt/disaggregation/decode_schedule_batch_mixin.py +4 -1
- sglang/srt/disaggregation/fake/conn.py +1 -1
- sglang/srt/disaggregation/mini_lb.py +6 -445
- sglang/srt/disaggregation/mooncake/conn.py +18 -10
- sglang/srt/disaggregation/nixl/conn.py +180 -16
- sglang/srt/disaggregation/prefill.py +5 -3
- sglang/srt/disaggregation/utils.py +5 -50
- sglang/srt/distributed/parallel_state.py +24 -3
- sglang/srt/entrypoints/engine.py +38 -17
- sglang/srt/entrypoints/grpc_request_manager.py +580 -0
- sglang/srt/entrypoints/grpc_server.py +680 -0
- sglang/srt/entrypoints/http_server.py +85 -54
- sglang/srt/entrypoints/openai/protocol.py +4 -1
- sglang/srt/entrypoints/openai/serving_base.py +46 -3
- sglang/srt/entrypoints/openai/serving_chat.py +36 -16
- sglang/srt/entrypoints/openai/serving_completions.py +12 -3
- sglang/srt/entrypoints/openai/serving_embedding.py +8 -3
- sglang/srt/entrypoints/openai/serving_rerank.py +3 -1
- sglang/srt/entrypoints/openai/serving_responses.py +6 -3
- sglang/srt/entrypoints/openai/serving_score.py +1 -0
- sglang/srt/eplb/eplb_manager.py +2 -2
- sglang/srt/eplb/expert_distribution.py +26 -13
- sglang/srt/eplb/expert_location.py +8 -3
- sglang/srt/eplb/expert_location_updater.py +1 -1
- sglang/srt/function_call/base_format_detector.py +3 -6
- sglang/srt/function_call/ebnf_composer.py +11 -9
- sglang/srt/function_call/function_call_parser.py +6 -0
- sglang/srt/function_call/glm4_moe_detector.py +1 -1
- sglang/srt/function_call/qwen3_coder_detector.py +1 -1
- sglang/srt/grpc/__init__.py +1 -0
- sglang/srt/grpc/sglang_scheduler_pb2.py +106 -0
- sglang/srt/grpc/sglang_scheduler_pb2.pyi +427 -0
- sglang/srt/grpc/sglang_scheduler_pb2_grpc.py +236 -0
- sglang/srt/hf_transformers_utils.py +4 -0
- sglang/srt/layers/activation.py +142 -9
- sglang/srt/layers/attention/ascend_backend.py +11 -4
- sglang/srt/layers/attention/fla/chunk.py +242 -0
- sglang/srt/layers/attention/fla/chunk_delta_h.py +314 -0
- sglang/srt/layers/attention/fla/chunk_o.py +178 -0
- sglang/srt/layers/attention/fla/chunk_scaled_dot_kkt.py +151 -0
- sglang/srt/layers/attention/fla/cumsum.py +300 -0
- sglang/srt/layers/attention/fla/fused_recurrent.py +640 -0
- sglang/srt/layers/attention/fla/fused_sigmoid_gating_recurrent.py +232 -0
- sglang/srt/layers/attention/fla/index.py +37 -0
- sglang/srt/layers/attention/fla/l2norm.py +150 -0
- sglang/srt/layers/attention/fla/layernorm_gated.py +326 -0
- sglang/srt/layers/attention/fla/op.py +66 -0
- sglang/srt/layers/attention/fla/solve_tril.py +465 -0
- sglang/srt/layers/attention/fla/utils.py +331 -0
- sglang/srt/layers/attention/fla/wy_fast.py +158 -0
- sglang/srt/layers/attention/flashinfer_backend.py +6 -4
- sglang/srt/layers/attention/flashinfer_mla_backend.py +16 -12
- sglang/srt/layers/attention/hybrid_attn_backend.py +57 -50
- sglang/srt/layers/attention/hybrid_linear_attn_backend.py +602 -0
- sglang/srt/layers/attention/intel_amx_backend.py +3 -0
- sglang/srt/layers/attention/mamba/causal_conv1d.py +128 -0
- sglang/srt/layers/attention/mamba/causal_conv1d_triton.py +1052 -0
- sglang/srt/layers/attention/mamba/mamba.py +64 -0
- sglang/srt/layers/attention/torch_native_backend.py +12 -6
- sglang/srt/layers/attention/triton_backend.py +18 -1
- sglang/srt/layers/attention/trtllm_mla_backend.py +124 -31
- sglang/srt/layers/attention/wave_ops/decode_attention.py +2 -4
- sglang/srt/layers/attention/wave_ops/extend_attention.py +1 -3
- sglang/srt/layers/dp_attention.py +30 -1
- sglang/srt/layers/layernorm.py +32 -15
- sglang/srt/layers/linear.py +34 -3
- sglang/srt/layers/logits_processor.py +29 -10
- sglang/srt/layers/moe/__init__.py +2 -1
- sglang/srt/layers/moe/cutlass_w4a8_moe.py +3 -3
- sglang/srt/layers/moe/ep_moe/kernels.py +1 -1
- sglang/srt/layers/moe/ep_moe/layer.py +182 -62
- sglang/srt/layers/moe/flashinfer_cutedsl_moe.py +156 -0
- sglang/srt/layers/moe/fused_moe_native.py +5 -3
- sglang/srt/layers/moe/fused_moe_triton/configs/{triton_3_4_0/E=128,N=768,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_3_1/E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json } +35 -35
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=128,N=352,device_name=NVIDIA_RTX_5880_Ada_Generation,dtype=fp8_w8a8.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=256,N=512,device_name=NVIDIA_H20.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=128,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=128,device_name=NVIDIA_H20-3e.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=128,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=256,device_name=NVIDIA_H20-3e.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=256,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=64,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=512,N=64,device_name=NVIDIA_H200.json +146 -0
- sglang/srt/layers/moe/fused_moe_triton/fused_moe.py +5 -2
- sglang/srt/layers/moe/fused_moe_triton/fused_moe_triton_config.py +1 -1
- sglang/srt/layers/moe/fused_moe_triton/fused_moe_triton_kernels.py +23 -20
- sglang/srt/layers/moe/fused_moe_triton/layer.py +61 -59
- sglang/srt/layers/moe/moe_runner/__init__.py +2 -1
- sglang/srt/layers/moe/moe_runner/base.py +274 -1
- sglang/srt/layers/moe/moe_runner/runner.py +80 -0
- sglang/srt/layers/moe/moe_runner/triton.py +448 -0
- sglang/srt/layers/moe/token_dispatcher/__init__.py +16 -4
- sglang/srt/layers/moe/token_dispatcher/{base_dispatcher.py → base.py} +67 -17
- sglang/srt/layers/moe/token_dispatcher/deepep.py +43 -39
- sglang/srt/layers/moe/token_dispatcher/standard.py +44 -2
- sglang/srt/layers/moe/topk.py +30 -9
- sglang/srt/layers/moe/utils.py +12 -6
- sglang/srt/layers/quantization/awq.py +19 -7
- sglang/srt/layers/quantization/base_config.py +11 -6
- sglang/srt/layers/quantization/blockwise_int8.py +38 -27
- sglang/srt/layers/quantization/compressed_tensors/compressed_tensors_moe.py +50 -30
- sglang/srt/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +13 -1
- sglang/srt/layers/quantization/deep_gemm_wrapper/entrypoint.py +27 -0
- sglang/srt/layers/quantization/fp8.py +76 -47
- sglang/srt/layers/quantization/fp8_utils.py +50 -31
- sglang/srt/layers/quantization/gptq.py +25 -17
- sglang/srt/layers/quantization/modelopt_quant.py +147 -47
- sglang/srt/layers/quantization/moe_wna16.py +21 -18
- sglang/srt/layers/quantization/mxfp4.py +64 -40
- sglang/srt/layers/quantization/quark/quark_moe.py +32 -27
- sglang/srt/layers/quantization/unquant.py +135 -47
- sglang/srt/layers/quantization/w4afp8.py +30 -17
- sglang/srt/layers/quantization/w8a8_fp8.py +35 -20
- sglang/srt/layers/quantization/w8a8_int8.py +76 -38
- sglang/srt/layers/sampler.py +162 -18
- sglang/srt/lora/backend/base_backend.py +50 -8
- sglang/srt/lora/backend/triton_backend.py +90 -2
- sglang/srt/lora/layers.py +32 -0
- sglang/srt/lora/lora.py +4 -1
- sglang/srt/lora/lora_manager.py +35 -112
- sglang/srt/lora/mem_pool.py +24 -10
- sglang/srt/lora/utils.py +18 -9
- sglang/srt/managers/async_dynamic_batch_tokenizer.py +170 -0
- sglang/srt/managers/cache_controller.py +158 -160
- sglang/srt/managers/data_parallel_controller.py +105 -35
- sglang/srt/managers/detokenizer_manager.py +8 -4
- sglang/srt/managers/disagg_service.py +46 -0
- sglang/srt/managers/io_struct.py +199 -12
- sglang/srt/managers/mm_utils.py +1 -0
- sglang/srt/managers/multi_tokenizer_mixin.py +350 -400
- sglang/srt/managers/schedule_batch.py +77 -56
- sglang/srt/managers/schedule_policy.py +1 -1
- sglang/srt/managers/scheduler.py +187 -39
- sglang/srt/managers/scheduler_metrics_mixin.py +4 -3
- sglang/srt/managers/scheduler_output_processor_mixin.py +55 -11
- sglang/srt/managers/scheduler_profiler_mixin.py +1 -1
- sglang/srt/managers/tokenizer_communicator_mixin.py +569 -0
- sglang/srt/managers/tokenizer_manager.py +259 -519
- sglang/srt/managers/tp_worker.py +53 -4
- sglang/srt/managers/tp_worker_overlap_thread.py +42 -19
- sglang/srt/mem_cache/hicache_storage.py +3 -23
- sglang/srt/mem_cache/hiradix_cache.py +103 -43
- sglang/srt/mem_cache/memory_pool.py +347 -48
- sglang/srt/mem_cache/memory_pool_host.py +105 -46
- sglang/srt/mem_cache/radix_cache.py +0 -2
- sglang/srt/mem_cache/storage/hf3fs/hf3fs_client.py +164 -0
- sglang/srt/mem_cache/storage/hf3fs/{client_hf3fs.py → hf3fs_usrbio_client.py} +5 -1
- sglang/srt/mem_cache/storage/hf3fs/storage_hf3fs.py +86 -4
- sglang/srt/mem_cache/storage/lmcache/lmc_radix_cache.py +280 -0
- sglang/srt/mem_cache/storage/lmcache/unit_test.py +121 -0
- sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py +49 -7
- sglang/srt/mem_cache/swa_radix_cache.py +0 -2
- sglang/srt/metrics/collector.py +493 -76
- sglang/srt/metrics/startup_func_log_and_timer.py +150 -0
- sglang/srt/model_executor/cpu_graph_runner.py +640 -0
- sglang/srt/model_executor/cuda_graph_runner.py +13 -5
- sglang/srt/model_executor/forward_batch_info.py +59 -2
- sglang/srt/model_executor/model_runner.py +356 -29
- sglang/srt/model_loader/__init__.py +9 -3
- sglang/srt/model_loader/loader.py +128 -4
- sglang/srt/model_loader/weight_utils.py +2 -1
- sglang/srt/models/apertus.py +686 -0
- sglang/srt/models/bailing_moe.py +798 -218
- sglang/srt/models/bailing_moe_nextn.py +168 -0
- sglang/srt/models/deepseek_v2.py +109 -15
- sglang/srt/models/dots_vlm.py +174 -0
- sglang/srt/models/dots_vlm_vit.py +337 -0
- sglang/srt/models/ernie4.py +1 -1
- sglang/srt/models/gemma3n_mm.py +1 -1
- sglang/srt/models/glm4_moe.py +1 -1
- sglang/srt/models/glm4v.py +4 -2
- sglang/srt/models/glm4v_moe.py +3 -0
- sglang/srt/models/gpt_oss.py +1 -1
- sglang/srt/models/llama4.py +9 -0
- sglang/srt/models/llama_eagle3.py +13 -0
- sglang/srt/models/longcat_flash.py +2 -2
- sglang/srt/models/mllama4.py +25 -0
- sglang/srt/models/opt.py +637 -0
- sglang/srt/models/qwen2.py +7 -0
- sglang/srt/models/qwen2_5_vl.py +27 -3
- sglang/srt/models/qwen2_moe.py +56 -12
- sglang/srt/models/qwen3_moe.py +1 -1
- sglang/srt/models/qwen3_next.py +1042 -0
- sglang/srt/models/qwen3_next_mtp.py +112 -0
- sglang/srt/models/step3_vl.py +1 -1
- sglang/srt/multimodal/processors/dots_vlm.py +99 -0
- sglang/srt/multimodal/processors/glm4v.py +9 -9
- sglang/srt/multimodal/processors/internvl.py +141 -129
- sglang/srt/multimodal/processors/qwen_vl.py +15 -5
- sglang/srt/offloader.py +27 -3
- sglang/srt/remote_instance_weight_loader_utils.py +69 -0
- sglang/srt/sampling/sampling_batch_info.py +18 -15
- sglang/srt/server_args.py +276 -35
- sglang/srt/speculative/eagle_draft_cuda_graph_runner.py +5 -0
- sglang/srt/speculative/eagle_draft_extend_cuda_graph_runner.py +10 -1
- sglang/srt/speculative/eagle_utils.py +0 -2
- sglang/srt/speculative/eagle_worker.py +43 -4
- sglang/srt/speculative/spec_info.py +5 -0
- sglang/srt/speculative/standalone_worker.py +109 -0
- sglang/srt/tracing/trace.py +552 -0
- sglang/srt/utils.py +34 -3
- sglang/srt/weight_sync/utils.py +1 -1
- sglang/test/attention/test_trtllm_mla_backend.py +169 -5
- sglang/test/runners.py +4 -0
- sglang/test/test_cutlass_moe.py +24 -6
- sglang/test/test_disaggregation_utils.py +66 -0
- sglang/test/test_fp4_moe.py +370 -1
- sglang/test/test_utils.py +28 -1
- sglang/utils.py +11 -0
- sglang/version.py +1 -1
- {sglang-0.5.2rc2.dist-info → sglang-0.5.3rc0.dist-info}/METADATA +59 -123
- {sglang-0.5.2rc2.dist-info → sglang-0.5.3rc0.dist-info}/RECORD +237 -178
- sglang/srt/disaggregation/launch_lb.py +0 -118
- {sglang-0.5.2rc2.dist-info → sglang-0.5.3rc0.dist-info}/WHEEL +0 -0
- {sglang-0.5.2rc2.dist-info → sglang-0.5.3rc0.dist-info}/licenses/LICENSE +0 -0
- {sglang-0.5.2rc2.dist-info → sglang-0.5.3rc0.dist-info}/top_level.txt +0 -0
@@ -64,12 +64,28 @@ class ModelConfig:
|
|
64
64
|
is_draft_model: bool = False,
|
65
65
|
hybrid_kvcache_ratio: Optional[float] = None,
|
66
66
|
model_impl: Union[str, ModelImpl] = ModelImpl.AUTO,
|
67
|
+
tp_rank: Optional[int] = None,
|
68
|
+
remote_instance_weight_loader_seed_instance_ip: Optional[str] = None,
|
69
|
+
remote_instance_weight_loader_seed_instance_service_port: Optional[int] = None,
|
70
|
+
remote_instance_weight_loader_send_weights_group_ports: Optional[
|
71
|
+
List[int]
|
72
|
+
] = None,
|
67
73
|
) -> None:
|
68
74
|
# Parse args
|
69
75
|
self.model_path = model_path
|
70
76
|
self.revision = revision
|
71
77
|
self.quantization = quantization
|
72
78
|
self.model_impl = model_impl
|
79
|
+
self.tp_rank = tp_rank
|
80
|
+
self.remote_instance_weight_loader_seed_instance_ip = (
|
81
|
+
remote_instance_weight_loader_seed_instance_ip
|
82
|
+
)
|
83
|
+
self.remote_instance_weight_loader_seed_instance_service_port = (
|
84
|
+
remote_instance_weight_loader_seed_instance_service_port
|
85
|
+
)
|
86
|
+
self.remote_instance_weight_loader_send_weights_group_ports = (
|
87
|
+
remote_instance_weight_loader_send_weights_group_ports
|
88
|
+
)
|
73
89
|
|
74
90
|
self.maybe_pull_model_tokenizer_from_remote()
|
75
91
|
self.model_override_args = json.loads(model_override_args)
|
@@ -141,12 +157,21 @@ class ModelConfig:
|
|
141
157
|
|
142
158
|
if is_draft_model and self.hf_config.architectures[0] == "MiMoForCausalLM":
|
143
159
|
self.hf_config.architectures[0] = "MiMoMTP"
|
160
|
+
if is_draft_model and self.hf_config.architectures[0] in [
|
161
|
+
"BailingMoeV2ForCausalLM",
|
162
|
+
"BailingMoeForCausalLM",
|
163
|
+
]:
|
164
|
+
self.hf_config.architectures[0] = "BailingMoeForCausalLMNextN"
|
144
165
|
if (
|
145
166
|
is_draft_model
|
146
167
|
and self.hf_config.architectures[0] == "Ernie4_5_MoeForCausalLM"
|
147
168
|
):
|
148
169
|
self.hf_config.architectures[0] = "Ernie4_5_MoeForCausalLMMTP"
|
149
170
|
|
171
|
+
if is_draft_model and self.hf_config.architectures[0] == "Qwen3NextForCausalLM":
|
172
|
+
self.hf_config.architectures[0] = "Qwen3NextForCausalLMMTP"
|
173
|
+
self.hf_config.num_nextn_predict_layers = 1
|
174
|
+
|
150
175
|
# Check model type
|
151
176
|
self.is_generation = is_generation_model(
|
152
177
|
self.hf_config.architectures, is_embedding
|
@@ -208,6 +233,7 @@ class ModelConfig:
|
|
208
233
|
or "DeepseekV3ForCausalLMNextN" in self.hf_config.architectures
|
209
234
|
or "LongcatFlashForCausalLM" in self.hf_config.architectures
|
210
235
|
or "LongcatFlashForCausalLMNextN" in self.hf_config.architectures
|
236
|
+
or "DotsVLMForCausalLM" in self.hf_config.architectures
|
211
237
|
):
|
212
238
|
self.head_dim = 256
|
213
239
|
self.attention_arch = AttentionArch.MLA
|
@@ -302,11 +328,16 @@ class ModelConfig:
|
|
302
328
|
) or getattr(self.hf_config, "image_token_index", None)
|
303
329
|
|
304
330
|
@staticmethod
|
305
|
-
def from_server_args(
|
331
|
+
def from_server_args(
|
332
|
+
server_args: ServerArgs,
|
333
|
+
model_path: str = None,
|
334
|
+
model_revision: str = None,
|
335
|
+
**kwargs,
|
336
|
+
):
|
306
337
|
return ModelConfig(
|
307
338
|
model_path=model_path or server_args.model_path,
|
308
339
|
trust_remote_code=server_args.trust_remote_code,
|
309
|
-
revision=server_args.revision,
|
340
|
+
revision=model_revision or server_args.revision,
|
310
341
|
context_length=server_args.context_length,
|
311
342
|
model_override_args=server_args.json_model_override_args,
|
312
343
|
is_embedding=server_args.is_embedding,
|
@@ -315,6 +346,9 @@ class ModelConfig:
|
|
315
346
|
quantization=server_args.quantization,
|
316
347
|
hybrid_kvcache_ratio=server_args.hybrid_kvcache_ratio,
|
317
348
|
model_impl=server_args.model_impl,
|
349
|
+
remote_instance_weight_loader_seed_instance_ip=server_args.remote_instance_weight_loader_seed_instance_ip,
|
350
|
+
remote_instance_weight_loader_seed_instance_service_port=server_args.remote_instance_weight_loader_seed_instance_service_port,
|
351
|
+
remote_instance_weight_loader_send_weights_group_ports=server_args.remote_instance_weight_loader_send_weights_group_ports,
|
318
352
|
**kwargs,
|
319
353
|
)
|
320
354
|
|
@@ -412,11 +446,20 @@ class ModelConfig:
|
|
412
446
|
is_local = os.path.exists(self.model_path)
|
413
447
|
modelopt_quant_config = {"quant_method": "modelopt"}
|
414
448
|
if not is_local:
|
415
|
-
|
449
|
+
import huggingface_hub
|
450
|
+
|
451
|
+
try:
|
452
|
+
from huggingface_hub import HfApi
|
453
|
+
|
454
|
+
hf_api = HfApi()
|
455
|
+
if hf_api.file_exists(self.model_path, "hf_quant_config.json"):
|
456
|
+
quant_cfg = modelopt_quant_config
|
457
|
+
except huggingface_hub.errors.OfflineModeIsEnabled:
|
458
|
+
logger.warning(
|
459
|
+
"Offline mode is enabled, skipping hf_quant_config.json check"
|
460
|
+
)
|
461
|
+
pass
|
416
462
|
|
417
|
-
hf_api = HfApi()
|
418
|
-
if hf_api.file_exists(self.model_path, "hf_quant_config.json"):
|
419
|
-
quant_cfg = modelopt_quant_config
|
420
463
|
elif os.path.exists(os.path.join(self.model_path, "hf_quant_config.json")):
|
421
464
|
quant_config_file = os.path.join(
|
422
465
|
self.model_path, "hf_quant_config.json"
|
@@ -712,6 +755,7 @@ multimodal_model_archs = [
|
|
712
755
|
"Phi4MMForCausalLM",
|
713
756
|
"VILAForConditionalGeneration",
|
714
757
|
"Step3VLForConditionalGeneration",
|
758
|
+
"DotsVLMForCausalLM",
|
715
759
|
]
|
716
760
|
|
717
761
|
|
@@ -0,0 +1,326 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
"""Qwen3Hybrid model configuration"""
|
16
|
+
|
17
|
+
import enum
|
18
|
+
import os
|
19
|
+
|
20
|
+
import numpy as np
|
21
|
+
import torch
|
22
|
+
from transformers.configuration_utils import PretrainedConfig
|
23
|
+
from transformers.modeling_rope_utils import rope_config_validation
|
24
|
+
from transformers.utils import logging
|
25
|
+
|
26
|
+
from sglang.srt.distributed.utils import divide
|
27
|
+
from sglang.srt.layers.dp_attention import get_attention_tp_size
|
28
|
+
|
29
|
+
logger = logging.get_logger(__name__)
|
30
|
+
|
31
|
+
|
32
|
+
# NOTE: HybridLayerType
|
33
|
+
class HybridLayerType(enum.Enum):
|
34
|
+
full_attention = "attention"
|
35
|
+
swa_attention = "swa_attention"
|
36
|
+
linear_attention = "linear_attention"
|
37
|
+
mamba2 = "mamba"
|
38
|
+
|
39
|
+
|
40
|
+
class Qwen3NextConfig(PretrainedConfig):
|
41
|
+
r"""
|
42
|
+
This is the configuration class to store the configuration of a [`Qwen3NextModel`]. It is used to instantiate a
|
43
|
+
Qwen3-Next model according to the specified arguments, defining the model architecture.
|
44
|
+
Instantiating a configuration with the defaults will yield a similar configuration to that of
|
45
|
+
Qwen3-Next-80B-A3B-Instruct [Qwen/Qwen3-Next-80B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Next-80B-A3B-Instruct).
|
46
|
+
|
47
|
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
48
|
+
documentation from [`PretrainedConfig`] for more information.
|
49
|
+
|
50
|
+
|
51
|
+
Args:
|
52
|
+
vocab_size (`int`, *optional*, defaults to 151936):
|
53
|
+
Vocabulary size of the model. Defines the number of different tokens that can be represented by the
|
54
|
+
`inputs_ids`.
|
55
|
+
hidden_size (`int`, *optional*, defaults to 2048):
|
56
|
+
Dimension of the hidden representations.
|
57
|
+
intermediate_size (`int`, *optional*, defaults to 5632):
|
58
|
+
Dimension of the MLP representations.
|
59
|
+
num_hidden_layers (`int`, *optional*, defaults to 48):
|
60
|
+
Number of hidden layers in the Transformer encoder.
|
61
|
+
num_attention_heads (`int`, *optional*, defaults to 16):
|
62
|
+
Number of attention heads for each attention layer in the Transformer encoder.
|
63
|
+
num_key_value_heads (`int`, *optional*, defaults to 2):
|
64
|
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
65
|
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
66
|
+
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
67
|
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
68
|
+
by meanpooling all the original heads within that group. For more details checkout [this
|
69
|
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `32`.
|
70
|
+
hidden_act (`str`, *optional*, defaults to `"silu"`):
|
71
|
+
The non-linear activation function in the decoder.
|
72
|
+
max_position_embeddings (`int`, *optional*, defaults to 32768):
|
73
|
+
The maximum sequence length that this model might ever be used with.
|
74
|
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
75
|
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
76
|
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
77
|
+
The epsilon used by the rms normalization layers.
|
78
|
+
use_cache (`bool`, *optional*, defaults to `True`):
|
79
|
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
80
|
+
relevant if `config.is_decoder=True`.
|
81
|
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
82
|
+
Whether the model's input and output word embeddings should be tied.
|
83
|
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
84
|
+
The base period of the RoPE embeddings.
|
85
|
+
rope_scaling (`Dict`, *optional*):
|
86
|
+
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
|
87
|
+
and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
|
88
|
+
accordingly.
|
89
|
+
Expected contents:
|
90
|
+
`rope_type` (`str`):
|
91
|
+
The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
|
92
|
+
'llama3'], with 'default' being the original RoPE implementation.
|
93
|
+
`factor` (`float`, *optional*):
|
94
|
+
Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
|
95
|
+
most scaling types, a `factor` of x will enable the model to handle sequences of length x *
|
96
|
+
original maximum pre-trained length.
|
97
|
+
`original_max_position_embeddings` (`int`, *optional*):
|
98
|
+
Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
|
99
|
+
pretraining.
|
100
|
+
`attention_factor` (`float`, *optional*):
|
101
|
+
Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
|
102
|
+
computation. If unspecified, it defaults to value recommended by the implementation, using the
|
103
|
+
`factor` field to infer the suggested value.
|
104
|
+
`beta_fast` (`float`, *optional*):
|
105
|
+
Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
|
106
|
+
ramp function. If unspecified, it defaults to 32.
|
107
|
+
`beta_slow` (`float`, *optional*):
|
108
|
+
Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
|
109
|
+
ramp function. If unspecified, it defaults to 1.
|
110
|
+
`short_factor` (`List[float]`, *optional*):
|
111
|
+
Only used with 'longrope'. The scaling factor to be applied to short contexts (<
|
112
|
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
113
|
+
size divided by the number of attention heads divided by 2
|
114
|
+
`long_factor` (`List[float]`, *optional*):
|
115
|
+
Only used with 'longrope'. The scaling factor to be applied to long contexts (<
|
116
|
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
117
|
+
size divided by the number of attention heads divided by 2
|
118
|
+
`low_freq_factor` (`float`, *optional*):
|
119
|
+
Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
|
120
|
+
`high_freq_factor` (`float`, *optional*):
|
121
|
+
Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
|
122
|
+
partial_rotary_factor (`float`, *optional*, defaults to 0.25):
|
123
|
+
Percentage of the query and keys which will have rotary embedding.
|
124
|
+
attention_bias (`bool`, *optional*, defaults to `False`):
|
125
|
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
126
|
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
127
|
+
The dropout ratio for the attention probabilities.
|
128
|
+
head_dim (`int`, *optional*, defaults to 256):
|
129
|
+
Projection weights dimension in multi-head attention.
|
130
|
+
linear_conv_kernel_dim (`int`, *optional*, defaults to 4):
|
131
|
+
Kernel size of the convolution used in linear attention layers.
|
132
|
+
linear_key_head_dim (`int`, *optional*, defaults to 128):
|
133
|
+
Dimension of each key head in linear attention.
|
134
|
+
linear_value_head_dim (`int`, *optional*, defaults to 128):
|
135
|
+
Dimension of each value head in linear attention.
|
136
|
+
linear_num_key_heads (`int`, *optional*, defaults to 16):
|
137
|
+
Number of key heads used in linear attention layers.
|
138
|
+
linear_num_value_heads (`int`, *optional*, defaults to 32):
|
139
|
+
Number of value heads used in linear attention layers.
|
140
|
+
decoder_sparse_step (`int`, *optional*, defaults to 1):
|
141
|
+
The frequency of the MoE layer.
|
142
|
+
moe_intermediate_size (`int`, *optional*, defaults to 512):
|
143
|
+
Intermediate size of the routed expert.
|
144
|
+
shared_expert_intermediate_size (`int`, *optional*, defaults to 512):
|
145
|
+
Intermediate size of the shared expert.
|
146
|
+
num_experts_per_tok (`int`, *optional*, defaults to 10):
|
147
|
+
Number of selected experts.
|
148
|
+
num_experts (`int`, *optional*, defaults to 512):
|
149
|
+
Number of routed experts.
|
150
|
+
norm_topk_prob (`bool`, *optional*, defaults to `True`):
|
151
|
+
Whether to normalize the topk probabilities.
|
152
|
+
output_router_logits (`bool`, *optional*, defaults to `False`):
|
153
|
+
Whether or not the router logits should be returned by the model. Enabling this will also
|
154
|
+
allow the model to output the auxiliary loss, including load balancing loss and router z-loss.
|
155
|
+
router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
|
156
|
+
The aux loss factor for the total loss.
|
157
|
+
mlp_only_layers (`list[int]`, *optional*, defaults to `[]`):
|
158
|
+
Indicate which layers use Qwen3NextMLP rather than Qwen3NextSparseMoeBlock
|
159
|
+
The list contains layer index, from 0 to num_layers-1 if we have num_layers layers
|
160
|
+
If `mlp_only_layers` is empty, `decoder_sparse_step` is used to determine the sparsity.
|
161
|
+
layer_types (`list[str]`, *optional*, defaults to None):
|
162
|
+
Types of each layer (attention or linear).
|
163
|
+
|
164
|
+
```python
|
165
|
+
>>> from transformers import Qwen3NextModel, Qwen3NextConfig
|
166
|
+
|
167
|
+
>>> # Initializing a Qwen3Next style configuration
|
168
|
+
>>> configuration = Qwen3NextConfig()
|
169
|
+
|
170
|
+
>>> # Initializing a model from the Qwen3-Next-80B-A3B style configuration
|
171
|
+
>>> model = Qwen3NextModel(configuration)
|
172
|
+
|
173
|
+
>>> # Accessing the model configuration
|
174
|
+
>>> configuration = model.config
|
175
|
+
```
|
176
|
+
"""
|
177
|
+
|
178
|
+
model_type = "qwen3_next"
|
179
|
+
keys_to_ignore_at_inference = ["past_key_values"]
|
180
|
+
|
181
|
+
def __init__(
|
182
|
+
self,
|
183
|
+
vocab_size=151936,
|
184
|
+
hidden_size=2048,
|
185
|
+
intermediate_size=5632,
|
186
|
+
num_hidden_layers=48,
|
187
|
+
num_attention_heads=16,
|
188
|
+
num_key_value_heads=2,
|
189
|
+
hidden_act="silu",
|
190
|
+
max_position_embeddings=32768,
|
191
|
+
initializer_range=0.02,
|
192
|
+
rms_norm_eps=1e-6,
|
193
|
+
use_cache=True,
|
194
|
+
tie_word_embeddings=False,
|
195
|
+
rope_theta=10000.0,
|
196
|
+
rope_scaling=None,
|
197
|
+
partial_rotary_factor=0.25,
|
198
|
+
attention_bias=False,
|
199
|
+
attention_dropout=0.0,
|
200
|
+
head_dim=256,
|
201
|
+
linear_conv_kernel_dim=4,
|
202
|
+
linear_key_head_dim=128,
|
203
|
+
linear_value_head_dim=128,
|
204
|
+
linear_num_key_heads=16,
|
205
|
+
linear_num_value_heads=32,
|
206
|
+
decoder_sparse_step=1,
|
207
|
+
moe_intermediate_size=512,
|
208
|
+
shared_expert_intermediate_size=512,
|
209
|
+
num_experts_per_tok=10,
|
210
|
+
num_experts=512,
|
211
|
+
norm_topk_prob=True,
|
212
|
+
output_router_logits=False,
|
213
|
+
router_aux_loss_coef=0.001,
|
214
|
+
mlp_only_layers=[],
|
215
|
+
layer_types=None,
|
216
|
+
**kwargs,
|
217
|
+
):
|
218
|
+
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
219
|
+
self.vocab_size = vocab_size
|
220
|
+
self.max_position_embeddings = max_position_embeddings
|
221
|
+
self.hidden_size = hidden_size
|
222
|
+
self.intermediate_size = intermediate_size
|
223
|
+
self.num_hidden_layers = num_hidden_layers
|
224
|
+
self.num_attention_heads = num_attention_heads
|
225
|
+
self.num_key_value_heads = num_key_value_heads
|
226
|
+
self.hidden_act = hidden_act
|
227
|
+
self.initializer_range = initializer_range
|
228
|
+
self.rms_norm_eps = rms_norm_eps
|
229
|
+
self.use_cache = use_cache
|
230
|
+
self.rope_theta = rope_theta
|
231
|
+
self.rope_scaling = rope_scaling
|
232
|
+
self.partial_rotary_factor = partial_rotary_factor
|
233
|
+
self.attention_bias = attention_bias
|
234
|
+
self.attention_dropout = attention_dropout
|
235
|
+
self.head_dim = head_dim
|
236
|
+
rope_config_validation(self)
|
237
|
+
|
238
|
+
# linear attention (gdn now part)
|
239
|
+
self.linear_conv_kernel_dim = linear_conv_kernel_dim
|
240
|
+
self.linear_key_head_dim = linear_key_head_dim
|
241
|
+
self.linear_value_head_dim = linear_value_head_dim
|
242
|
+
self.linear_num_key_heads = linear_num_key_heads
|
243
|
+
self.linear_num_value_heads = linear_num_value_heads
|
244
|
+
|
245
|
+
# MoE arguments
|
246
|
+
self.decoder_sparse_step = decoder_sparse_step
|
247
|
+
self.moe_intermediate_size = moe_intermediate_size
|
248
|
+
self.shared_expert_intermediate_size = shared_expert_intermediate_size
|
249
|
+
self.num_experts_per_tok = num_experts_per_tok
|
250
|
+
self.num_experts = num_experts
|
251
|
+
self.norm_topk_prob = norm_topk_prob
|
252
|
+
self.output_router_logits = output_router_logits
|
253
|
+
self.router_aux_loss_coef = router_aux_loss_coef
|
254
|
+
self.mlp_only_layers = mlp_only_layers
|
255
|
+
|
256
|
+
@property
|
257
|
+
def layers_block_type(self):
|
258
|
+
layer_type_list = []
|
259
|
+
|
260
|
+
for l in range(self.num_hidden_layers):
|
261
|
+
if (l + 1) % self.full_attention_interval == 0:
|
262
|
+
layer_type_list.append(HybridLayerType.full_attention.value)
|
263
|
+
else:
|
264
|
+
layer_type_list.append(HybridLayerType.linear_attention.value)
|
265
|
+
|
266
|
+
return layer_type_list
|
267
|
+
|
268
|
+
@property
|
269
|
+
def linear_layer_ids(self):
|
270
|
+
return [
|
271
|
+
i
|
272
|
+
for i, type_value in enumerate(self.layers_block_type)
|
273
|
+
if type_value == HybridLayerType.linear_attention.value
|
274
|
+
]
|
275
|
+
|
276
|
+
@property
|
277
|
+
def full_attention_layer_ids(self):
|
278
|
+
return [
|
279
|
+
i
|
280
|
+
for i, type_value in enumerate(self.layers_block_type)
|
281
|
+
if type_value == HybridLayerType.full_attention.value
|
282
|
+
]
|
283
|
+
|
284
|
+
@property
|
285
|
+
def hybrid_gdn_params(self):
|
286
|
+
world_size = get_attention_tp_size()
|
287
|
+
conv_dim = (
|
288
|
+
self.linear_key_head_dim * self.linear_num_key_heads * 2
|
289
|
+
+ self.linear_value_head_dim * self.linear_num_value_heads
|
290
|
+
)
|
291
|
+
conv_state_shape = (
|
292
|
+
divide(conv_dim, world_size),
|
293
|
+
self.linear_conv_kernel_dim - 1,
|
294
|
+
)
|
295
|
+
|
296
|
+
temporal_state_shape = (
|
297
|
+
divide(self.linear_num_value_heads, world_size),
|
298
|
+
self.linear_key_head_dim,
|
299
|
+
self.linear_value_head_dim,
|
300
|
+
)
|
301
|
+
conv_dtype = torch.bfloat16
|
302
|
+
dtype_map = {
|
303
|
+
"float32": torch.float32,
|
304
|
+
"bfloat16": torch.bfloat16,
|
305
|
+
}
|
306
|
+
ssm_dtype = dtype_map[os.environ["SGLANG_MAMBA_SSM_DTYPE"]]
|
307
|
+
mamba_layers = self.linear_layer_ids
|
308
|
+
return (
|
309
|
+
conv_state_shape,
|
310
|
+
temporal_state_shape,
|
311
|
+
conv_dtype,
|
312
|
+
ssm_dtype,
|
313
|
+
mamba_layers,
|
314
|
+
)
|
315
|
+
|
316
|
+
@property
|
317
|
+
def mamba_cache_per_req(self):
|
318
|
+
conv_state_shape, temporal_state_shape, conv_dtype, ssm_dtype, mamba_layers = (
|
319
|
+
self.hybrid_gdn_params
|
320
|
+
)
|
321
|
+
mamba_layers_len = len(mamba_layers)
|
322
|
+
|
323
|
+
return (
|
324
|
+
int(np.prod(conv_state_shape)) * conv_dtype.itemsize
|
325
|
+
+ int(np.prod(temporal_state_shape)) * ssm_dtype.itemsize
|
326
|
+
) * mamba_layers_len
|
sglang/srt/connector/__init__.py
CHANGED
@@ -9,6 +9,7 @@ from sglang.srt.connector.base_connector import (
|
|
9
9
|
BaseKVConnector,
|
10
10
|
)
|
11
11
|
from sglang.srt.connector.redis import RedisConnector
|
12
|
+
from sglang.srt.connector.remote_instance import RemoteInstanceConnector
|
12
13
|
from sglang.srt.connector.s3 import S3Connector
|
13
14
|
from sglang.srt.utils import parse_connector_type
|
14
15
|
|
@@ -18,14 +19,17 @@ logger = logging.getLogger(__name__)
|
|
18
19
|
class ConnectorType(str, enum.Enum):
|
19
20
|
FS = "filesystem"
|
20
21
|
KV = "KV"
|
22
|
+
INSTANCE = "instance"
|
21
23
|
|
22
24
|
|
23
|
-
def create_remote_connector(url, **kwargs) -> BaseConnector:
|
25
|
+
def create_remote_connector(url, device, **kwargs) -> BaseConnector:
|
24
26
|
connector_type = parse_connector_type(url)
|
25
27
|
if connector_type == "redis":
|
26
28
|
return RedisConnector(url)
|
27
29
|
elif connector_type == "s3":
|
28
30
|
return S3Connector(url)
|
31
|
+
elif connector_type == "instance":
|
32
|
+
return RemoteInstanceConnector(url, device)
|
29
33
|
else:
|
30
34
|
raise ValueError(f"Invalid connector type: {url}")
|
31
35
|
|
@@ -35,6 +39,8 @@ def get_connector_type(client: BaseConnector) -> ConnectorType:
|
|
35
39
|
return ConnectorType.KV
|
36
40
|
if isinstance(client, BaseFileConnector):
|
37
41
|
return ConnectorType.FS
|
42
|
+
if isinstance(client, RemoteInstanceConnector):
|
43
|
+
return ConnectorType.INSTANCE
|
38
44
|
|
39
45
|
raise ValueError(f"Invalid connector type: {client}")
|
40
46
|
|
@@ -44,6 +50,7 @@ __all__ = [
|
|
44
50
|
"BaseFileConnector",
|
45
51
|
"BaseKVConnector",
|
46
52
|
"RedisConnector",
|
53
|
+
"RemoteInstanceConnector",
|
47
54
|
"S3Connector",
|
48
55
|
"ConnectorType",
|
49
56
|
"create_remote_connector",
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
import logging
|
4
|
+
from typing import Generator, List, Optional, Tuple
|
5
|
+
from urllib.parse import urlparse
|
6
|
+
|
7
|
+
import torch
|
8
|
+
import torch.distributed as dist
|
9
|
+
|
10
|
+
from sglang.srt.connector import BaseConnector
|
11
|
+
from sglang.srt.utils import init_custom_process_group
|
12
|
+
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
|
16
|
+
class RemoteInstanceConnector(BaseConnector):
|
17
|
+
|
18
|
+
def __init__(self, url: str, device: torch.device = "cpu"):
|
19
|
+
assert (
|
20
|
+
device.type == "cuda"
|
21
|
+
), "RemoteInstanceConnector only supports cuda device."
|
22
|
+
super().__init__(url)
|
23
|
+
self.url = url
|
24
|
+
self.device = device
|
25
|
+
|
26
|
+
def build_group(
|
27
|
+
self,
|
28
|
+
gpu_id: int = -1,
|
29
|
+
tp_rank: int = -1,
|
30
|
+
instance_ip: str = None,
|
31
|
+
group_rank: int = 1,
|
32
|
+
world_size: int = 2,
|
33
|
+
):
|
34
|
+
assert (
|
35
|
+
self.device.type == "cuda"
|
36
|
+
), "RemoteInstanceConnector only supports cuda device."
|
37
|
+
assert (
|
38
|
+
gpu_id != -1 and tp_rank != -1
|
39
|
+
), "gpu_id and tp_rank must be specified for RemoteInstanceConnector. "
|
40
|
+
|
41
|
+
self.device_id = torch.device(self.device.type, gpu_id)
|
42
|
+
|
43
|
+
parsed_url = urlparse(self.url)
|
44
|
+
master_address = parsed_url.hostname
|
45
|
+
master_port = parsed_url.port
|
46
|
+
group_name = f"send_weights_{instance_ip}_{master_port}_{tp_rank}"
|
47
|
+
backend = "nccl"
|
48
|
+
|
49
|
+
logger.info(
|
50
|
+
f"init custom process group: master_address={master_address}, master_port={master_port}, "
|
51
|
+
f"rank_offset={group_rank}, world_size={world_size}, group_name={group_name}, backend={backend}"
|
52
|
+
)
|
53
|
+
|
54
|
+
try:
|
55
|
+
self._model_update_group = init_custom_process_group(
|
56
|
+
backend=backend,
|
57
|
+
init_method=f"tcp://{master_address}:{master_port}",
|
58
|
+
world_size=world_size,
|
59
|
+
rank=group_rank,
|
60
|
+
group_name=group_name,
|
61
|
+
device_id=self.device_id,
|
62
|
+
)
|
63
|
+
dist.barrier(group=self._model_update_group)
|
64
|
+
return True, "Succeeded to initialize custom process group."
|
65
|
+
except Exception as e:
|
66
|
+
message = f"Failed to initialize custom process group: {e}."
|
67
|
+
logger.error(message)
|
68
|
+
return False, message
|
69
|
+
|
70
|
+
# Implemented as a no-op to make BaseConnector interface consistent.
|
71
|
+
def pull_files(
|
72
|
+
self,
|
73
|
+
allow_pattern: Optional[list[str]] = None,
|
74
|
+
ignore_pattern: Optional[list[str]] = None,
|
75
|
+
) -> None:
|
76
|
+
return
|
77
|
+
|
78
|
+
# Implemented as a no-op to make BaseConnector interface consistent.
|
79
|
+
def weight_iterator(
|
80
|
+
self, rank: int = 0
|
81
|
+
) -> Generator[Tuple[str, torch.Tensor], None, None]:
|
82
|
+
return
|