Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
inference: false
|
| 7 |
+
tags:
|
| 8 |
+
- transformers
|
| 9 |
+
- gguf
|
| 10 |
+
- imatrix
|
| 11 |
+
- codegeex4-all-9b
|
| 12 |
+
---
|
| 13 |
+
Quantizations of https://huggingface.co/THUDM/codegeex4-all-9b
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
### Inference Clients/UIs
|
| 17 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
| 18 |
+
* [JanAI](https://github.com/janhq/jan)
|
| 19 |
+
* [KoboldCPP](https://github.com/LostRuins/koboldcpp)
|
| 20 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
| 21 |
+
* [ollama](https://github.com/ollama/ollama)
|
| 22 |
+
* [GPT4All](https://github.com/nomic-ai/gpt4all)
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
# From original readme
|
| 27 |
+
|
| 28 |
+
## Get Started
|
| 29 |
+
|
| 30 |
+
Use `4.39.0<=transformers<=4.40.2` to quickly launch [codegeex4-all-9b](https://huggingface.co/THUDM/codegeex4-all-9b):
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
import torch
|
| 34 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 35 |
+
|
| 36 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained("THUDM/codegeex4-all-9b", trust_remote_code=True)
|
| 38 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 39 |
+
"THUDM/codegeex4-all-9b",
|
| 40 |
+
torch_dtype=torch.bfloat16,
|
| 41 |
+
low_cpu_mem_usage=True,
|
| 42 |
+
trust_remote_code=True
|
| 43 |
+
).to(device).eval()
|
| 44 |
+
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)
|
| 45 |
+
with torch.no_grad():
|
| 46 |
+
outputs = model.generate(**inputs, max_length=256)
|
| 47 |
+
outputs = outputs[:, inputs['input_ids'].shape[1]:]
|
| 48 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
If you want to build the **chat** prompt manually, please make sure it follows the following format:
|
| 52 |
+
```
|
| 53 |
+
f"<|system|>\n{system_prompt}\n<|user|>\n{prompt}\n<|assistant|>\n"
|
| 54 |
+
```
|
| 55 |
+
Default system_prompt:
|
| 56 |
+
```
|
| 57 |
+
你是一位智能编程助手,你叫CodeGeeX。你会为用户回答关于编程、代码、计算机方面的任何问题,并提供格式规范、可以执行、准确安全的代码,并在必要时提供详细的解释。
|
| 58 |
+
```
|
| 59 |
+
The English version:
|
| 60 |
+
```
|
| 61 |
+
You are an intelligent programming assistant named CodeGeeX. You will answer any questions users have about programming, coding, and computers, and provide code that is formatted correctly.
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
For **infilling** ability, please use (without system prompt):
|
| 65 |
+
```
|
| 66 |
+
f"<|user|>\n<|code_suffix|>{suffix}<|code_prefix|>{prefix}<|code_middle|><|assistant|>\n"
|
| 67 |
+
```
|
| 68 |
+
Additional infos (like file path, programming language, mode) can be added. Example:
|
| 69 |
+
```
|
| 70 |
+
<|user|>
|
| 71 |
+
###PATH:src/example.py
|
| 72 |
+
###LANGUAGE:Python
|
| 73 |
+
###MODE:BLOCK
|
| 74 |
+
<|code_suffix|>{suffix}<|code_prefix|>{prefix}<|code_middle|><|assistant|>
|
| 75 |
+
```
|