MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / setup_model_runner

Method setup_model_runner

tests/distributed/chunked_moe.py:126–153  ·  view source on GitHub ↗

Helper method to setup GPUModelRunner with different configurations

(self)

Source from the content-addressed store, hash-verified

124 self.fused_moe = self.setup_fused_moe()
125
126 def setup_model_runner(self):
127 """Helper method to setup GPUModelRunner with different configurations"""
128 mock_fd_config = MockFDConfig()
129
130 mock_model_config = MockModelConfig()
131 mock_cache_config = MockCacheConfig()
132
133 model_runner = GPUModelRunner.__new__(GPUModelRunner)
134 model_runner.fd_config = mock_fd_config
135 model_runner.model_config = mock_model_config
136 model_runner.cache_config = mock_cache_config
137 model_runner.attn_backends = [MockAttentionBackend()]
138 model_runner.enable_mm = True
139 model_runner.cudagraph_only_prefill = False
140 model_runner.use_cudagraph = False
141 model_runner.speculative_decoding = False
142 model_runner.share_inputs = InputBatch(mock_fd_config)
143 model_runner.share_inputs.init_share_inputs()
144 model_runner.share_inputs["caches"] = None
145 model_runner.routing_replay_manager = None
146 model_runner.exist_prefill_flag = False
147
148 if dist.get_rank() == 0:
149 model_runner.share_inputs["ids_remove_padding"] = paddle.ones([10])
150 else:
151 model_runner.share_inputs["ids_remove_padding"] = paddle.ones([1])
152
153 return model_runner
154
155 def setup_fused_moe(self):
156 mock_fd_config = MockFDConfig()

Callers 1

setUpMethod · 0.95

Calls 8

InputBatchClass · 0.90
MockModelConfigClass · 0.85
MockCacheConfigClass · 0.85
get_rankMethod · 0.80
MockFDConfigClass · 0.70
__new__Method · 0.45
init_share_inputsMethod · 0.45

Tested by

no test coverage detected