File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
vllm/model_executor/model_loader Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 6
6
import gguf
7
7
import torch
8
8
import torch .nn as nn
9
+ from huggingface_hub import hf_hub_download
9
10
from transformers import AutoModelForCausalLM
10
11
11
12
from vllm .config import LoadConfig , ModelConfig , VllmConfig
@@ -32,8 +33,18 @@ def __init__(self, load_config: LoadConfig):
32
33
def _prepare_weights (self , model_name_or_path : str ):
33
34
if os .path .isfile (model_name_or_path ):
34
35
return model_name_or_path
36
+ # for raw HTTPS link
37
+ if model_name_or_path .startswith (
38
+ ("http://" , "https://" )) and model_name_or_path .endswith (".gguf" ):
39
+ return hf_hub_download (url = model_name_or_path )
40
+ # repo id/filename.gguf
41
+ if "/" in model_name_or_path and model_name_or_path .endswith (".gguf" ):
42
+ repo_id , filename = model_name_or_path .rsplit ("/" , 1 )
43
+ return hf_hub_download (repo_id = repo_id , filename = filename )
35
44
else :
36
- raise ValueError (f"{ model_name_or_path } is not a file." )
45
+ raise ValueError (
46
+ f"Unrecognised GGUF reference: { model_name_or_path } "
47
+ "(expected local file, raw URL, or <repo_id>/<filename>.gguf)" )
37
48
38
49
def _get_gguf_weights_map (self , model_config : ModelConfig ):
39
50
"""
You can’t perform that action at this time.
0 commit comments