ChatGLM3-6B

๐Ÿ’ป Github Repo โ€ข ๐Ÿฆ Twitter โ€ข ๐Ÿ“ƒ [GLM@ACL 22] [GitHub] โ€ข ๐Ÿ“ƒ [GLM-130B@ICLR 23] [GitHub]

๐Ÿ‘‹ Join our Slack and WeChat

๐Ÿ“Experience the larger-scale ChatGLM model at chatglm.cn

GLM-4 ๅผ€ๆบๆจกๅž‹

ๆˆ‘ไปฌๅทฒ็ปๅ‘ๅธƒๆœ€ๆ–ฐ็š„ GLM-4 ๆจกๅž‹๏ผŒ่ฏฅๆจกๅž‹ๅœจๅคšไธชๆŒ‡ๆ ‡ไธŠๆœ‰ไบ†ๆ–ฐ็š„็ช็ ด๏ผŒๆ‚จๅฏไปฅๅœจไปฅไธ‹ไธคไธชๆธ ้“ไฝ“้ชŒๆˆ‘ไปฌ็š„ๆœ€ๆ–ฐๆจกๅž‹ใ€‚

  • GLM-4 ๅผ€ๆบๆจกๅž‹ ๆˆ‘ไปฌๅทฒ็ปๅผ€ๆบไบ† GLM-4-9B ็ณปๅˆ—ๆจกๅž‹๏ผŒๅœจๅ„้กนๆŒ‡ๆ ‡็š„ๆต‹่ฏ•ไธŠๆœ‰ๆ˜Žๆ˜พๆๅ‡๏ผŒๆฌข่ฟŽๅฐ่ฏ•ใ€‚

ไป‹็ป (Introduction)

ChatGLM3-6B ๆ˜ฏ ChatGLM ็ณปๅˆ—ๆœ€ๆ–ฐไธ€ไปฃ็š„ๅผ€ๆบๆจกๅž‹๏ผŒๅœจไฟ็•™ไบ†ๅ‰ไธคไปฃๆจกๅž‹ๅฏน่ฏๆต็•…ใ€้ƒจ็ฝฒ้—จๆง›ไฝŽ็ญ‰ไผ—ๅคšไผ˜็ง€็‰นๆ€ง็š„ๅŸบ็ก€ไธŠ๏ผŒChatGLM3-6B ๅผ•ๅ…ฅไบ†ๅฆ‚ไธ‹็‰นๆ€ง๏ผš

  1. ๆ›ดๅผบๅคง็š„ๅŸบ็ก€ๆจกๅž‹๏ผš ChatGLM3-6B ็š„ๅŸบ็ก€ๆจกๅž‹ ChatGLM3-6B-Base ้‡‡็”จไบ†ๆ›ดๅคšๆ ท็š„่ฎญ็ปƒๆ•ฐๆฎใ€ๆ›ดๅ……ๅˆ†็š„่ฎญ็ปƒๆญฅๆ•ฐๅ’Œๆ›ดๅˆ็†็š„่ฎญ็ปƒ็ญ–็•ฅใ€‚ๅœจ่ฏญไน‰ใ€ๆ•ฐๅญฆใ€ๆŽจ็†ใ€ไปฃ็ ใ€็Ÿฅ่ฏ†็ญ‰ไธๅŒ่ง’ๅบฆ็š„ๆ•ฐๆฎ้›†ไธŠๆต‹่ฏ„ๆ˜พ็คบ๏ผŒChatGLM3-6B-Base ๅ…ทๆœ‰ๅœจ 10B ไปฅไธ‹็š„้ข„่ฎญ็ปƒๆจกๅž‹ไธญๆœ€ๅผบ็š„ๆ€ง่ƒฝใ€‚
  2. ๆ›ดๅฎŒๆ•ด็š„ๅŠŸ่ƒฝๆ”ฏๆŒ๏ผš ChatGLM3-6B ้‡‡็”จไบ†ๅ…จๆ–ฐ่ฎพ่ฎก็š„ Prompt ๆ ผๅผ๏ผŒ้™คๆญฃๅธธ็š„ๅคš่ฝฎๅฏน่ฏๅค–ใ€‚ๅŒๆ—ถๅŽŸ็”Ÿๆ”ฏๆŒๅทฅๅ…ท่ฐƒ็”จ๏ผˆFunction Call๏ผ‰ใ€ไปฃ็ ๆ‰ง่กŒ๏ผˆCode Interpreter๏ผ‰ๅ’Œ Agent ไปปๅŠก็ญ‰ๅคๆ‚ๅœบๆ™ฏใ€‚
  3. ๆ›ดๅ…จ้ข็š„ๅผ€ๆบๅบๅˆ—๏ผš ้™คไบ†ๅฏน่ฏๆจกๅž‹ ChatGLM3-6B ๅค–๏ผŒ่ฟ˜ๅผ€ๆบไบ†ๅŸบ็ก€ๆจกๅž‹ ChatGLM-6B-Baseใ€้•ฟๆ–‡ๆœฌๅฏน่ฏๆจกๅž‹ ChatGLM3-6B-32Kใ€‚ไปฅไธŠๆ‰€ๆœ‰ๆƒ้‡ๅฏนๅญฆๆœฏ็ ”็ฉถๅฎŒๅ…จๅผ€ๆ”พ๏ผŒๅœจๅกซๅ†™้—ฎๅท่ฟ›่กŒ็™ป่ฎฐๅŽไบฆๅ…่ฎธๅ…่ดนๅ•†ไธšไฝฟ็”จใ€‚

