Commit
·
e00d68b
1
Parent(s):
2d54e7d
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
tasks:
|
| 4 |
+
- code-generation
|
| 5 |
+
---
|
| 6 |
+
# Model Card for CodeFuse-13B
|
| 7 |
+
|
| 8 |
+

|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
[[中文]](#chinese) [[English]](#english)
|
| 12 |
+
|
| 13 |
+
<a id="english"></a>
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
## Model Description
|
| 17 |
+
CodeFuse-13B is a 13 billion parameter code generation model trained on the GPT-NeoX framework, capable of handling code sequences of up to 4096 characters. This model was pretrained on a dataset consisting of 1000B token code, Chinese, and English data, covering over 40 programming languages. To further enhance the effectiveness and quality of the generated code, the model was fine-tuned on the CodeFuse-Evol-instruction-66k dataset, enabling it to produce more accurate, efficient, and compliant code. Pass@1 achieved 37.1% on the HumanEval evaluation set(BeamSearch strategy, BeamSize=3).
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
## Requirements
|
| 21 |
+
* Python 3.8 or above.
|
| 22 |
+
* PyTorch 1.12 or above, with a recommendation for 2.0 or above.
|
| 23 |
+
* Transformers 4.24.0 or above.
|
| 24 |
+
* It is advisable to use CUDA 11.4 or above (for GPU users and flash-attention users, this option should be considered).
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
## Quickstart
|
| 28 |
+
|
| 29 |
+
```
|
| 30 |
+
import torch
|
| 31 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 32 |
+
|
| 33 |
+
tokenizer = AutoTokenizer.from_pretrained(("CodeFuse-13B-evol-instruct-4k"))
|
| 34 |
+
model = AutoModelForCausalLM.from_pretrained(("CodeFuse-13B-evol-instruct-4k"), device_map="auto").half().eval()
|
| 35 |
+
|
| 36 |
+
input_ids = tokenizer.encode("# language: Python\ndef quick_sort(array):\n", return_tensors="pt").to("cuda")
|
| 37 |
+
output_ids = model.generate(input_ids, max_new_tokens=200)
|
| 38 |
+
|
| 39 |
+
print(tokenizer.decode(output_ids[0]))
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## MD5
|
| 43 |
+
We notice that the file may be corrupted during transfer process. Please check MD5 value before use.
|
| 44 |
+
|
| 45 |
+
| Model File | MD5 Value |
|
| 46 |
+
|:---------------------------------|:--------------------------------:|
|
| 47 |
+
| pytorch_model-00001-of-00006.bin | b79e4ccc93c40fa6113aaf6a434473d5 |
|
| 48 |
+
| pytorch_model-00002-of-00006.bin | 5a82f19e3f62c693e41fe627084c722b |
|
| 49 |
+
| pytorch_model-00003-of-00006.bin | d4b53c391a353d0fc0a1be1c913d5f04 |
|
| 50 |
+
| pytorch_model-00004-of-00006.bin | f9e3dcdea13ff02f4e3aad4f9db7a33f |
|
| 51 |
+
| pytorch_model-00005-of-00006.bin | 698a8f2f05723a572193733bce12eb93 |
|
| 52 |
+
| pytorch_model-00006-of-00006.bin | 312439d0b810f1bb81034fe094ff84c7 |
|
| 53 |
+
|
| 54 |
+
<a id="chinese"></a>
|
| 55 |
+
|
| 56 |
+
## 简介
|
| 57 |
+
CodeFuse-13B是基于GPT-NeoX框架训练的13B参数代码生成模型,能够处理4096个字符的代码序列。该模型在1000B Token的代码、中文、英文数据数据集上进行预训练,覆盖超过40种编程语言。为了进一步提升生成代码的效果和质量,该模型还在CodeFuse-Evol-instruction-66k数据集上进行了微调,使得该模型能够生成更加准确、高效、符合要求的代码。在HumanEval评测集上Pass@1达到37.1%(采用BeamSearch解码,其中BeamSize=3)。
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
## 要求
|
| 61 |
+
* python 3.8及以上版本
|
| 62 |
+
* pytorch 1.12及以上版本,推荐2.0及以上版本
|
| 63 |
+
* transformers 4.24.0及以上版本
|
| 64 |
+
* 建议使用CUDA 11.4及以上(GPU用户、flash-attention用户等需考虑此选
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
## 快速使用
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
import torch
|
| 71 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 72 |
+
|
| 73 |
+
tokenizer = AutoTokenizer.from_pretrained(("CodeFuse-13B-evol-instruct-4k"))
|
| 74 |
+
model = AutoModelForCausalLM.from_pretrained(("CodeFuse-13B-evol-instruct-4k"), device_map="auto").half().eval()
|
| 75 |
+
|
| 76 |
+
input_ids = tokenizer.encode("# language: Python\ndef quick_sort(array):\n", return_tensors="pt").to("cuda")
|
| 77 |
+
output_ids = model.generate(input_ids, max_new_tokens=200)
|
| 78 |
+
|
| 79 |
+
print(tokenizer.decode(output_ids[0]))
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## MD5
|
| 83 |
+
我们发现模型文件可能会在传输过程中损坏,使用前请检查文件MD5值。
|
| 84 |
+
|
| 85 |
+
| 模型文件 | MD5值 |
|
| 86 |
+
|:---------------------------------|:--------------------------------:|
|
| 87 |
+
| pytorch_model-00001-of-00006.bin | b79e4ccc93c40fa6113aaf6a434473d5 |
|
| 88 |
+
| pytorch_model-00002-of-00006.bin | 5a82f19e3f62c693e41fe627084c722b |
|
| 89 |
+
| pytorch_model-00003-of-00006.bin | d4b53c391a353d0fc0a1be1c913d5f04 |
|
| 90 |
+
| pytorch_model-00004-of-00006.bin | f9e3dcdea13ff02f4e3aad4f9db7a33f |
|
| 91 |
+
| pytorch_model-00005-of-00006.bin | 698a8f2f05723a572193733bce12eb93 |
|
| 92 |
+
| pytorch_model-00006-of-00006.bin | 312439d0b810f1bb81034fe094ff84c7 |
|