codegeex4-all-9b
Go to file
xxl 95a7596e11 first commit 2024-11-26 09:20:52 +08:00
.gitattributes Add .gitattributes 2024-11-25 14:30:45 +08:00
LICENSE first commit 2024-11-26 09:20:52 +08:00
README.md first commit 2024-11-26 09:20:52 +08:00
README_en.md first commit 2024-11-26 09:20:52 +08:00
config.json first commit 2024-11-26 09:20:52 +08:00
configuration.json first commit 2024-11-26 09:20:52 +08:00
configuration_chatglm.py first commit 2024-11-26 09:20:52 +08:00
generation_config.json first commit 2024-11-26 09:20:52 +08:00
model-00001-of-00004.safetensors first commit 2024-11-26 09:20:52 +08:00
model-00002-of-00004.safetensors first commit 2024-11-26 09:20:52 +08:00
model-00003-of-00004.safetensors first commit 2024-11-26 09:20:52 +08:00
model-00004-of-00004.safetensors first commit 2024-11-26 09:20:52 +08:00
model.safetensors.index.json first commit 2024-11-26 09:20:52 +08:00
modeling_chatglm.py first commit 2024-11-26 09:20:52 +08:00
tokenization_chatglm.py first commit 2024-11-26 09:20:52 +08:00
tokenizer.model first commit 2024-11-26 09:20:52 +08:00
tokenizer_config.json first commit 2024-11-26 09:20:52 +08:00

README_en.md

license license_name license_link language tags inference pipeline_tag
other codegeex4 https://modelscope.cn/models/ZhipuAI/codegeex4-all-9b/file/view/master?fileName=LICENSE&status=0
zh
en
glm
codegeex
thudm
false text-generation

CodeGeeX4: Open Multilingual Code Generation Model

We introduce CodeGeeX4-ALL-9B, the open-source version of the latest CodeGeeX4 model series. It is a multilingual code generation model continually trained on the GLM-4-9B, significantly enhancing its code generation capabilities. Using a single CodeGeeX4-ALL-9B model, it can support comprehensive functions such as code completion and generation, code interpreter, web search, function call, repository-level code Q&A, covering various scenarios of software development. CodeGeeX4-ALL-9B has achieved highly competitive performance on public benchmarks, such as BigCodeBench and NaturalCodeBench. It is currently the most powerful code generation model with less than 10B parameters, even surpassing much larger general-purpose models, achieving the best balance in terms of inference speed and model performance.

Get Started

Use 4.39.0<=transformers<=4.40.2 to quickly launch codegeex4-all-9b

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

The model weights are licensed under the following License.

Citation

If you find our work helpful, please feel free to cite the following paper:

@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}
}