Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
szelok authored and randoentity committed Jul 27, 2024
1 parent 6bab4c2 commit c76711c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ def huggingface_loader(model_name):

if 'chatglm' in model_name.lower():
LoaderClass = AutoModel
elif 'llava' in model_name.lower():
from transformers import LlamaConfig, LlamaForCausalLM
class LlavaConfig(LlamaConfig):
model_type = "llava"
class LlavaLlamaForCausalLM(LlamaForCausalLM):
config_class = LlavaConfig
AutoConfig.register("llava", LlavaConfig, exist_ok=True)
AutoModelForCausalLM.register(LlavaConfig, LlavaLlamaForCausalLM, exist_ok=True)
LoaderClass = LlavaLlamaForCausalLM
else:
if config.to_dict().get('is_encoder_decoder', False):
LoaderClass = AutoModelForSeq2SeqLM
Expand Down

0 comments on commit c76711c

Please sign in to comment.