https://github.com/artificialzeng/glm-4
GLM-4 series: Open Multilingual Multimodal Chat LMs | 开源多语言多模态对话模型
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (4.0%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
GLM-4 series: Open Multilingual Multimodal Chat LMs | 开源多语言多模态对话模型
Basic Info
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Fork of THUDM/GLM-4
Created almost 2 years ago
· Last pushed almost 2 years ago
https://github.com/ArtificialZeng/GLM-4/blob/main/
# GLM-4Report HF Repo ModelScope WiseModel Twitter Discord
AI GLM
Read this in [English](README_en.md) ## - **News**: ```2024/07/24```: [](https://medium.com/@ChatGLM/glm-long-scaling-pre-trained-model-contexts-to-millions-caa3c48dea85) GLM-4-9B - **News**: ``2024/7/16``: GLM-4-9B-Chat ` transformers` `4.42.4`, `basic_demo/requirements.txt` - **News**: ``2024/7/9``: GLM-4-9B-Chat [Ollama](https://github.com/ollama/ollama),[Llama.cpp](https://github.com/ggerganov/llama.cpp)[PR](https://github.com/ggerganov/llama.cpp/pull/8031) - **News**: ``2024/7/1``: GLM-4V-9B () [](finetune_demo) - **News**: ``2024/6/28``: GLM-4-9B-Chat ITREX OpenVINO CPU/GPU GLM-4-9B [](intel_device_demo) - **News**: ``2024/6/24``: Flash Attention 2, `basic_demo/trans_cli_demo.py` - **News**: ``2024/6/19``: - **News**: ``2024/6/18``: [](https://arxiv.org/pdf/2406.12793), - **News**: ``2024/6/05``: GLM-4-9B ## GLM-4-9B AI GLM-4 **GLM-4-9B** **GLM-4-9B-Chat** Llama-3-8B GLM-4-9B-Chat Function Call 128K 26 1M 200 **GLM-4-9B-Chat-1M** GLM-4-9B GLM-4V-9B**GLM-4V-9B** 1120 * 1120 GLM-4V-9B GPT-4-turbo-2024-04-09Gemini 1.0 ProQwen-VL-Max Claude 3 Opus ## Model List | Model | Type | Seq Length | Download | Online Demo | |------------------|------|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | GLM-4-9B | Base | 8K | [ Huggingface](https://huggingface.co/THUDM/glm-4-9b) [ ModelScope](https://modelscope.cn/models/ZhipuAI/glm-4-9b) [ WiseModel](https://wisemodel.cn/models/ZhipuAI/glm-4-9b) | / | | GLM-4-9B-Chat | Chat | 128K | [ Huggingface](https://huggingface.co/THUDM/glm-4-9b-chat) [ ModelScope](https://modelscope.cn/models/ZhipuAI/glm-4-9b-chat) [ WiseModel](https://wisemodel.cn/models/ZhipuAI/GLM-4-9B-Chat) | [ ModelScope CPU](https://modelscope.cn/studios/dash-infer/GLM-4-Chat-DashInfer-Demo/summary)
[ ModelScope vLLM](https://modelscope.cn/studios/ZhipuAI/glm-4-9b-chat-vllm/summary) | | GLM-4-9B-Chat-1M | Chat | 1M | [ Huggingface](https://huggingface.co/THUDM/glm-4-9b-chat-1m) [ ModelScope](https://modelscope.cn/models/ZhipuAI/glm-4-9b-chat-1m) [ WiseModel](https://wisemodel.cn/models/ZhipuAI/GLM-4-9B-Chat-1M) | / | | GLM-4V-9B | Chat | 8K | [ Huggingface](https://huggingface.co/THUDM/glm-4v-9b) [ ModelScope](https://modelscope.cn/models/ZhipuAI/glm-4v-9b) [ WiseModel](https://wisemodel.cn/models/ZhipuAI/GLM-4V-9B ) | [ ModelScope](https://modelscope.cn/studios/ZhipuAI/glm-4v-9b-Demo/summary) | ## ### | Model | AlignBench | MT-Bench | IFEval | MMLU | C-Eval | GSM8K | MATH | HumanEval | NaturalCodeBench | |:--------------------|:----------:|:--------:|:------:|:----:|:------:|:-----:|:----:|:---------:|:----------------:| | Llama-3-8B-Instruct | 6.40 | 8.00 | 68.6 | 68.4 | 51.3 | 79.6 | 30.0 | 62.2 | 24.7 | | ChatGLM3-6B | 5.18 | 5.50 | 28.1 | 61.4 | 69.0 | 72.3 | 25.7 | 58.5 | 11.3 | | GLM-4-9B-Chat | 7.01 | 8.35 | 69.0 | 72.4 | 75.6 | 79.6 | 50.6 | 71.8 | 32.2 | ### | Model | MMLU | C-Eval | GPQA | GSM8K | MATH | HumanEval | |:--------------------|:----:|:------:|:----:|:-----:|:----:|:---------:| | Llama-3-8B | 66.6 | 51.2 | - | 45.8 | - | 33.5 | | Llama-3-8B-Instruct | 68.4 | 51.3 | 34.2 | 79.6 | 30.0 | 62.2 | | ChatGLM3-6B-Base | 61.4 | 69.0 | 26.8 | 72.3 | 25.7 | 58.5 | | GLM-4-9B | 74.7 | 77.1 | 34.3 | 84.0 | 30.4 | 70.1 | > `GLM-4-9B` instruction Llama-3-8B-Instruct ### 1M [](https://github.com/LargeWorldModel/LWM/blob/main/scripts/eval_needle.py)  LongBench-Chat :### GLM-4-9B-Chat Llama-3-8B-Instruct | Dataset | Llama-3-8B-Instruct | GLM-4-9B-Chat | Languages | |:------------|:-------------------:|:-------------:|:----------------------------------------------------------------------------------------------:| | M-MMLU | 49.6 | 56.6 | all | | FLORES | 25.0 | 28.8 | ru, es, de, fr, it, pt, pl, ja, nl, ar, tr, cs, vi, fa, hu, el, ro, sv, uk, fi, ko, da, bg, no | | MGSM | 54.0 | 65.3 | zh, en, bn, de, es, fr, ja, ru, sw, te, th | | XWinograd | 61.7 | 73.1 | zh, en, fr, jp, ru, pt | | XStoryCloze | 84.7 | 90.7 | zh, en, ar, es, eu, hi, id, my, ru, sw, te | | XCOPA | 73.3 | 80.1 | zh, et, ht, id, it, qu, sw, ta, th, tr, vi | ### [Berkeley Function Calling Leaderboard](https://github.com/ShishirPatil/gorilla/tree/main/berkeley-function-call-leaderboard) | Model | Overall Acc. | AST Summary | Exec Summary | Relevance | |:-----------------------|:------------:|:-----------:|:------------:|:---------:| | Llama-3-8B-Instruct | 58.88 | 59.25 | 70.01 | 45.83 | | gpt-4-turbo-2024-04-09 | 81.24 | 82.14 | 78.61 | 88.75 | | ChatGLM3-6B | 57.88 | 62.18 | 69.78 | 5.42 | | GLM-4-9B-Chat | 81.00 | 80.26 | 84.40 | 87.92 | ### GLM-4V-9B | | **MMBench-EN-Test** | **MMBench-CN-Test** | **SEEDBench_IMG** | **MMStar** | **MMMU** | **MME** | **HallusionBench** | **AI2D** | **OCRBench** | |----------------------------|---------------------|---------------------|-------------------|------------|----------|---------|--------------------|----------|--------------| | **gpt-4o-2024-05-13** | 83.4 | 82.1 | 77.1 | 63.9 | 69.2 | 2310.3 | 55.0 | 84.6 | 736 | | **gpt-4-turbo-2024-04-09** | 81.0 | 80.2 | 73.0 | 56.0 | 61.7 | 2070.2 | 43.9 | 78.6 | 656 | | **gpt-4-1106-preview** | 77.0 | 74.4 | 72.3 | 49.7 | 53.8 | 1771.5 | 46.5 | 75.9 | 516 | | **InternVL-Chat-V1.5** | 82.3 | 80.7 | 75.2 | 57.1 | 46.8 | 2189.6 | 47.4 | 80.6 | 720 | | **LLaVA-Next-Yi-34B** | 81.1 | 79.0 | 75.7 | 51.6 | 48.8 | 2050.2 | 34.8 | 78.9 | 574 | | **Step-1V** | 80.7 | 79.9 | 70.3 | 50.0 | 49.9 | 2206.4 | 48.4 | 79.2 | 625 | | **MiniCPM-Llama3-V2.5** | 77.6 | 73.8 | 72.3 | 51.8 | 45.8 | 2024.6 | 42.4 | 78.4 | 725 | | **Qwen-VL-Max** | 77.6 | 75.7 | 72.7 | 49.5 | 52.0 | 2281.7 | 41.2 | 75.7 | 684 | | **Gemini 1.0 Pro** | 73.6 | 74.3 | 70.7 | 38.6 | 49.0 | 2148.9 | 45.7 | 72.9 | 680 | | **Claude 3 Opus** | 63.3 | 59.2 | 64.0 | 45.7 | 54.9 | 1586.8 | 37.8 | 70.6 | 694 | | **GLM-4V-9B** | 81.1 | 79.4 | 76.8 | 58.7 | 47.2 | 2163.8 | 46.6 | 81.1 | 786 | ## **[](basic_demo/README.md)** ### GLM-4-9B-Chat transformers : ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer device = "cuda" tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4-9b-chat", trust_remote_code=True) query = "" inputs = tokenizer.apply_chat_template([{"role": "user", "content": query}], add_generation_prompt=True, tokenize=True, return_tensors="pt", return_dict=True ) inputs = inputs.to(device) model = AutoModelForCausalLM.from_pretrained( "THUDM/glm-4-9b-chat", torch_dtype=torch.bfloat16, low_cpu_mem_usage=True, trust_remote_code=True ).to(device).eval() gen_kwargs = {"max_length": 2500, "do_sample": True, "top_k": 1} with torch.no_grad(): outputs = model.generate(**inputs, **gen_kwargs) outputs = outputs[:, inputs['input_ids'].shape[1]:] print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` vLLM : ```python from transformers import AutoTokenizer from vllm import LLM, SamplingParams # GLM-4-9B-Chat-1M # max_model_len, tp_size = 1048576, 4 # OOM max_model_lentp_size max_model_len, tp_size = 131072, 1 model_name = "THUDM/glm-4-9b-chat" prompt = [{"role": "user", "content": ""}] tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True) llm = LLM( model=model_name, tensor_parallel_size=tp_size, max_model_len=max_model_len, trust_remote_code=True, enforce_eager=True, # GLM-4-9B-Chat-1M OOM # enable_chunked_prefill=True, # max_num_batched_tokens=8192 ) stop_token_ids = [151329, 151336, 151338] sampling_params = SamplingParams(temperature=0.95, max_tokens=1024, stop_token_ids=stop_token_ids) inputs = tokenizer.apply_chat_template(prompt, tokenize=False, add_generation_prompt=True) outputs = llm.generate(prompts=inputs, sampling_params=sampling_params) print(outputs[0].outputs[0].text) ``` ### GLM-4V-9B transformers : ```python import torch from PIL import Image from transformers import AutoModelForCausalLM, AutoTokenizer device = "cuda" tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4v-9b", trust_remote_code=True) query = '' image = Image.open("your image").convert('RGB') inputs = tokenizer.apply_chat_template([{"role": "user", "image": image, "content": query}], add_generation_prompt=True, tokenize=True, return_tensors="pt", return_dict=True) # chat mode inputs = inputs.to(device) model = AutoModelForCausalLM.from_pretrained( "THUDM/glm-4v-9b", torch_dtype=torch.bfloat16, low_cpu_mem_usage=True, trust_remote_code=True ).to(device).eval() gen_kwargs = {"max_length": 2500, "do_sample": True, "top_k": 1} with torch.no_grad(): outputs = model.generate(**inputs, **gen_kwargs) outputs = outputs[:, inputs['input_ids'].shape[1]:] print(tokenizer.decode(outputs[0])) ``` : GLM-4V-9B vLLM ## GLM-4-9B GLM-4-9B + [basic_demo](basic_demo/README.md): + transformers vLLM + OpenAI API + Batch + [composite_demo](composite_demo/README.md): + GLM-4-9B-Chat GLM-4V-9B All Tools + [fintune_demo](finetune_demo/README.md): + PEFT (LORA, P-Tuning) + SFT ## + [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory): GLM-4-9B-Chat + [SWIFT](https://github.com/modelscope/swift): / GLM-4-9B-Chat / GLM-4V-9B + [Xorbits Inference](https://github.com/xorbitsai/inference): + [LangChain-ChatChat](https://github.com/chatchat-space/Langchain-Chatchat): Langchain ChatGLM RAG Agent + [self-llm](https://github.com/datawhalechina/self-llm/tree/master/GLM-4): Datawhale GLM-4-9B + [chatglm.cpp](https://github.com/li-plus/chatglm.cpp): llama.cpp ## + GLM-4 [](https://huggingface.co/THUDM/glm-4-9b/blob/main/LICENSE) + [Apache 2.0](LICENSE) ## ``` @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.'} } ``` ``` @misc{wang2023cogvlm, title={CogVLM: Visual Expert for Pretrained Language Models}, author={Weihan Wang and Qingsong Lv and Wenmeng Yu and Wenyi Hong and Ji Qi and Yan Wang and Junhui Ji and Zhuoyi Yang and Lei Zhao and Xixuan Song and Jiazheng Xu and Bin Xu and Juanzi Li and Yuxiao Dong and Ming Ding and Jie Tang}, year={2023}, eprint={2311.03079}, archivePrefix={arXiv}, primaryClass={cs.CV} } ```
![]()
Owner
- Name: Dr. Artificial曾小健
- Login: ArtificialZeng
- Kind: user
- Location: Beijing
- Website: https://blog.csdn.net/sinat_37574187?type=blog
- Repositories: 171
- Profile: https://github.com/ArtificialZeng
LLM practitioner/engineer, AI/ML/DL Quant