binglinchengxia commited on
Commit
007a63a
·
verified ·
1 Parent(s): 18030b7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -3
README.md CHANGED
@@ -1,3 +1,74 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - multilingual
4
+ tags:
5
+ - code-generation
6
+ - transformers
7
+ license: mit
8
+ ---
9
+ <div align="center">
10
+ <img src="https://raw.githubusercontent.com/Anditty/OASIS/refs/heads/main/Group.svg" width="60%" alt="Kwaipilot" />
11
+ </div>
12
+ <hr>
13
+
14
+ # Kwaipilot KwaiCoder-DS-V2-Lite-Base
15
+
16
+ ## 1.Model Details
17
+
18
+ **Introduction**
19
+
20
+ KwaiCoder-23BA4-v1 is the latest open-source self-developed code completion model from the Kwaipilot team at Kuaishou. The training of the model relies on an efficient training approach proposed by the Kwaipilot team. By incorporating techniques such as model pruning, knowledge distillation, and fine-grained merging, the training of the 23B-wide MoE architecture code completion model was achieved at 1/30 of the cost compared to traditional methods. It has also set new SOTA benchmarks across multiple code-related evaluation datasets.
21
+
22
+ **Performance**
23
+ <div align="center">
24
+ <img src="https://raw.githubusercontent.com/binglinchengxiash0514/Megatron-LM/refs/heads/main/images/WX20250124-114002%402x.png"/>
25
+ </div>
26
+ <hr>
27
+
28
+ ## 2.Usage
29
+
30
+ **Code Completion**
31
+ ```python
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+ import torch
34
+ model_id = "Kwaipilot/KwaiCoder-DS-V2-Lite-Base"
35
+ tokenizer = AutoTokenizer.from_pretrained(model_id,trust_remote_code=True)
36
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16,trust_remote_code=True)
37
+ text = "#write a quick sort algorithm"
38
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
39
+ outputs = model.generate(**inputs, max_new_tokens=80)
40
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True)[len(text):])
41
+ ```
42
+ **Code Insertion**
43
+ ```python
44
+ from transformers import AutoModelForCausalLM, AutoTokenizer
45
+ import torch
46
+ model_id = "Kwaipilot/KwaiCoder-DS-V2-Lite-Base"
47
+ tokenizer = AutoTokenizer.from_pretrained(model_id,trust_remote_code=True)
48
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16,trust_remote_code=True)
49
+ text = """<|fim▁begin|>def find_longest_substring(s):
50
+ seen = {}
51
+ max_length = 0
52
+ start = 0
53
+ <|fim▁hole|>
54
+ if char in seen and seen[char] >= start:
55
+ start = seen[char] + 1
56
+ seen[char] = end
57
+ max_length = max(max_length, end - start + 1)
58
+ return max_length<|fim▁end|>"""
59
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
60
+ outputs = model.generate(**inputs, max_new_tokens=80)
61
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True)[len(text):])
62
+ ```
63
+
64
+ ## 3.License
65
+ This code repository is licensed under the MIT License. The use of KwaiCoder-DS-V2-Lite-Base models is subject to the Model License.
66
+
67
+ ## 4.BibTex
68
+ ```BibTex
69
+ @misc{kwaicoder,
70
+ title = {KwaiCoder: Code mathematical abilities comprehensive improvement.},
71
+ author = {Kwaipilot team},
72
+ year = {2024},
73
+ }
74
+ ```