MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / load

Function load

light-eval/src/eval_mmvet.py:89–113  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

87 return chunks[k]
88
89def load(args):
90 # define the model
91 misc.init_distributed_mode(args)
92 fs_init.initialize_model_parallel(args.model_parallel_size)
93 model = MetaModel(args.llama_type, args.llama_config, args.tokenizer_path, with_visual=True)
94 print(f"load pretrained from {args.pretrained_path}")
95 load_tensor_parallel_model_list(model, args.pretrained_path)
96
97 if args.quant:
98 print("Quantizing model to 4bit!")
99
100 from transformers.utils.quantization_config import BitsAndBytesConfig
101 quantization_config = BitsAndBytesConfig.from_dict(
102 config_dict={
103 "load_in_8bit": False,
104 "load_in_4bit": True,
105 "bnb_4bit_quant_type": "nf4",
106 },
107 return_unused_kwargs=False,
108 )
109 quantize(model, quantization_config)
110
111 print("Model = %s" % str(model))
112 model.bfloat16().cuda()
113 return model
114
115@ torch.inference_mode()
116def generate_output(model, img_path, prompt):

Callers 1

eval_mmvet.pyFile · 0.70

Calls 4

MetaModelClass · 0.90
quantizeFunction · 0.90
printFunction · 0.85

Tested by

no test coverage detected