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

Function test_model_cache

tests/model_loader/test_model_cache.py:79–130  ·  view source on GitHub ↗
(
    fd_runner,
    model_name_or_path: str,
    tensor_parallel_size: int,
    max_num_seqs: int,
    max_model_len: int,
    max_tokens: int,
    quantization: str,
    env,
    monkeypatch,
)

Source from the content-addressed store, hash-verified

77 params,
78)
79def test_model_cache(
80 fd_runner,
81 model_name_or_path: str,
82 tensor_parallel_size: int,
83 max_num_seqs: int,
84 max_model_len: int,
85 max_tokens: int,
86 quantization: str,
87 env,
88 monkeypatch,
89) -> None:
90 model_path = get_paddle_model_path(model_name_or_path)
91
92 fd_outputs_v1 = run_with_timeout(
93 target=form_model_get_output_topp0,
94 args=(
95 fd_runner,
96 model_path,
97 tensor_parallel_size,
98 max_num_seqs,
99 max_model_len,
100 max_tokens,
101 quantization,
102 "default_v1",
103 prompts,
104 ),
105 )
106
107 if env:
108 for k, v in env.items():
109 monkeypatch.setenv(k, v)
110
111 fd_outputs_v1_with_cache = run_with_timeout(
112 target=form_model_get_output_topp0,
113 args=(
114 fd_runner,
115 model_path,
116 tensor_parallel_size,
117 max_num_seqs,
118 max_model_len,
119 max_tokens,
120 quantization,
121 "default_v1",
122 prompts,
123 ),
124 )
125 check_tokens_id_and_text_close(
126 outputs_0_lst=fd_outputs_v1,
127 outputs_1_lst=fd_outputs_v1_with_cache,
128 name_0="default_v1 loader",
129 name_1="default_v1 loader using cache",
130 )

Callers

nothing calls this directly

Calls 4

get_paddle_model_pathFunction · 0.90
run_with_timeoutFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected