---
title: Codegeex4
canonical_url: "https://www.modelscope.cn/models/MoYuit/Codegeex4"
md_url: "https://www.modelscope.cn/models/MoYuit/Codegeex4.md"
repository: MoYuit/Codegeex4
chinese_name: Codegeex4-ALL-9B_Q8
last_updated: 2026-05-17
license: other
model_type:
  - chatglm
architectures:
  - ChatGLMModel
library_name:
  - transformer
  - gguf
language:
  - zh
  - en
  - bn
  - cs
  - da
  - de
  - dv
  - el
  - ee
  - eo
  - es
  - et
  - ff
downloads: 130
stars: 2
tags:
  - glm
  - codegeex
  - thudm
---

# Codegeex4

> Codegeex4 - MoYuit 在 ModelScope 开源的模型。Codegeex4-ALL-9B 归属于代码大模型的范畴。此模型拥有代码补全与生成、代码解释器、联网搜索、工具调用、仓库级长代码问答及生成等全方面的功能，能够对编程开发的各类场景予以覆盖。在百亿参数以下的代码大模型当中 Codegeex4-ALL-9B 的性能最为强大且最为全能。

MoYuit/Codegeex4 是 ModelScope 魔搭社区上的机器学习模型，采用 other 许可。

- **Repository**: MoYuit/Codegeex4
- **License**: other
- **Tags**: glm, codegeex, thudm
- **Downloads**: 130
- **Stars**: 2
- **Last updated**: 2026-05-17

Source: https://www.modelscope.cn/models/MoYuit/Codegeex4

---

# CodeGeeX4: 开源多语言代码生成模型


Read This in [English](https://modelscope.cn/models/ZhipuAI/codegeex4-all-9b/file/view/master?fileName=README_en.md&status=1)

[CodeGeeX4 GitHub](https://github.com/THUDM/CodeGeeX4) 

我们推出了 CodeGeeX4-ALL-9B，这是最新的 CodeGeeX4 系列模型的开源版本。该模型是在 [GLM-4-9B](https://github.com/THUDM/GLM-4) 基础上持续训练的多语言代码生成模型，显著提升了代码生成能力。使用单个 CodeGeeX4-ALL-9B 模型，可以支持代码补全与生成、代码解释、联网搜索、函数调用、仓库级代码问答等多种功能，覆盖了软件开发的各个场景。CodeGeeX4-ALL-9B 在 [BigCodeBench](https://huggingface.co/datasets/bigcode/bigcodebench) 和 [NaturalCodeBench](https://github.com/THUDM/NaturalCodeBench) 等公开基准测试中取得了极具竞争力的表现。它是目前参数量少于 100 亿的最强代码生成模型，甚至超越了更大的通用模型，在推理速度和模型性能方面达到了最佳平衡。

## 快速开始

请使用 `4.39.0<=transformers<=4.40.2` 部署：

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained("THUDM/codegeex4-all-9b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    "THUDM/codegeex4-all-9b",
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
    trust_remote_code=True
).to(device).eval()
inputs = tokenizer.apply_chat_template([{"role": "user", "content": "write a quick sort"}], add_generation_prompt=True, tokenize=True, return_tensors="pt", return_dict=True).to(device)
with torch.no_grad():
    outputs = model.generate(**inputs)
    outputs = outputs[:, inputs['input_ids'].shape[1]:]
    print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

## License

CodeGeeX4-ALL-9B 模型的权重的使用则需要遵循 [License](https://modelscope.cn/models/ZhipuAI/codegeex4-all-9b/file/view/master?fileName=LICENSE&status=0).


## 引用

如果您觉得我们的工作对您有帮助，欢迎引用以下论文：

```
@inproceedings{zheng2023codegeex,
  title={CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X},
  author={Qinkai Zheng and Xiao Xia and Xu Zou and Yuxiao Dong and Shan Wang and Yufei Xue and Zihan Wang and Lei Shen and Andi Wang and Yang Li and Teng Su and Zhilin Yang and Jie Tang},
  booktitle={Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  pages={5673--5684},
  year={2023}
}
```
