A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 17, 06:45 UTC
Add blacklist in model checkpoint (#1325)
Woosuk Kwon committed
Oct 12, 2023 at 01:05 UTC
875afe38ab3b622ea2e84162799d5368cfb05257
1 file changed
+11
-1
vllm/model_executor/weight_utils.py
+11
-1
@@ -144,8 +144,18 @@ def prepare_hf_model_weights(
144
for pattern in allow_patterns:
145
hf_weights_files += glob.glob(os.path.join(hf_folder, pattern))
146
if not use_safetensors:
147
+ # Exclude files that are not needed for inference.
148
+ # https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/trainer.py#L227-L233
149
+ blacklist = [
150
+ "training_args.bin",
151
+ "optimizer.bin",
152
+ "optimizer.pt",
153
+ "scheduler.pt",
154
+ "scaler.pt",
155
+ ]
156
hf_weights_files = [
148
- x for x in hf_weights_files if not x.endswith("training_args.bin")
157
+ f for f in hf_weights_files
158
+ if not any(f.endswith(x) for x in blacklist)
159
]
160
161
if len(hf_weights_files) == 0 and use_safetensors and fall_back_to_pt: