Skip to content

Commit

Permalink
[Bugfix] Deprecate registration of custom configs to huggingface (#9083)
Browse files Browse the repository at this point in the history
  • Loading branch information
heheda12345 authored Oct 5, 2024
1 parent 15986f5 commit cfadb9c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
3 changes: 2 additions & 1 deletion tests/models/decoder_only/vision_language/test_internvl.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def __init__(self, hf_runner: HfRunner):
self.tokenizer = hf_runner.tokenizer
self.dtype = hf_runner.model.dtype

self.config = AutoConfig.from_pretrained(hf_runner.model_name)
self.config = AutoConfig.from_pretrained(hf_runner.model_name,
trust_remote_code=True)
self.vision_config = self.config.vision_config
self.use_thumbnail = self.config.use_thumbnail
self.min_num = self.config.min_dynamic_patch
Expand Down
7 changes: 0 additions & 7 deletions tests/models/encoder_decoder/vision_language/test_mllama.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ def _run_test(
def process(hf_inputs: BatchEncoding):
return hf_inputs

from transformers.models.mllama import MllamaConfig as MllamaConfigHf

# use transformer's MllamaConfig for hf_runner
# and vllm's MllamaConfig for vllm_runner
AutoConfig.register("mllama", MllamaConfigHf, exist_ok=True)
with hf_runner(model,
dtype=dtype,
model_kwargs={"device_map": "auto"},
Expand All @@ -213,8 +208,6 @@ def process(hf_inputs: BatchEncoding):
for prompts, images in inputs
]

from vllm.transformers_utils.configs.mllama import MllamaConfig
AutoConfig.register("mllama", MllamaConfig, exist_ok=True)
for hf_outputs, vllm_outputs in zip(hf_outputs_per_image,
vllm_outputs_per_image):
check_logprobs_close(
Expand Down
8 changes: 0 additions & 8 deletions vllm/transformers_utils/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import contextlib
import enum
import json
from pathlib import Path
Expand Down Expand Up @@ -61,13 +60,6 @@
**_CONFIG_REGISTRY_OVERRIDE_HF
}

for name, cls in _CONFIG_REGISTRY.items():
with contextlib.suppress(ValueError):
if name in _CONFIG_REGISTRY_OVERRIDE_HF:
AutoConfig.register(name, cls, exist_ok=True)
else:
AutoConfig.register(name, cls)


class ConfigFormat(str, enum.Enum):
AUTO = "auto"
Expand Down

0 comments on commit cfadb9c

Please sign in to comment.