qnguyen3 commited on
Commit
15f3ea8
1 Parent(s): 283e0a3

Update serve/builder.py

Browse files
Files changed (1) hide show
  1. serve/builder.py +6 -6
serve/builder.py CHANGED
@@ -37,8 +37,8 @@ def load_pretrained_model(model_path, model_base, model_name, model_type, load_8
37
 
38
  print('Loading nanoLLaVA from base model...')
39
  if model_type == 'qwen1.5-1.8b' or model_type == 'qwen1.5-0.5b':
40
- tokenizer = AutoTokenizer.from_pretrained(model_base, use_fast=True)
41
- model = AutoModelForCausalLM.from_pretrained(model_base, low_cpu_mem_usage=True, config=lora_cfg_pretrained,
42
  **kwargs)
43
 
44
  token_num, tokem_dim = model.lm_head.out_features, model.lm_head.in_features
@@ -82,8 +82,8 @@ def load_pretrained_model(model_path, model_base, model_name, model_type, load_8
82
 
83
  cfg_pretrained = AutoConfig.from_pretrained(model_path)
84
  if model_type == 'qwen1.5-1.8b' or model_type == 'qwen1.5-0.5b':
85
- tokenizer = AutoTokenizer.from_pretrained(model_base, use_fast=True)
86
- model = AutoModelForCausalLM.from_pretrained(model_base, low_cpu_mem_usage=True, config=cfg_pretrained,
87
  **kwargs)
88
 
89
  mm_projector_weights = torch.load(os.path.join(model_path, 'mm_projector.bin'), map_location='cpu')
@@ -91,8 +91,8 @@ def load_pretrained_model(model_path, model_base, model_name, model_type, load_8
91
  model.load_state_dict(mm_projector_weights, strict=False)
92
  else:
93
  if model_type == 'qwen1.5-1.8b' or model_type == 'qwen1.5-0.5b':
94
- tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=True)
95
- model = AutoModelForCausalLM.from_pretrained(model_path, low_cpu_mem_usage=True, **kwargs)
96
 
97
  model.resize_token_embeddings(len(tokenizer))
98
 
 
37
 
38
  print('Loading nanoLLaVA from base model...')
39
  if model_type == 'qwen1.5-1.8b' or model_type == 'qwen1.5-0.5b':
40
+ tokenizer = AutoTokenizer.from_pretrained(model_base, use_fast=True, trust_remote_code=True)
41
+ model = AutoModelForCausalLM.from_pretrained(model_base, low_cpu_mem_usage=True, config=lora_cfg_pretrained, trust_remote_code=True,
42
  **kwargs)
43
 
44
  token_num, tokem_dim = model.lm_head.out_features, model.lm_head.in_features
 
82
 
83
  cfg_pretrained = AutoConfig.from_pretrained(model_path)
84
  if model_type == 'qwen1.5-1.8b' or model_type == 'qwen1.5-0.5b':
85
+ tokenizer = AutoTokenizer.from_pretrained(model_base, use_fast=True, trust_remote_code=True)
86
+ model = AutoModelForCausalLM.from_pretrained(model_base, low_cpu_mem_usage=True, config=cfg_pretrained, trust_remote_code=True,
87
  **kwargs)
88
 
89
  mm_projector_weights = torch.load(os.path.join(model_path, 'mm_projector.bin'), map_location='cpu')
 
91
  model.load_state_dict(mm_projector_weights, strict=False)
92
  else:
93
  if model_type == 'qwen1.5-1.8b' or model_type == 'qwen1.5-0.5b':
94
+ tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=True, trust_remote_code=True)
95
+ model = AutoModelForCausalLM.from_pretrained(model_path, low_cpu_mem_usage=True, trust_remote_code=True, **kwargs)
96
 
97
  model.resize_token_embeddings(len(tokenizer))
98