Skip to content

Commit b9163b1

Browse files
committed
fix "unrecognized model type 'llava'" error
1 parent 57f1a8d commit b9163b1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

‎packages/llm/local_llm/local_llm.py‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,7 @@ def __init__(self, model_path, **kwargs):
146146
self.model_path = model_path
147147
self.model_config = AutoConfig.from_pretrained(model_path)
148148

149-
# moved CLIP to after LLM is loaded because of MLC CUDA errors when running in subprocess
150-
#self.init_vision(**kwargs)
151-
152-
def init_vision(self, **kwargs):
153-
"""
154-
Init vision embedding/projection models for VLMs like llava, MiniGPT-4, ect.
155-
@internal this function is automatically called by LocalLM initializer.
156-
"""
149+
# patch the config to change llava to llama so the quant tools handle it
157150
self.has_vision = 'llava' in self.model_config.model_type.lower()
158151

159152
if self.has_vision:
@@ -167,11 +160,19 @@ def init_vision(self, **kwargs):
167160
json.dump(cfg, cfg_file, indent=2)
168161
else:
169162
self.has_vision = 'llava' in self.model_config._name_or_path.lower()
170-
163+
171164
for arch in self.model_config.architectures:
172165
if 'llava' in arch.lower():
173166
self.has_vision = True
174167

168+
# moved CLIP to after LLM is loaded because of MLC CUDA errors when running in subprocess
169+
#self.init_vision(**kwargs)
170+
171+
def init_vision(self, **kwargs):
172+
"""
173+
Init vision embedding/projection models for VLMs like llava, MiniGPT-4, ect.
174+
@internal this function is automatically called by LocalLM initializer.
175+
"""
175176
if not self.has_vision:
176177
return
177178

0 commit comments

Comments
 (0)