MCPcopy Create free account
hub / github.com/LHRLAB/ChatKBQA / load_untrained_model

Function load_untrained_model

config.py:197–216  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

195 args.bootstrapping_update_epochs = bootstrapping_update_epochs
196
197def load_untrained_model(args):
198 args.model_type = args.model_type.lower()
199 config = AutoConfig.from_pretrained(
200 args.config_name if args.config_name else args.model_name_or_path,
201 cache_dir=args.cache_dir if args.cache_dir else None,
202 )
203 tokenizer = AutoTokenizer.from_pretrained(
204 args.tokenizer_name if args.tokenizer_name else args.model_name_or_path,
205 do_lower_case=args.do_lower_case,
206 cache_dir=args.cache_dir if args.cache_dir else None,
207 )
208 model_class = MODEL_TYPE_DICT[args.model_type]
209 model = model_class.from_pretrained(
210 args.model_name_or_path,
211 from_tf=bool(".ckpt" in args.model_name_or_path),
212 config=config,
213 cache_dir=args.cache_dir if args.cache_dir else None,
214 )
215
216 return config, tokenizer, model
217
218def get_model_class(args):
219 return MODEL_TYPE_DICT[args.model_type]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected