Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# GPT-Neo-125M-Code-Clippy-Dedup
|
2 |
+
|
3 |
+
## Model Description
|
4 |
+
|
5 |
+
PT-Neo-125M-Code-Clippy-Dedup is a [GPT-Neo-125M model](https://huggingface.co/EleutherAI/gpt-neo-125M) finetuned using causal language modeling on our deduplicated version of the Code Clippy Data dataset, which was scraped from public Github repositories (more information in the provided link). This model is specialized to autocomplete methods in multiple programming languages.
|
6 |
+
## Training data
|
7 |
+
|
8 |
+
[Code Clippy Data dataset](https://huggingface.co/datasets/code_search_net).
|
9 |
+
|
10 |
+
## Training procedure
|
11 |
+
|
12 |
+
The training script used to train this model can be found [here](https://github.com/ncoop57/gpt-code-clippy/blob/camera-ready/training/run_clm_apps.py).
|
13 |
+
|
14 |
+
## Intended Use and Limitations
|
15 |
+
|
16 |
+
The model is finetuned methods from the python language and is intended to autocomplete python methods given some prompt (method signature and docstring).
|
17 |
+
|
18 |
+
### How to use
|
19 |
+
|
20 |
+
You can use this model directly with a pipeline for text generation. This example generates a different sequence each time it's run:
|
21 |
+
|
22 |
+
```py
|
23 |
+
|
24 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, FlaxAutoModelForCausalLM
|
25 |
+
|
26 |
+
model = AutoModelForCausalLM.from_pretrained("flax-community/gpt-neo-125M-code-clippy-code-search-py")
|
27 |
+
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained("flax-community/gpt-neo-125M-code-clippy-code-search-py")
|
29 |
+
|
30 |
+
prompt = """def greet(name):
|
31 |
+
'''A function to greet user. Given a user name it should say hello'''
|
32 |
+
"""
|
33 |
+
|
34 |
+
input_ids = tokenizer(prompt, return_tensors='pt').input_ids.to(device)
|
35 |
+
|
36 |
+
start = input_ids.size(1)
|
37 |
+
|
38 |
+
out = model.generate(input_ids, do_sample=True, max_length=50, num_beams=2,
|
39 |
+
|
40 |
+
early_stopping=True, eos_token_id=tokenizer.eos_token_id, )
|
41 |
+
|
42 |
+
print(tokenizer.decode(out[0][start:]))
|
43 |
+
|
44 |
+
```
|
45 |
+
|
46 |
+
### Limitations and Biases
|
47 |
+
|
48 |
+
The model is intended to be used for research purposes and comes with no guarantees of quality of generated code.
|
49 |
+
|
50 |
+
The paper ["Evaluating Large Language Models Trained on Code"](https://arxiv.org/abs/2107.03374) from OpenAI has a good discussion on what the impact of a large language model trained on code could be. Therefore, some parts of their discuss are highlighted here as it pertains to this dataset and models that may be trained from it. **As well as some differences in views from the paper, particularly around legal implications**.
|
51 |
+
|
52 |
+
1. **Over-reliance:** A language model trained on large datasets such as this one for the task of autogenerating code may generate plausible solutions that may appear correct, but are not necessarily the correct solution. Not properly evaluating the generated code may cause have negative consequences such as the introduction of bugs, or the introduction of security vulnerabilities. Therefore, it is important that users are aware of the limitations and potential negative consequences of using a language model trained on this dataset.
|
53 |
+
2. **Economic and labor market impacts:** Large language models trained on large code datasets such as this one that are capable of generating high-quality code have the potential to automate part of the software development process. This may negatively impact software developers. However, as discussed in the paper, as shown in the Summary Report of software developers from [O*NET OnLine](https://www.onetonline.org/link/summary/15-1252.00), developers don't just write software.
|
54 |
+
3. **Security implications:** No filtering or checking of vulnerabilities or buggy code was performed. This means that the dataset may contain code that may be malicious or contain vulnerabilities. Therefore, any model trained on this dataset may generate vulnerable, buggy, or malicious code. In safety critical software, this could lead to software that may work improperly and could result in serious consequences depending on the software. Additionally, a model trained on this dataset may be used to generate malicious code on purpose in order to perform ransomware or other such attacks.
|
55 |
+
4. **Legal implications:** No filtering was performed on licensed code. This means that the dataset may contain restrictive licensed code. As discussed in the paper, public Github repositories may fall under "fair use." However, there has been little to no previous cases of such usages of licensed publicly available code. Therefore, any model trained on this dataset may be required to obey license terms that align with the software it was trained on such as GPL-3.0, which is why we purposefully put this dataset under the GPL-3.0 license. It is unclear the legal ramifications of using a language model trained on this dataset.
|
56 |
+
5. **Biases:** The programming languages most represented in the dataset this model was trained on are Javascript and Python. Therefore, other, still popular languages such as C and C++, are less represented and therefore model performance for these languages will be less comparatively. Additionally, this dataset only contains public repositories and so may not be representative of code written by private developers. No filtering was performed for potential racist, offensive, or otherwise inappropriate content. Therefore there may be such content in the dataset that will be reflected in models trained on it.
|
57 |
+
|
58 |
+
GPT-Neo-125M-Code-Clippy-Dedup is finetuned from GPT-Neo and might have inherited biases and limitations from it. See [GPT-Neo model card](https://huggingface.co/EleutherAI/gpt-neo-125M#limitations-and-biases) for details.
|
59 |
+
|
60 |
+
## Eval results
|
61 |
+
|
62 |
+
Coming soon...
|