Views
No views yet
| Model | MMLU | C-Eval | GPQA | GSM8K | MATH | HumanEval |
|---|---|---|---|---|---|---|
| Llama-3-8B | 66.6 | 51.2 | - | 45.8 | - | - |
| Llama-3-8B-Instruct | 68.4 | 51.3 | 34.2 | 79.6 | 30.0 | 62.2 |
| ChatGLM3-6B-Base | 61.4 | 69.0 | - | 72.3 | 25.7 | - |
| GLM-4-9B | 74.7 | 77.1 | 34.3 | 84.0 | 30.4 | 70.1 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3import os
4
5os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set the GPU number. If a single machine has a single card, specify one. If a single machine has multiple cards, specify multiple GPU numbers.
6
7MODEL_PATH = "THUDM/glm-4-9b-hf"
8
9model = AutoModelForCausalLM.from_pretrained(
10 MODEL_PATH,
11 torch_dtype=torch.bfloat16,
12 low_cpu_mem_usage=True,
13 trust_remote_code=True,
14 device_map="auto"
15).eval()
16device = "cuda" if torch.cuda.is_available() else "cpu"
17tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH, trust_remote_code=True)
18
19encoding = tokenizer("what is your name?<|endoftext|>")
20inputs = {key: torch.tensor([value]).to(device) for key, value in encoding.items()}
21
22gen_kwargs = {"max_length": 2500, "do_sample": True, "top_k": 1}
23with torch.no_grad():
24 outputs = model.generate(**inputs, **gen_kwargs)
25 outputs = outputs[:, inputs['input_ids'].shape[1]:]
26 print(tokenizer.decode(outputs[0], skip_special_tokens=True))@misc{glm2024chatglm,
title={ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools},
author={Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang},
year={2024},
eprint={2406.12793},
archivePrefix={arXiv},
primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
}