MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / load_models_tokenizer

Function load_models_tokenizer

eval_general/eval_mmlu_hf.py:31–37  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

29'''
30
31def load_models_tokenizer(args):
32 tokenizer = AutoTokenizer.from_pretrained(args.checkpoint_path)
33 model = transformers.AutoModelForCausalLM.from_pretrained(
34 args.checkpoint_path, use_safetensors=True, device_map="auto", trust_remote_code=True, torch_dtype=torch.bfloat16).eval()
35 model.generation_config = GenerationConfig.from_pretrained(
36 args.checkpoint_path)
37 return model, tokenizer
38
39def format_example(line, include_answer=True):
40 example = 'Question: ' + line['question']

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected