File tree Expand file tree Collapse file tree 3 files changed +39
-5
lines changed Expand file tree Collapse file tree 3 files changed +39
-5
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+ # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3+
4+
5+ from vllm .transformers_utils .utils import is_cloud_storage , is_gcs , is_s3
6+
7+
8+ def test_is_gcs ():
9+ assert is_gcs ("gs://model-path" )
10+ assert not is_gcs ("s3://model-path/path-to-model" )
11+ assert not is_gcs ("/unix/local/path" )
12+ assert not is_gcs ("nfs://nfs-fqdn.local" )
13+
14+
15+ def test_is_s3 ():
16+ assert is_s3 ("s3://model-path/path-to-model" )
17+ assert not is_s3 ("gs://model-path" )
18+ assert not is_s3 ("/unix/local/path" )
19+ assert not is_s3 ("nfs://nfs-fqdn.local" )
20+
21+
22+ def test_is_cloud_storage ():
23+ assert is_cloud_storage ("gs://model-path" )
24+ assert is_cloud_storage ("s3://model-path/path-to-model" )
25+ assert not is_cloud_storage ("/unix/local/path" )
26+ assert not is_cloud_storage ("nfs://nfs-fqdn.local" )
Original file line number Diff line number Diff line change 8686 is_interleaved ,
8787 maybe_override_with_speculators ,
8888)
89- from vllm .transformers_utils .utils import check_gguf_file , is_s3
89+ from vllm .transformers_utils .utils import check_gguf_file , is_cloud_storage
9090from vllm .utils .argparse_utils import FlexibleArgumentParser
9191from vllm .utils .mem_constants import GiB_bytes
9292from vllm .utils .network_utils import get_ip
@@ -1310,10 +1310,10 @@ def create_engine_config(
13101310
13111311 # Check if the model is a speculator and override model/tokenizer/config
13121312 # BEFORE creating ModelConfig, so the config is created with the target model
1313- # Skip speculator detection for S3 models since HuggingFace cannot load
1314- # configs directly from S3 URLs. S3 models can still use speculators with
1315- # explicit --speculative-config.
1316- if not is_s3 (self .model ):
1313+ # Skip speculator detection for cloud storage models (eg: S3, GCS) since
1314+ # HuggingFace cannot load configs directly from S3 URLs. S3 models can still
1315+ # use speculators with explicit --speculative-config.
1316+ if not is_cloud_storage (self .model ):
13171317 (self .model , self .tokenizer , self .speculative_config ) = (
13181318 maybe_override_with_speculators (
13191319 model = self .model ,
Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ def is_s3(model_or_path: str) -> bool:
1919 return model_or_path .lower ().startswith ("s3://" )
2020
2121
22+ def is_gcs (model_or_path : str ) -> bool :
23+ return model_or_path .lower ().startswith ("gs://" )
24+
25+
26+ def is_cloud_storage (model_or_path : str ) -> bool :
27+ return is_s3 (model_or_path ) or is_gcs (model_or_path )
28+
29+
2230def check_gguf_file (model : str | PathLike ) -> bool :
2331 """Check if the file is a GGUF model."""
2432 model = Path (model )
You can’t perform that action at this time.
0 commit comments