ChatGLM3-6B is the latest open-source model in the ChatGLM series. While retaining many excellent features such as smooth dialogue and low deployment threshold from the previous two generations, ChatGLM3-6B introduces the following features:

  1. More Powerful Base Model: The base model of ChatGLM3-6B, ChatGLM3-6B-Base, employs a more diverse training dataset, more sufficient training steps, and a more reasonable training strategy. Evaluations on datasets such as semantics, mathematics, reasoning, code, knowledge, etc., show that ChatGLM3-6B-Base has the strongest performance among pre-trained models under 10B.
  2. More Comprehensive Function Support: ChatGLM3-6B adopts a newly designed Prompt format, in addition to the normal multi-turn dialogue. It also natively supports function call, code interpreter, and complex scenarios such as agent tasks.
  3. More Comprehensive Open-source Series: In addition to the dialogue model ChatGLM3-6B, the base model ChatGLM-6B-Base and the long-text dialogue model ChatGLM3-6B-32K are also open-sourced. All the weights are fully open for academic research, and after completing the questionnaire registration, they are also allowed for free commercial use.

่ฝฏไปถไพ่ต– (Dependencies)

pip install protobuf transformers==4.30.2 cpm_kernels torch>=2.0 gradio mdtex2html sentencepiece accelerate

ไปฃ็ ่ฐƒ็”จ (Code Usage)

ๅฏไปฅ้€š่ฟ‡ๅฆ‚ไธ‹ไปฃ็ ่ฐƒ็”จ ChatGLM3-6B ๆจกๅž‹ๆฅ็”Ÿๆˆๅฏน่ฏ๏ผš

You can generate dialogue by invoking the ChatGLM3-6B model with the following code:

>>> from transformers import AutoTokenizer, AutoModel
>>> tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True)
>>> model = AutoModel.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True).half().cuda()
>>> model = model.eval()
>>> response, history = model.chat(tokenizer, "ไฝ ๅฅฝ", history=[])
>>> print(response)
ไฝ ๅฅฝ๐Ÿ‘‹!ๆˆ‘ๆ˜ฏไบบๅทฅๆ™บ่ƒฝๅŠฉๆ‰‹ ChatGLM-6B,ๅพˆ้ซ˜ๅ…ด่งๅˆฐไฝ ,ๆฌข่ฟŽ้—ฎๆˆ‘ไปปไฝ•้—ฎ้ข˜ใ€‚
>>> response, history = model.chat(tokenizer, "ๆ™šไธŠ็กไธ็€ๅบ”่ฏฅๆ€ŽไนˆๅŠž", history=history)
>>> print(response)
ๆ™šไธŠ็กไธ็€ๅฏ่ƒฝไผš่ฎฉไฝ ๆ„Ÿๅˆฐ็„ฆ่™‘ๆˆ–ไธ่ˆ’ๆœ,ไฝ†ไปฅไธ‹ๆ˜ฏไธ€ไบ›ๅฏไปฅๅธฎๅŠฉไฝ ๅ…ฅ็ก็š„ๆ–นๆณ•:

