File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
model_executor/model_loader Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11
11
ChatCompletionContentPartImageParam , ChatCompletionContentPartTextParam ,
12
12
MultiModalItemTracker , _ContentPart , _parse_chat_message_content_part )
13
13
from vllm .inputs import TokensPrompt
14
- from vllm .model_executor .model_loader import get_model_cls
15
14
from vllm .model_executor .models .interfaces import supports_score_template
16
15
from vllm .multimodal .inputs import MultiModalDataDict
17
16
from vllm .outputs import PoolingRequestOutput
@@ -140,6 +139,8 @@ def apply_score_template(
140
139
prompt_1 : str ,
141
140
prompt_2 : str ,
142
141
) -> str :
142
+ # NOTE(Simon): lazy import to avoid bring in all dependencies (e.g. gguf)
143
+ from vllm .model_executor .model_loader import get_model_cls
143
144
144
145
model = get_model_cls (model_config )
145
146
if supports_score_template (model ):
@@ -162,6 +163,9 @@ def post_process_tokens(
162
163
Note:
163
164
This is an in-place operation.
164
165
"""
166
+ # NOTE(Simon): lazy import to avoid bring in all dependencies (e.g. gguf)
167
+ from vllm .model_executor .model_loader import get_model_cls
168
+
165
169
model = get_model_cls (model_config )
166
170
if supports_score_template (model ):
167
171
model .post_process_tokens (prompt )
Original file line number Diff line number Diff line change 14
14
from typing import Any , Callable , Optional , Union
15
15
16
16
import filelock
17
- import gguf
18
17
import huggingface_hub .constants
19
18
import numpy as np
20
19
import torch
40
39
SafetensorsStreamer = runai_model_streamer .placeholder_attr (
41
40
"SafetensorsStreamer" )
42
41
42
+ try :
43
+ import gguf
44
+ except ImportError :
45
+ gguf = PlaceholderModule ("gguf" )
46
+
43
47
try :
44
48
from fastsafetensors import SafeTensorsFileLoader , SingleGroup
45
49
except ImportError :
You can’t perform that action at this time.
0 commit comments