Files
FastDeploy/tests/utils.py
YuanRisheng 24180fba0a
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
[FDConfig]Remove splitwise_role and engine_worker_queue_port in FDConfig (#4147)
* remove splitwise_role and engine_worker_queue_port

* fix xpu

* fix xpu

* fix xpu

* fix unittest

* resolve conflct
2025-09-19 17:01:52 +08:00

70 lines
2.2 KiB
Python

"""
# Copyright (c) 2025 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
from unittest.mock import Mock
from fastdeploy.config import (
CacheConfig,
FDConfig,
GraphOptimizationConfig,
ParallelConfig,
SchedulerConfig,
)
class FakeModelConfig:
def __init__(self):
self.hidden_size = 768
self.intermediate_size = 768
self.num_hidden_layers = 12
self.num_attention_heads = 12
self.rms_norm_eps = 1e-6
self.tie_word_embeddings = True
self.ori_vocab_size = 32000
self.moe_layer_start_index = 8
self.pretrained_config = Mock()
self.pretrained_config.prefix_name = "test"
self.num_key_value_heads = 1
self.head_dim = 1
self.is_quantized = False
self.hidden_act = "relu"
self.vocab_size = 32000
self.hidden_dropout_prob = 0.1
self.initializer_range = 0.02
self.max_position_embeddings = 512
self.tie_word_embeddings = True
self.model_format = "auto"
self.enable_mm = False
def get_default_test_fd_config():
graph_opt_config = GraphOptimizationConfig(args={})
scheduler_config = SchedulerConfig(args={})
scheduler_config.max_num_seqs = 1
parallel_config = ParallelConfig(args={})
parallel_config.data_parallel_rank = 1
cache_config = CacheConfig({})
model_config = FakeModelConfig()
fd_config = FDConfig(
graph_opt_config=graph_opt_config,
parallel_config=parallel_config,
cache_config=cache_config,
scheduler_config=scheduler_config,
model_config=model_config,
test_mode=True,
)
return fd_config