1. ๅˆถๅฎš่ง„ๅพ‹็š„็ก็œ ๆ—ถ้—ด่กจ:ไฟๆŒ่ง„ๅพ‹็š„็ก็œ ๆ—ถ้—ด่กจๅฏไปฅๅธฎๅŠฉไฝ ๅปบ็ซ‹ๅฅๅบท็š„็ก็œ ไน ๆƒฏ,ไฝฟไฝ ๆ›ดๅฎนๆ˜“ๅ…ฅ็กใ€‚ๅฐฝ้‡ๅœจๆฏๅคฉ็š„็›ธๅŒๆ—ถ้—ดไธŠๅบŠ,ๅนถๅœจๅŒไธ€ๆ—ถ้—ด่ตทๅบŠใ€‚
2. ๅˆ›้€ ไธ€ไธช่ˆ’้€‚็š„็ก็œ ็Žฏๅขƒ:็กฎไฟ็ก็œ ็Žฏๅขƒ่ˆ’้€‚,ๅฎ‰้™,้ป‘ๆš—ไธ”ๆธฉๅบฆ้€‚ๅฎœใ€‚ๅฏไปฅไฝฟ็”จ่ˆ’้€‚็š„ๅบŠไธŠ็”จๅ“,ๅนถไฟๆŒๆˆฟ้—ด้€š้ฃŽใ€‚
3. ๆ”พๆพ่บซๅฟƒ:ๅœจ็กๅ‰ๅšไบ›ๆ”พๆพ็š„ๆดปๅŠจ,ไพ‹ๅฆ‚ๆณกไธช็ƒญๆฐดๆพก,ๅฌไบ›่ฝปๆŸ”็š„้Ÿณไน,้˜…่ฏปไธ€ไบ›ๆœ‰่ถฃ็š„ไนฆ็ฑ็ญ‰,ๆœ‰ๅŠฉไบŽ็ผ“่งฃ็ดงๅผ ๅ’Œ็„ฆ่™‘,ไฝฟไฝ ๆ›ดๅฎนๆ˜“ๅ…ฅ็กใ€‚
4. ้ฟๅ…้ฅฎ็”จๅซๆœ‰ๅ’–ๅ•กๅ› ็š„้ฅฎๆ–™:ๅ’–ๅ•กๅ› ๆ˜ฏไธ€็งๅˆบๆฟ€ๆ€ง็‰ฉ่ดจ,ไผšๅฝฑๅ“ไฝ ็š„็ก็œ ่ดจ้‡ใ€‚ๅฐฝ้‡้ฟๅ…ๅœจ็กๅ‰้ฅฎ็”จๅซๆœ‰ๅ’–ๅ•กๅ› ็š„้ฅฎๆ–™,ไพ‹ๅฆ‚ๅ’–ๅ•ก,่Œถๅ’Œๅฏไนใ€‚
5. ้ฟๅ…ๅœจๅบŠไธŠๅšไธŽ็ก็œ ๆ— ๅ…ณ็š„ไบ‹ๆƒ…:ๅœจๅบŠไธŠๅšไบ›ไธŽ็ก็œ ๆ— ๅ…ณ็š„ไบ‹ๆƒ…,ไพ‹ๅฆ‚็œ‹็”ตๅฝฑ,็Žฉๆธธๆˆๆˆ–ๅทฅไฝœ็ญ‰,ๅฏ่ƒฝไผšๅนฒๆ‰ฐไฝ ็š„็ก็œ ใ€‚
6. ๅฐ่ฏ•ๅ‘ผๅธๆŠ€ๅทง:ๆทฑๅ‘ผๅธๆ˜ฏไธ€็งๆ”พๆพๆŠ€ๅทง,ๅฏไปฅๅธฎๅŠฉไฝ ็ผ“่งฃ็ดงๅผ ๅ’Œ็„ฆ่™‘,ไฝฟไฝ ๆ›ดๅฎนๆ˜“ๅ…ฅ็กใ€‚่ฏ•็€ๆ…ขๆ…ขๅธๆฐ”,ไฟๆŒๅ‡ ็ง’้’Ÿ,็„ถๅŽ็ผ“ๆ…ขๅ‘ผๆฐ”ใ€‚

ๅฆ‚ๆžœ่ฟ™ไบ›ๆ–นๆณ•ๆ— ๆณ•ๅธฎๅŠฉไฝ ๅ…ฅ็ก,ไฝ ๅฏไปฅ่€ƒ่™‘ๅ’จ่ฏขๅŒป็”Ÿๆˆ–็ก็œ ไธ“ๅฎถ,ๅฏปๆฑ‚่ฟ›ไธ€ๆญฅ็š„ๅปบ่ฎฎใ€‚

ๅ…ณไบŽๆ›ดๅคš็š„ไฝฟ็”จ่ฏดๆ˜Ž๏ผŒๅŒ…ๆ‹ฌๅฆ‚ไฝ•่ฟ่กŒๅ‘ฝไปค่กŒๅ’Œ็ฝ‘้กต็‰ˆๆœฌ็š„ DEMO๏ผŒไปฅๅŠไฝฟ็”จๆจกๅž‹้‡ๅŒ–ไปฅ่Š‚็œๆ˜พๅญ˜๏ผŒ่ฏทๅ‚่€ƒๆˆ‘ไปฌ็š„ Github Repoใ€‚

For more instructions, including how to run CLI and web demos, and model quantization, please refer to our Github Repo.

ๅ่ฎฎ (License)

ๆœฌไป“ๅบ“็š„ไปฃ็ ไพ็…ง Apache-2.0 ๅ่ฎฎๅผ€ๆบ๏ผŒChatGLM3-6B ๆจกๅž‹็š„ๆƒ้‡็š„ไฝฟ็”จๅˆ™้œ€่ฆ้ตๅพช Model Licenseใ€‚

The code in this repository is open-sourced under the Apache-2.0 license, while the use of the ChatGLM3-6B model weights needs to comply with the Model License.

ๅผ•็”จ (Citation)

ๅฆ‚ๆžœไฝ ่ง‰ๅพ—ๆˆ‘ไปฌ็š„ๅทฅไฝœๆœ‰ๅธฎๅŠฉ็š„่ฏ๏ผŒ่ฏท่€ƒ่™‘ๅผ•็”จไธ‹ๅˆ—่ฎบๆ–‡ใ€‚

If you find our work helpful, please consider citing the following paper.

@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.'}
}
Downloads last month
30,986
Safetensors
Model size
6.24B params
Tensor type
FP16
ยท
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no pipeline_tag.

Model tree for THUDM/chatglm3-6b

Adapters
7 models
Finetunes
4 models
Quantizations
12 models

Spaces using THUDM/chatglm3-6b 100