Instructions to use zai-org/codegeex4-all-9b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use zai-org/codegeex4-all-9b-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="zai-org/codegeex4-all-9b-GGUF", filename="codegeex4-all-9b-IQ2_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use zai-org/codegeex4-all-9b-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf zai-org/codegeex4-all-9b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/zai-org/codegeex4-all-9b-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use zai-org/codegeex4-all-9b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zai-org/codegeex4-all-9b-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/codegeex4-all-9b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zai-org/codegeex4-all-9b-GGUF:Q4_K_M
- Ollama
How to use zai-org/codegeex4-all-9b-GGUF with Ollama:
ollama run hf.co/zai-org/codegeex4-all-9b-GGUF:Q4_K_M
- Unsloth Studio new
How to use zai-org/codegeex4-all-9b-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for zai-org/codegeex4-all-9b-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for zai-org/codegeex4-all-9b-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for zai-org/codegeex4-all-9b-GGUF to start chatting
- Docker Model Runner
How to use zai-org/codegeex4-all-9b-GGUF with Docker Model Runner:
docker model run hf.co/zai-org/codegeex4-all-9b-GGUF:Q4_K_M
- Lemonade
How to use zai-org/codegeex4-all-9b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull zai-org/codegeex4-all-9b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.codegeex4-all-9b-GGUF-Q4_K_M
List all available models
lemonade list
File size: 3,429 Bytes
e495506 6a04071 e495506 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # CodeGeeX4: 开源多语言代码生成模型
<center>
<img src="https://raw.githubusercontent.com/THUDM/CodeGeeX4/main/resources/logo.jpeg" alt="CodeGeeX4">
</center>
[CodeGeeX4 GitHub](https://github.com/THUDM/CodeGeeX4)
!!! 本仓库为 CodeGeeX4 权重的GGUF版本, 原始版本请见[链接](https://huggingface.co/THUDM/codegeex4-all-9b). !!!
我们推出了 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 亿的最强代码生成模型,甚至超越了更大的通用模型,在推理速度和模型性能方面达到了最佳平衡。
## 快速开始
下载模型权重:
```
huggingface-cli download THUDM/codegeex4-all-9b-GGUF
```
使用最新版本的 llama.cpp 运行 codegeex4-all-9b-GGUF
```
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake . -B build
cmake --build build --config Release
build/bin/llama-cli -m Your_Model_Path -p "Your_Input"
```
确保输入符合以下格式:
```
f"<|system|>\n{system_prompt}\n<|user|>\n{prompt}\n<|assistant|>\n"
```
默认 system_prompt:
```
你是一位智能编程助手,你叫CodeGeeX。你会为用户回答关于编程、代码、计算机方面的任何问题,并提供格式规范、可以执行、准确安全的代码,并在必要时提供详细的解释。
```
## 评测指标
| **模型** | **序列长度** | **HumanEval** | **MBPP** | **NCB** | **LCB** | **HumanEvalFIM** | **CRUXEval-O** |
|-----------------------------|----------------|---------------|----------|---------|---------|------------------|----------------|
| Llama3-70B-intruct | 8K | 77.4 | 82.3 | 37.0 | 27.4 | - | - |
| DeepSeek Coder 33B Instruct | 16K | 81.1 | 80.4 | 39.3 | 29.3 | 78.2 | 49.9 |
| Codestral-22B | 32K | 81.1 | 78.2 | 46.0 | 35.3 | 91.6 | 51.3 |
| CodeGeeX4-All-9B | 128K | 82.3 | 75.7 | 40.4 | 28.5 | 85.0 | 47.1 |
## License
CodeGeeX4-ALL-9B 模型的权重的使用则需要遵循 [License](./LICENSE).
## 引用
如果您觉得我们的工作对您有帮助,欢迎引用以下论文:
```
@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}
}
```
|