File tree 4 files changed +10
-6
lines changed
model_executor/model_loader
4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,4 @@ def image_embeds(self) -> torch.Tensor:
26
26
"""
27
27
image_path = get_vllm_public_assets (filename = f"{ self .name } .pt" ,
28
28
s3_prefix = VLM_IMAGES_DIR )
29
- return torch .load (image_path , map_location = "cpu" )
29
+ return torch .load (image_path , map_location = "cpu" , weights_only = True )
Original file line number Diff line number Diff line change @@ -273,7 +273,8 @@ def from_local_checkpoint(
273
273
new_embeddings_tensor_path )
274
274
elif os .path .isfile (new_embeddings_bin_file_path ):
275
275
embeddings = torch .load (new_embeddings_bin_file_path ,
276
- map_location = device )
276
+ map_location = device ,
277
+ weights_only = True )
277
278
278
279
return cls .from_lora_tensors (
279
280
lora_model_id = get_lora_id ()
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def convert_bin_to_safetensor_file(
93
93
pt_filename : str ,
94
94
sf_filename : str ,
95
95
) -> None :
96
- loaded = torch .load (pt_filename , map_location = "cpu" )
96
+ loaded = torch .load (pt_filename , map_location = "cpu" , weights_only = True )
97
97
if "state_dict" in loaded :
98
98
loaded = loaded ["state_dict" ]
99
99
shared = _shared_pointers (loaded )
@@ -381,7 +381,9 @@ def np_cache_weights_iterator(
381
381
disable = not enable_tqdm ,
382
382
bar_format = _BAR_FORMAT ,
383
383
):
384
- state = torch .load (bin_file , map_location = "cpu" )
384
+ state = torch .load (bin_file ,
385
+ map_location = "cpu" ,
386
+ weights_only = True )
385
387
for name , param in state .items ():
386
388
param_path = os .path .join (np_folder , name )
387
389
with open (param_path , "wb" ) as f :
@@ -447,7 +449,7 @@ def pt_weights_iterator(
447
449
disable = not enable_tqdm ,
448
450
bar_format = _BAR_FORMAT ,
449
451
):
450
- state = torch .load (bin_file , map_location = "cpu" )
452
+ state = torch .load (bin_file , map_location = "cpu" , weights_only = True )
451
453
yield from state .items ()
452
454
del state
453
455
torch .cuda .empty_cache ()
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ def load_peft_weights(model_id: str,
89
89
adapters_weights = safe_load_file (filename , device = device )
90
90
else :
91
91
adapters_weights = torch .load (filename ,
92
- map_location = torch .device (device ))
92
+ map_location = torch .device (device ),
93
+ weights_only = True )
93
94
94
95
return adapters_weights
You can’t perform that action at this time.
0 commit comments